build: Minor build system tweaks

This commit is contained in:
mintsuki 2022-02-11 20:46:57 +01:00
parent e4dc460807
commit 5d407dbdf1
2 changed files with 23 additions and 23 deletions

View File

@ -1,10 +1,10 @@
PREFIX ?= @prefix@
DESTDIR ?=
override BUILDDIR := @abs_builddir@
override BUILDDIR := @BUILDDIR@
override BINDIR := $(BUILDDIR)/bin
override SRCDIR := @abs_srcdir@
override SRCDIR := @SRCDIR@
override SPACE := $(subst ,, )
override COMMA := ,
@ -13,12 +13,12 @@ MKESCAPE = $(subst $(SPACE),\ ,$(1))
SHESCAPE = $(subst ','\'',$(1))
NASMESCAPE = $(subst ','"'$(COMMA) \"'\"$(COMMA) '"',$(1))
override PATH := $(BUILDDIR)/toolchain/bin:$(SRCDIR)/toolchain/bin:/usr/local/bin:$(PATH)
override PATH := @PATH@
export PATH
override BUILD_ELTORITO_EFI := @build_eltorito_efi@
override BUILD_ELTORITO_EFI := @BUILD_ELTORITO_EFI@
WERROR ?= @werror@
WERROR ?= @WERROR@
export WERROR
ifeq ($(origin CC), default)
@ -63,10 +63,10 @@ export LIMINE_OBJDUMP
LIMINE_READELF ?= @LIMINE_READELF@
export LIMINE_READELF
override USING_CLANG := @using_clang@
override USING_CLANG := @USING_CLANG@
export USING_CLANG
override LIMINE_VERSION := @limine_version@
override LIMINE_VERSION := @PACKAGE_VERSION@
export LIMINE_VERSION
override LIMINE_COPYRIGHT := $(shell $(GREP) Copyright '$(call SHESCAPE,$(SRCDIR))/LICENSE.md')
@ -122,9 +122,9 @@ uninstall:
$(call MKESCAPE,$(BUILDDIR))/stage1.stamp: $(STAGE1_FILES) $(call MKESCAPE,$(BUILDDIR))/decompressor-build/decompressor.bin $(call MKESCAPE,$(BUILDDIR))/common-bios/stage2.bin.gz
mkdir -p '$(call SHESCAPE,$(BINDIR))'
cd '$(call SHESCAPE,$(SRCDIR))/stage1/hdd' && nasm bootsect.asm @werror@ -fbin -DBUILDDIR="'"'$(call NASMESCAPE,$(BUILDDIR))'"'" -o '$(call SHESCAPE,$(BINDIR))/limine-hdd.bin'
cd '$(call SHESCAPE,$(SRCDIR))/stage1/cd' && nasm bootsect.asm @werror@ -fbin -DBUILDDIR="'"'$(call NASMESCAPE,$(BUILDDIR))'"'" -o '$(call SHESCAPE,$(BINDIR))/limine-cd.bin'
cd '$(call SHESCAPE,$(SRCDIR))/stage1/pxe' && nasm bootsect.asm @werror@ -fbin -DBUILDDIR="'"'$(call NASMESCAPE,$(BUILDDIR))'"'" -o '$(call SHESCAPE,$(BINDIR))/limine-pxe.bin'
cd '$(call SHESCAPE,$(SRCDIR))/stage1/hdd' && nasm bootsect.asm @WERROR@ -fbin -DBUILDDIR="'"'$(call NASMESCAPE,$(BUILDDIR))'"'" -o '$(call SHESCAPE,$(BINDIR))/limine-hdd.bin'
cd '$(call SHESCAPE,$(SRCDIR))/stage1/cd' && nasm bootsect.asm @WERROR@ -fbin -DBUILDDIR="'"'$(call NASMESCAPE,$(BUILDDIR))'"'" -o '$(call SHESCAPE,$(BINDIR))/limine-cd.bin'
cd '$(call SHESCAPE,$(SRCDIR))/stage1/pxe' && nasm bootsect.asm @WERROR@ -fbin -DBUILDDIR="'"'$(call NASMESCAPE,$(BUILDDIR))'"'" -o '$(call SHESCAPE,$(BINDIR))/limine-pxe.bin'
cp '$(call SHESCAPE,$(BUILDDIR))/common-bios/limine.sys' '$(call SHESCAPE,$(BINDIR))/'
touch '$(call SHESCAPE,$(BUILDDIR))/stage1.stamp'
@ -135,7 +135,7 @@ limine-bios: common-bios decompressor
.PHONY: limine-eltorito-efi
limine-eltorito-efi:
ifeq ($(BUILD_ELTORITO_EFI), yes)
ifneq ($(BUILD_ELTORITO_EFI), no)
mkdir -p '$(call SHESCAPE,$(BINDIR))'
dd if=/dev/zero of='$(call SHESCAPE,$(BINDIR))/limine-eltorito-efi.bin' bs=512 count=2880 2>/dev/null
( mformat -i '$(call SHESCAPE,$(BINDIR))/limine-eltorito-efi.bin' -f 1440 :: && \

View File

@ -1,14 +1,18 @@
AC_INIT([Limine], m4_esyscmd([./version.sh]), [https://github.com/limine-bootloader/limine/issues], [limine])
AC_INIT([Limine], m4_esyscmd([./version.sh]), [https://github.com/limine-bootloader/limine/issues], [limine], [https://limine-bootloader.org/])
AC_PREREQ(2.69)
AC_CONFIG_AUX_DIR([build-aux])
SOURCE_DIR="$(cd "$srcdir" && pwd -P)"
BUILD_DIR="$(pwd -P)"
PATH="$BUILD_DIR/toolchain/bin$PATH_SEPARATOR$SOURCE_DIR/toolchain/bin$PATH_SEPARATOR/usr/local/bin$PATH_SEPARATOR$PATH"
SRCDIR="$(cd "$srcdir" && pwd -P)"
BUILDDIR="$(pwd -P)"
PATH="$BUILDDIR/toolchain/bin$PATH_SEPARATOR$SRCDIR/toolchain/bin$PATH_SEPARATOR/usr/local/bin$PATH_SEPARATOR$PATH"
export PATH
AC_SUBST(SRCDIR, [$SRCDIR])
AC_SUBST(BUILDDIR, [$BUILDDIR])
AC_SUBST(PATH, [$PATH])
test "x$CFLAGS" = "x" && CFLAGS='-g -O2 -pipe -Wall -Wextra'
AC_PROG_CC
@ -18,7 +22,7 @@ AC_ARG_ENABLE([werror],
werror_state="$enableval")
if test "$werror_state" = "yes"; then
AC_SUBST(werror, [-Werror])
AC_SUBST(WERROR, [-Werror])
CFLAGS="$CFLAGS -Werror"
fi
@ -59,9 +63,7 @@ if ! test "x$BUILD_ELTORITO_EFI" = "xno"; then
fi
fi
if ! test "x$BUILD_ELTORITO_EFI" = "xno"; then
AC_SUBST(build_eltorito_efi, [yes])
fi
AC_SUBST(BUILD_ELTORITO_EFI, [$BUILD_ELTORITO_EFI])
AC_ARG_VAR(TOOLCHAIN, [Alternative toolchain prefix [default: limine]])
test "x$TOOLCHAIN" = "x" && TOOLCHAIN='limine'
@ -94,9 +96,9 @@ if ! $LIMINE_CC --version >/dev/null 2>&1; then
fi
if $LIMINE_CC --version | $GREP clang >/dev/null 2>&1; then
AC_SUBST(using_clang, 1)
AC_SUBST(USING_CLANG, 1)
elif $LIMINE_CC --version | $GREP 'Free Software Foundation' >/dev/null 2>&1; then
AC_SUBST(using_clang, 0)
AC_SUBST(USING_CLANG, 0)
else
CC_ERROR_MSG
fi
@ -150,8 +152,6 @@ 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=' '
AC_SUBST(limine_version, m4_esyscmd([./version.sh]))
AC_PREFIX_DEFAULT(/usr/local)
AC_CONFIG_FILES(GNUmakefile)