build: Use config.h for generated constants

This commit is contained in:
mintsuki 2022-02-20 23:05:53 +01:00
parent 34f075516d
commit 1984f401a1
10 changed files with 17 additions and 9 deletions

1
.gitignore vendored
View File

@ -31,6 +31,7 @@
/config.log
/autom4te.cache
/GNUmakefile
/common/config.h
/common-bios
/common-uefi32
/common-uefi64

View File

@ -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

View File

@ -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 \

7
common/config.h.in Normal file
View File

@ -0,0 +1,7 @@
#ifndef __CONFIG_H__
#define __CONFIG_H__
#define LIMINE_VERSION "@PACKAGE_VERSION@"
#define LIMINE_COPYRIGHT "@LIMINE_COPYRIGHT@"
#endif

View File

@ -1,5 +1,6 @@
#include <stddef.h>
#include <stdint.h>
#include <config.h>
#include <console.h>
#include <menu.h>
#include <mm/pmm.h>

View File

@ -2,6 +2,7 @@
#include <stddef.h>
#include <stdbool.h>
#include <stdnoreturn.h>
#include <config.h>
#include <menu.h>
#include <lib/print.h>
#include <lib/blib.h>

View File

@ -1,6 +1,7 @@
#include <stdint.h>
#include <stddef.h>
#include <stdnoreturn.h>
#include <config.h>
#include <protos/multiboot1.h>
#include <lib/libc.h>
#include <lib/elf.h>

View File

@ -1,6 +1,7 @@
#include <protos/multiboot2.h>
#include <stdint.h>
#include <stddef.h>
#include <config.h>
#include <lib/libc.h>
#include <lib/elf.h>
#include <lib/blib.h>

View File

@ -1,6 +1,7 @@
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include <config.h>
#include <protos/stivale.h>
#include <protos/stivale2.h>
#include <lib/elf.h>

View File

@ -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