From 1984f401a13bee3a3fff6d07135ef6292bd52da2 Mon Sep 17 00:00:00 2001 From: mintsuki Date: Sun, 20 Feb 2022 23:05:53 +0100 Subject: [PATCH] build: Use config.h for generated constants --- .gitignore | 1 + GNUmakefile.in | 6 ------ common/GNUmakefile | 2 -- common/config.h.in | 7 +++++++ common/console.c | 1 + common/menu.c | 1 + common/protos/multiboot1.c | 1 + common/protos/multiboot2.c | 1 + common/protos/stivale2.c | 1 + configure.ac | 5 ++++- 10 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 common/config.h.in diff --git a/.gitignore b/.gitignore index 419ae40e..6e84b730 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,7 @@ /config.log /autom4te.cache /GNUmakefile +/common/config.h /common-bios /common-uefi32 /common-uefi64 diff --git a/GNUmakefile.in b/GNUmakefile.in index 9a093cda..0f8be1b7 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -71,12 +71,6 @@ export LIMINE_READELF override USING_CLANG := @USING_CLANG@ export USING_CLANG -override LIMINE_VERSION := @PACKAGE_VERSION@ -export LIMINE_VERSION - -override LIMINE_COPYRIGHT := $(shell $(GREP) Copyright '$(call SHESCAPE,$(SRCDIR))/LICENSE.md') -export LIMINE_COPYRIGHT - override STAGE1_FILES := $(shell find '$(call SHESCAPE,$(SRCDIR))/stage1' -type f -name '*.asm') .PHONY: all diff --git a/common/GNUmakefile b/common/GNUmakefile index 60fa37d8..14794d62 100644 --- a/common/GNUmakefile +++ b/common/GNUmakefile @@ -60,8 +60,6 @@ override INTERNAL_CFLAGS := \ -mno-sse \ -mno-sse2 \ -MMD \ - -DLIMINE_VERSION='"$(LIMINE_VERSION)"' \ - -DLIMINE_COPYRIGHT='"$(LIMINE_COPYRIGHT)"' \ -DCOM_OUTPUT=$(COM_OUTPUT) \ -DE9_OUTPUT=$(E9_OUTPUT) \ -I../freestanding_headers \ diff --git a/common/config.h.in b/common/config.h.in new file mode 100644 index 00000000..c93e5113 --- /dev/null +++ b/common/config.h.in @@ -0,0 +1,7 @@ +#ifndef __CONFIG_H__ +#define __CONFIG_H__ + +#define LIMINE_VERSION "@PACKAGE_VERSION@" +#define LIMINE_COPYRIGHT "@LIMINE_COPYRIGHT@" + +#endif diff --git a/common/console.c b/common/console.c index 46fb14ad..8823f106 100644 --- a/common/console.c +++ b/common/console.c @@ -1,5 +1,6 @@ #include #include +#include #include #include #include diff --git a/common/menu.c b/common/menu.c index 4ff7b777..550a83a1 100644 --- a/common/menu.c +++ b/common/menu.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include diff --git a/common/protos/multiboot1.c b/common/protos/multiboot1.c index 7d3d2e3c..7902a481 100644 --- a/common/protos/multiboot1.c +++ b/common/protos/multiboot1.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include diff --git a/common/protos/multiboot2.c b/common/protos/multiboot2.c index 40daee34..1ed1b688 100644 --- a/common/protos/multiboot2.c +++ b/common/protos/multiboot2.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include diff --git a/common/protos/stivale2.c b/common/protos/stivale2.c index ebd8334e..95c7555d 100644 --- a/common/protos/stivale2.c +++ b/common/protos/stivale2.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include diff --git a/configure.ac b/configure.ac index 5116ff1e..b67b6454 100644 --- a/configure.ac +++ b/configure.ac @@ -232,7 +232,10 @@ test "x$LIMINE_CFLAGS" = "x" && LIMINE_CFLAGS='-O3 -pipe -Wall -Wextra' AC_ARG_VAR(LIMINE_LDFLAGS, [Linker flags for Limine [default: ]]) test "x$LIMINE_LDFLAGS" = "x" && LIMINE_LDFLAGS=' ' +LIMINE_COPYRIGHT=$($GREP Copyright "$SRCDIR/LICENSE.md") +AC_SUBST(LIMINE_COPYRIGHT, [$LIMINE_COPYRIGHT]) + AC_PREFIX_DEFAULT(/usr/local) -AC_CONFIG_FILES(GNUmakefile) +AC_CONFIG_FILES(GNUmakefile common/config.h) AC_OUTPUT