build: Move to using autoconf

This commit is contained in:
mintsuki 2022-01-16 06:09:36 +01:00
parent 88e7bcc13a
commit 3bb70dcbee
13 changed files with 193 additions and 158 deletions

View File

@ -15,4 +15,4 @@ jobs:
run: sudo apt-get update && sudo apt-get install git build-essential nasm curl mtools -y
- name: Build the bootloader
run: make all
run: ./autogen.sh && make all

View File

@ -25,17 +25,26 @@ jobs:
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install git build-essential nasm gcc-mingw-w64 gcc-multilib curl mtools -y
- name: Regenerate
run: NOCONFIGURE=yes ./autogen.sh
- name: Create build dir
run: mkdir -p build
- name: Configure
run: cd build && ../configure
- name: Build the toolchain
run: make toolchain
run: make -C build toolchain
- name: Build the bootloader
run: make
run: make -C build
- name: Clean limine-install
run: make -C limine-install clean
run: rm build/bin/limine-install
- name: Build limine-install-linux-x86_64
run: make CFLAGS="-O2 -pipe -static" limine-install
run: make -C build CFLAGS="-O2 -pipe -static" limine-install
- name: Strip limine-install-linux-x86_64
run: strip build/bin/limine-install
@ -43,11 +52,8 @@ jobs:
- name: Rename limine-install-linux-x86_64
run: mv build/bin/limine-install build/bin/limine-install-linux-x86_64
- name: Clean limine-install
run: make -C limine-install clean
- name: Build limine-install-linux-x86_32
run: make CC="gcc -m32" CFLAGS="-O2 -pipe -static" limine-install
run: make -C build CC="gcc -m32" CFLAGS="-O2 -pipe -static" limine-install
- name: Strip limine-install-linux-x86_32
run: strip build/bin/limine-install
@ -55,11 +61,8 @@ jobs:
- name: Rename limine-install-linux-x86_32
run: mv build/bin/limine-install build/bin/limine-install-linux-x86_32
- name: Clean limine-install
run: make -C limine-install clean
- name: Build limine-install-win32
run: make CC="i686-w64-mingw32-gcc" CFLAGS="-O2 -pipe" limine-install
run: make -C build CC="i686-w64-mingw32-gcc" CFLAGS="-O2 -pipe" limine-install
- name: Strip limine-install-win32
run: i686-w64-mingw32-strip build/bin/limine-install.exe
@ -67,9 +70,6 @@ jobs:
- name: Rename limine-install-win32
run: mv build/bin/limine-install.exe build/bin/limine-install-win32.exe
- name: Clean limine-install
run: make -C limine-install clean
- name: Copy LICENSE to bin
run: cp LICENSE.md build/bin/
@ -94,7 +94,7 @@ jobs:
run: git checkout $TAG_NAME && rm -rf * && git checkout .
- name: Package release tarball
run: make dist
run: ./autogen.sh && make dist
- name: Create release notes
run: echo "Binary release can be found at https://github.com/limine-bootloader/limine/tree/$TAG_NAME-binary" > rel_notes.txt

11
.gitignore vendored
View File

@ -21,3 +21,14 @@ bx_enh_dbg.ini
stivale
test_image
!stage23/font.bin
configure
configure~
config.status
config.log
autom4te.cache
GNUmakefile
stage23-bios
stage23-uefi32
stage23-uefi64
decompressor-build
stage1.stamp

View File

@ -1,9 +1,11 @@
PREFIX ?= /usr/local
PREFIX ?= @prefix@
DESTDIR ?=
BUILDDIR ?= $(shell pwd)/build
BUILDDIR ?= @abs_builddir@
override BINDIR := $(BUILDDIR)/bin
SRCDIR ?= @abs_srcdir@
override SPACE := $(subst ,, )
override COMMA := ,
@ -11,24 +13,55 @@ MKESCAPE = $(subst $(SPACE),\ ,$(1))
SHESCAPE = $(subst ','\'',$(1))
NASMESCAPE = $(subst ','"'$(COMMA) \"'\"$(COMMA) '"',$(1))
override PATH := $(shell pwd)/toolchain/bin:$(PATH)
override PATH := $(BUILDDIR)/toolchain/bin:$(PATH)
export PATH
override NCPUS := $(shell nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 1)
override LIMINE_VERSION := $(shell cat version 2>/dev/null || ( git describe --exact-match --tags `git log -n1 --pretty='%h'` 2>/dev/null || git log -n1 --pretty='%h' ) )
override LIMINE_VERSION := @limine_version@
export LIMINE_VERSION
override LIMINE_COPYRIGHT := $(shell grep Copyright LICENSE.md)
override LIMINE_COPYRIGHT := $(shell grep Copyright '$(call SHESCAPE,$(SRCDIR))/LICENSE.md')
export LIMINE_COPYRIGHT
TOOLCHAIN ?= limine
ifeq ($(origin CC), default)
CC := @CC@
endif
TOOLCHAIN_CC ?= $(TOOLCHAIN)-gcc
TOOLCHAIN ?= @TOOLCHAIN@
TOOLCHAIN_CC ?= @TOOLCHAIN_CC@
TOOLCHAIN_LD ?= @TOOLCHAIN_LD@
TOOLCHAIN_AR ?= @TOOLCHAIN_AR@
TOOLCHAIN_OBJCOPY ?= @TOOLCHAIN_OBJCOPY@
TOOLCHAIN_OBJDUMP ?= @TOOLCHAIN_OBJDUMP@
TOOLCHAIN_READELF ?= @TOOLCHAIN_READELF@
ifeq ($(shell PATH='$(call SHESCAPE,$(PATH))' command -v $(TOOLCHAIN_CC) ; ), )
override TOOLCHAIN_CC := cc
override TOOLCHAIN_CC := $(CC)
endif
ifeq ($(shell PATH='$(call SHESCAPE,$(PATH))' command -v $(TOOLCHAIN_LD) ; ), )
override TOOLCHAIN_LD := ld
endif
ifeq ($(shell PATH='$(call SHESCAPE,$(PATH))' command -v $(TOOLCHAIN_AR) ; ), )
override TOOLCHAIN_AR := ar
endif
ifeq ($(shell PATH='$(call SHESCAPE,$(PATH))' command -v $(TOOLCHAIN_OBJCOPY) ; ), )
override TOOLCHAIN_OBJCOPY := objcopy
endif
ifeq ($(shell PATH='$(call SHESCAPE,$(PATH))' command -v $(TOOLCHAIN_OBJDUMP) ; ), )
override TOOLCHAIN_OBJDUMP := objdump
endif
ifeq ($(shell PATH='$(call SHESCAPE,$(PATH))' command -v $(TOOLCHAIN_READELF) ; ), )
override TOOLCHAIN_READELF := readelf
endif
export TOOLCHAIN
export TOOLCHAIN_CC
export TOOLCHAIN_LD
export TOOLCHAIN_AR
export TOOLCHAIN_OBJCOPY
export TOOLCHAIN_OBJDUMP
export TOOLCHAIN_READELF
override USING_CLANG := $(shell $(TOOLCHAIN_CC) --version | grep clang >/dev/null && echo 1)
export USING_CLANG
@ -56,7 +89,7 @@ ifeq ($(USING_CLANG), 1)
override TOOLCHAIN_CC := $(ORIG_TOOLCHAIN_CC)
endif
override STAGE1_FILES := $(shell find -L ./stage1 -type f -name '*.asm')
override STAGE1_FILES := $(shell find -L '$(call SHESCAPE,$(SRCDIR))/stage1' -type f -name '*.asm')
.PHONY: all
all: limine-uefi limine-bios
@ -64,12 +97,12 @@ all: limine-uefi limine-bios
.PHONY: limine-install
limine-install:
mkdir -p '$(call SHESCAPE,$(BINDIR))'
cp limine-install/* limine-install/.gitignore '$(call SHESCAPE,$(BINDIR))/'
$(MAKE) -C '$(call SHESCAPE,$(BINDIR))'
cp '$(call SHESCAPE,$(SRCDIR))/limine-install/'* '$(call SHESCAPE,$(SRCDIR))/limine-install/.gitignore' '$(call SHESCAPE,$(BINDIR))/'
$(MAKE) -C '$(call SHESCAPE,$(BINDIR))' CC=$(CC)
.PHONY: clean
clean: limine-bios-clean limine-uefi32-clean limine-uefi64-clean
rm -rf '$(call SHESCAPE,$(BINDIR))' '$(call SHESCAPE,$(BUILDDIR))/stage1'
rm -rf '$(call SHESCAPE,$(BINDIR))' '$(call SHESCAPE,$(BUILDDIR))/stage1.stamp'
.PHONY: install
install:
@ -84,17 +117,17 @@ install:
install -m 644 '$(call SHESCAPE,$(BINDIR))/BOOTX64.EFI' '$(DESTDIR)$(PREFIX)/share/limine/' || true
install -m 644 '$(call SHESCAPE,$(BINDIR))/BOOTIA32.EFI' '$(DESTDIR)$(PREFIX)/share/limine/' || true
$(call MKESCAPE,$(BUILDDIR))/stage1: $(STAGE1_FILES) $(call MKESCAPE,$(BUILDDIR))/decompressor/decompressor.bin $(call MKESCAPE,$(BUILDDIR))/stage23-bios/stage2.bin.gz
$(call MKESCAPE,$(BUILDDIR))/stage1.stamp: $(STAGE1_FILES) $(call MKESCAPE,$(BUILDDIR))/decompressor-build/decompressor.bin $(call MKESCAPE,$(BUILDDIR))/stage23-bios/stage2.bin.gz
mkdir -p '$(call SHESCAPE,$(BINDIR))'
cd stage1/hdd && nasm bootsect.asm -Werror -fbin -DBUILDDIR="'"'$(call NASMESCAPE,$(BUILDDIR))'"'" -o '$(call SHESCAPE,$(BINDIR))/limine-hdd.bin'
cd stage1/cd && nasm bootsect.asm -Werror -fbin -DBUILDDIR="'"'$(call NASMESCAPE,$(BUILDDIR))'"'" -o '$(call SHESCAPE,$(BINDIR))/limine-cd.bin'
cd 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))/stage23-bios/limine.sys' '$(call SHESCAPE,$(BINDIR))/'
touch '$(call SHESCAPE,$(BUILDDIR))/stage1'
touch '$(call SHESCAPE,$(BUILDDIR))/stage1.stamp'
.PHONY: limine-bios
limine-bios: stage23-bios decompressor
$(MAKE) '$(call SHESCAPE,$(BUILDDIR))/stage1'
$(MAKE) '$(call SHESCAPE,$(BUILDDIR))/stage1.stamp'
$(MAKE) limine-install
.PHONY: limine-eltorito-efi
@ -115,13 +148,13 @@ limine-uefi: limine-uefi32 limine-uefi64
$(MAKE) limine-eltorito-efi
.PHONY: limine-uefi64
limine-uefi64: reduced-gnu-efi
limine-uefi64: $(call MKESCAPE,$(SRCDIR))/reduced-gnu-efi
$(MAKE) stage23-uefi64
mkdir -p '$(call SHESCAPE,$(BINDIR))'
cp '$(call SHESCAPE,$(BUILDDIR))/stage23-uefi64/BOOTX64.EFI' '$(call SHESCAPE,$(BINDIR))/'
.PHONY: limine-uefi32
limine-uefi32: reduced-gnu-efi
limine-uefi32: $(call MKESCAPE,$(SRCDIR))/reduced-gnu-efi
$(MAKE) stage23-uefi32
mkdir -p '$(call SHESCAPE,$(BINDIR))'
cp '$(call SHESCAPE,$(BUILDDIR))/stage23-uefi32/BOOTIA32.EFI' '$(call SHESCAPE,$(BINDIR))/'
@ -135,68 +168,60 @@ limine-uefi64-clean: stage23-uefi64-clean
.PHONY: limine-uefi32-clean
limine-uefi32-clean: stage23-uefi32-clean
.PHONY: regenerate
regenerate: reduced-gnu-efi stivale
.PHONY: dist
dist:
rm -rf "limine-$(LIMINE_VERSION)"
LIST="$$(ls -A)"; mkdir "limine-$(LIMINE_VERSION)" && cp -r $$LIST "limine-$(LIMINE_VERSION)/"
rm -rf "limine-$(LIMINE_VERSION)/"*.tar*
$(MAKE) -C "limine-$(LIMINE_VERSION)" repoclean
$(MAKE) -C "limine-$(LIMINE_VERSION)" regenerate
rm -rf "limine-$(LIMINE_VERSION)/reduced-gnu-efi/.git"
rm -rf "limine-$(LIMINE_VERSION)/stivale/.git"
rm -rf "limine-$(LIMINE_VERSION)/.git"
echo "$(LIMINE_VERSION)" > "limine-$(LIMINE_VERSION)/version"
tar -Jcf "limine-$(LIMINE_VERSION).tar.xz" "limine-$(LIMINE_VERSION)"
rm -rf "limine-$(LIMINE_VERSION)"
rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)"
mkdir -p '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)"
cp -r '$(call SHESCAPE,$(SRCDIR))'/.git '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)"/
cd '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)" && git checkout .
cd '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)" && NOCONFIGURE=yes && ./autogen.sh
rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/reduced-gnu-efi/.git"
rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/stivale/.git"
rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/.git"
rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/autom4te.cache"
echo "$(LIMINE_VERSION)" > '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/version"
cd '$(call SHESCAPE,$(BUILDDIR))' && tar -Jcf "limine-$(LIMINE_VERSION).tar.xz" "limine-$(LIMINE_VERSION)"
rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)"
.PHONY: distclean
distclean: clean test-clean
rm -rf build toolchain ovmf*
distclean: clean
rm -rf toolchain ovmf* config.log config.status GNUmakefile
.PHONY: repoclean
repoclean: distclean
rm -rf stivale reduced-gnu-efi *.tar.xz
stivale:
git clone https://github.com/stivale/stivale.git
reduced-gnu-efi:
git clone https://github.com/limine-bootloader/reduced-gnu-efi.git
.PHONY: maintainer-clean
maintainer-clean: distclean
cd '$(call SHESCAPE,$(SRCDIR))' && rm -rf stivale reduced-gnu-efi configure 'configure~' autom4te.cache *.tar.xz
.PHONY: stage23-uefi64
stage23-uefi64: stivale
$(MAKE) -C stage23 all TARGET=uefi64 BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/stage23-uefi64'
stage23-uefi64: $(call MKESCAPE,$(SRCDIR))/stivale
$(MAKE) -C '$(call SHESCAPE,$(SRCDIR))/stage23' all TARGET=uefi64 BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/stage23-uefi64'
.PHONY: stage23-uefi64-clean
stage23-uefi64-clean:
$(MAKE) -C stage23 clean TARGET=uefi64 BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/stage23-uefi64'
$(MAKE) -C '$(call SHESCAPE,$(SRCDIR))/stage23' clean TARGET=uefi64 BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/stage23-uefi64'
.PHONY: stage23-uefi32
stage23-uefi32: stivale
$(MAKE) -C stage23 all TARGET=uefi32 BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/stage23-uefi32'
stage23-uefi32: $(call MKESCAPE,$(SRCDIR))/stivale
$(MAKE) -C '$(call SHESCAPE,$(SRCDIR))/stage23' all TARGET=uefi32 BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/stage23-uefi32'
.PHONY: stage23-uefi32-clean
stage23-uefi32-clean:
$(MAKE) -C stage23 clean TARGET=uefi32 BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/stage23-uefi32'
$(MAKE) -C '$(call SHESCAPE,$(SRCDIR))/stage23' clean TARGET=uefi32 BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/stage23-uefi32'
.PHONY: stage23-bios
stage23-bios: stivale
$(MAKE) -C stage23 all TARGET=bios BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/stage23-bios'
stage23-bios: $(call MKESCAPE,$(SRCDIR))/stivale
$(MAKE) -C '$(call SHESCAPE,$(SRCDIR))/stage23' all TARGET=bios BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/stage23-bios'
.PHONY: stage23-bios-clean
stage23-bios-clean:
$(MAKE) -C stage23 clean TARGET=bios BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/stage23-bios'
$(MAKE) -C '$(call SHESCAPE,$(SRCDIR))/stage23' clean TARGET=bios BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/stage23-bios'
.PHONY: decompressor
decompressor:
$(MAKE) -C decompressor all BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/decompressor'
$(MAKE) -C '$(call SHESCAPE,$(SRCDIR))/decompressor' all BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/decompressor-build'
.PHONY: decompressor-clean
decompressor-clean:
$(MAKE) -C decompressor clean BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/decompressor'
$(MAKE) -C '$(call SHESCAPE,$(SRCDIR))/decompressor' clean BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/decompressor-build'
.PHONY: test-clean
test-clean:
@ -205,7 +230,7 @@ test-clean:
.PHONY: toolchain
toolchain:
MAKE="$(MAKE)" build-aux/make_toolchain.sh "`pwd`/toolchain" -j$(NCPUS)
MAKE="$(MAKE)" '$(call SHESCAPE,$(SRCDIR))'/build-aux/make_toolchain.sh '$(call SHESCAPE,$(BUILDDIR))'/toolchain -j$(NCPUS)
ovmf-x64:
mkdir -p ovmf-x64

View File

@ -45,9 +45,9 @@ For example, to clone the latest binary release of the `v2.x` branch one can do
```bash
git clone https://github.com/limine-bootloader/limine.git --branch=v2.0-branch-binary --depth=1
```
or, to clone a specific binary point release (for example v2.65)
or, to clone a specific binary point release (for example v2.75)
```bash
git clone https://github.com/limine-bootloader/limine.git --branch=v2.65-binary --depth=1
git clone https://github.com/limine-bootloader/limine.git --branch=v2.75-binary --depth=1
```
Additionally, the absolute latest Limine binary release can be obtained by
@ -66,6 +66,18 @@ release.
*These steps are not necessary if cloning a binary release. If so, skip to*
*"Installing Limine binaries".*
### Configure
If checking out from the repository, run `./autogen.sh`, else, if using a
release tarball, run `./configure` directly.
Both `./autogen.sh` and `./configure` take arguments and environment variables;
for more information on these, run `./configure --help`.
Limine supports both in-tree and out-of-tree builds. Simply run the configure
script from the directory you wish to execute the build in. The following `make`
commands are supposed to be ran inside the build directory.
### Building the toolchain
This step can take a long time, but it will ensure that the toolchain will work
@ -86,52 +98,27 @@ In order to build Limine, the following packages have to be installed:
`GNU make`, `nasm`, `mtools` (optional, necessary to build
`limine-eltorito-efi.bin`).
Furthermore, either the toolchain must have been built in the previous
paragraph, or `gcc` or `llvm/clang` must also be installed.
`GNU binutils` is necessary in order to build the UEFI ports of Limine. A full
LLVM toolchain without `GNU binutils` can be used to build just the BIOS port
instead.
paragraph, or `gcc` or `llvm/clang` must also be installed, alongside
`GNU binutils`.
Both the UEFI and BIOS ports of the bootloader can be built, using
`GCC/GNU binutils` (which includes the shipped toolchain), with:
Then, to build Limine, run:
```bash
make # (or gmake where applicable)
```
It is possible to pass `make` additional flags, most relevantly,
`TOOLCHAIN=`, which allows one to specify an alternative toolchain for the build
system to use (the default is `limine`, resulting in program names like `limine-gcc`,
falling back to no-prefix, or host, toolchain), and `BUILDDIR=`, which specifies an
alternative build directory (for example, out of tree - the default is `./build`).
The generated bootloader files are going to be in `$BUILDDIR/bin` (by default that
is `./build/bin`).
#### Using clang/LLVM
In order to build the BIOS port fully using clang/LLVM, run `make` as such:
```bash
# (or gmake where applicable)
make limine-bios CC="clang" TOOLCHAIN="llvm" TOOLCHAIN_CC="clang" TOOLCHAIN_LD="ld.lld"
```
And in order to build the UEFI port using clang/LLVM + `GNU binutils`, run
`make` as such:
```bash
# (or gmake where applicable)
make limine-uefi TOOLCHAIN="llvm" TOOLCHAIN_CC="clang" TOOLCHAIN_LD="ld.bfd" TOOLCHAIN_OBJCOPY="objcopy"
```
Where `ld.bfd` and `objcopy` refer to GNU binutils versions of them. Specify their
full path if necessary.
The generated bootloader files are going to be in `$BUILDDIR/bin`.
## Installing Limine binaries
This step is optional as the bootloader binaries can be used from the `bin` or
release directory just fine. This step will only install them to a `share` and
`bin` directories in the specified `PREFIX` (default is `/usr/local`).
`bin` directories in the specified prefix (default is `/usr/local`, see
`.configure --help`).
Use `make install` to install the Limine binaries, optionally specifying a
different prefix with `make install PREFIX=/myprefix`.
To install Limine, run:
```bash
make install
```
## How to use

17
autogen.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/sh
set -ex
srcdir="$(realpath $(dirname "$0"))"
test -z "$srcdir" && srcdir=.
cd "$srcdir"
[ -d stivale ] || git clone https://github.com/stivale/stivale.git
[ -d reduced-gnu-efi ] || git clone https://github.com/limine-bootloader/reduced-gnu-efi.git
autoconf
if test -z "$NOCONFIGURE"; then
exec "$srcdir"/configure "$@"
fi

36
configure.ac Normal file
View File

@ -0,0 +1,36 @@
AC_INIT([Limine], m4_esyscmd([./version.sh]), [https://github.com/limine-bootloader/limine/issues], [limine])
AC_PREREQ(2.69)
AC_PROG_CC
AC_SUBST(limine_version, m4_esyscmd([./version.sh]))
AC_ARG_VAR(CC, [C compiler command [cc]])
test -z "$CC" && CC='cc'
AC_ARG_VAR(TOOLCHAIN, [Alternative toolchain prefix [limine]])
test -z "$TOOLCHAIN" && TOOLCHAIN='limine'
AC_ARG_VAR(TOOLCHAIN_CC, [Toolchain C compiler command [$(TOOLCHAIN)-gcc]])
test -z "$TOOLCHAIN_CC" && TOOLCHAIN_CC='$(TOOLCHAIN)-gcc'
AC_ARG_VAR(TOOLCHAIN_LD, [Toolchain linker command [$(TOOLCHAIN)-ld]])
test -z "$TOOLCHAIN_LD" && TOOLCHAIN_LD='$(TOOLCHAIN)-ld'
AC_ARG_VAR(TOOLCHAIN_AR, [Toolchain archiver command [$(TOOLCHAIN)-ar]])
test -z "$TOOLCHAIN_AR" && TOOLCHAIN_AR='$(TOOLCHAIN)-ar'
AC_ARG_VAR(TOOLCHAIN_OBJCOPY, [Toolchain objcopy command [$(TOOLCHAIN)-objcopy]])
test -z "$TOOLCHAIN_OBJCOPY" && TOOLCHAIN_OBJCOPY='$(TOOLCHAIN)-objcopy'
AC_ARG_VAR(TOOLCHAIN_OBJDUMP, [Toolchain objdump command [$(TOOLCHAIN)-objdump]])
test -z "$TOOLCHAIN_OBJDUMP" && TOOLCHAIN_OBJDUMP='$(TOOLCHAIN)-objdump'
AC_ARG_VAR(TOOLCHAIN_READELF, [Toolchain readelf command [$(TOOLCHAIN)-readelf]])
test -z "$TOOLCHAIN_READELF" && TOOLCHAIN_READELF='$(TOOLCHAIN)-readelf'
AC_PREFIX_DEFAULT(/usr/local)
AC_CONFIG_FILES(GNUmakefile)
AC_OUTPUT

View File

@ -11,22 +11,6 @@ ifeq ($(call MKESCAPE,$(BUILDDIR)), )
$(error BUILDDIR not specified)
endif
TOOLCHAIN ?= limine
TOOLCHAIN_CC ?= $(TOOLCHAIN)-gcc
TOOLCHAIN_LD ?= $(TOOLCHAIN)-ld
TOOLCHAIN_OBJCOPY ?= $(TOOLCHAIN)-objcopy
ifeq ($(shell command -v $(TOOLCHAIN_CC) ; ), )
override TOOLCHAIN_CC := cc
endif
ifeq ($(shell command -v $(TOOLCHAIN_LD) ; ), )
override TOOLCHAIN_LD := ld
endif
ifeq ($(shell command -v $(TOOLCHAIN_OBJCOPY) ; ), )
override TOOLCHAIN_OBJCOPY := objcopy
endif
ifeq ($(USING_CLANG), 1)
override TOOLCHAIN_CC += --target=i686-elf
endif

View File

@ -95,7 +95,7 @@ pmode:
; Align stage2 to 2K ON DISK
times 2048-($-$$) db 0
decompressor:
%strcat DECOMPRESSOR_PATH BUILDDIR, '/decompressor/decompressor.bin'
%strcat DECOMPRESSOR_PATH BUILDDIR, '/decompressor-build/decompressor.bin'
incbin DECOMPRESSOR_PATH
align 16

View File

@ -132,7 +132,7 @@ dw 0xaa55
; ********************* Stage 2 *********************
decompressor:
%strcat DECOMPRESSOR_PATH BUILDDIR, '/decompressor/decompressor.bin'
%strcat DECOMPRESSOR_PATH BUILDDIR, '/decompressor-build/decompressor.bin'
incbin DECOMPRESSOR_PATH
align 16

View File

@ -49,7 +49,7 @@ start:
; ********************* Stage 2 *********************
decompressor:
%strcat DECOMPRESSOR_PATH BUILDDIR, '/decompressor/decompressor.bin'
%strcat DECOMPRESSOR_PATH BUILDDIR, '/decompressor-build/decompressor.bin'
incbin DECOMPRESSOR_PATH
align 16

View File

@ -24,34 +24,6 @@ else
$(error Invalid target)
endif
TOOLCHAIN ?= limine
TOOLCHAIN_CC ?= $(TOOLCHAIN)-gcc
TOOLCHAIN_LD ?= $(TOOLCHAIN)-ld
TOOLCHAIN_AR ?= $(TOOLCHAIN)-ar
TOOLCHAIN_OBJCOPY ?= $(TOOLCHAIN)-objcopy
TOOLCHAIN_OBJDUMP ?= $(TOOLCHAIN)-objdump
TOOLCHAIN_READELF ?= $(TOOLCHAIN)-readelf
ifeq ($(shell command -v $(TOOLCHAIN_CC) ; ), )
override TOOLCHAIN_CC := cc
endif
ifeq ($(shell command -v $(TOOLCHAIN_LD) ; ), )
override TOOLCHAIN_LD := ld
endif
ifeq ($(shell command -v $(TOOLCHAIN_AR) ; ), )
override TOOLCHAIN_AR := ar
endif
ifeq ($(shell command -v $(TOOLCHAIN_OBJCOPY) ; ), )
override TOOLCHAIN_OBJCOPY := objcopy
endif
ifeq ($(shell command -v $(TOOLCHAIN_OBJDUMP) ; ), )
override TOOLCHAIN_OBJDUMP := objdump
endif
ifeq ($(shell command -v $(TOOLCHAIN_READELF) ; ), )
override TOOLCHAIN_READELF := readelf
endif
ifeq ($(USING_CLANG), 1)
ifeq ($(TARGET), bios)
override TOOLCHAIN_CC += --target=i686-elf

3
version.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
cat version 2>/dev/null || ( git describe --exact-match --tags `git log -n1 --pretty='%h'` 2>/dev/null || git log -n1 --pretty='%h' )