build: Move to using external cross-detect package

This commit is contained in:
mintsuki 2022-07-05 09:14:48 +02:00
parent 0431623381
commit 6106285d35
12 changed files with 111 additions and 260 deletions

View File

@ -19,7 +19,7 @@ jobs:
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Build the bootloader (LLVM)
run: ./bootstrap && ./configure TOOLCHAIN=llvm --enable-werror --enable-all && make all && make maintainer-clean
run: ./bootstrap && ./configure CROSS_TOOLCHAIN=llvm --enable-werror --enable-all && make all && make maintainer-clean
- name: Build the bootloader (GCC)
run: ./bootstrap && ./configure LIMINE_CC=gcc LIMINE_LD=ld LIMINE_OBJCOPY=objcopy LIMINE_OBJDUMP=objdump LIMINE_READELF=readelf --enable-werror --enable-all && make all && make maintainer-clean
run: ./bootstrap && ./configure CROSS_CC=gcc CROSS_LD=ld CROSS_OBJCOPY=objcopy CROSS_OBJDUMP=objdump CROSS_READELF=readelf --enable-werror --enable-all && make all && make maintainer-clean

View File

@ -36,7 +36,7 @@ jobs:
run: mkdir -p build
- name: Configure
run: cd build && ../configure --enable-all TOOLCHAIN=llvm
run: cd build && ../configure --enable-all CROSS_TOOLCHAIN=llvm
- name: Build the bootloader
run: make -C build

7
.gitignore vendored
View File

@ -2,7 +2,7 @@
/bin
/build
/toolchain
/toolchain-files
/cross-files
/limine-efi
/freestanding-headers
/make_toolchain.sh
@ -25,10 +25,7 @@
/.vscode
/test_image
!/common/font.bin
/toolchain-detect/configure
/toolchain-detect/configure.ac.save
/toolchain-detect/*~
/toolchain-detect/autom4te.cache
/cross-detect
/configure
/configure.ac.save
/build-aux

View File

@ -52,23 +52,23 @@ export CFLAGS
LDFLAGS ?= @LDFLAGS@
export LDFLAGS
LIMINE_CFLAGS ?= @LIMINE_CFLAGS@
export LIMINE_CFLAGS
LIMINE_LDFLAGS ?= @LIMINE_LDFLAGS@
export LIMINE_LDFLAGS
CROSS_CFLAGS ?= @CROSS_CFLAGS@
export CROSS_CFLAGS
CROSS_LDFLAGS ?= @CROSS_LDFLAGS@
export CROSS_LDFLAGS
TOOLCHAIN ?= @TOOLCHAIN@
export TOOLCHAIN
LIMINE_CC ?= @LIMINE_CC@
export LIMINE_CC
LIMINE_LD ?= @LIMINE_LD@
export LIMINE_LD
LIMINE_OBJCOPY ?= @LIMINE_OBJCOPY@
export LIMINE_OBJCOPY
LIMINE_OBJDUMP ?= @LIMINE_OBJDUMP@
export LIMINE_OBJDUMP
LIMINE_READELF ?= @LIMINE_READELF@
export LIMINE_READELF
CROSS_TOOLCHAIN ?= @CROSS_TOOLCHAIN@
export CROSS_TOOLCHAIN
CROSS_CC ?= @CROSS_CC@
export CROSS_CC
CROSS_LD ?= @CROSS_LD@
export CROSS_LD
CROSS_OBJCOPY ?= @CROSS_OBJCOPY@
export CROSS_OBJCOPY
CROSS_OBJDUMP ?= @CROSS_OBJDUMP@
export CROSS_OBJDUMP
CROSS_READELF ?= @CROSS_READELF@
export CROSS_READELF
override LIMINE_VERSION := @PACKAGE_VERSION@
@ -192,11 +192,13 @@ dist:
rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/libgcc-binaries/.gitignore"
rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/limine-efi/.git"
rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/limine-efi/.gitignore"
rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/cross-detect/.git"
rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/cross-detect/.gitignore"
rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/.git"
rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/.gitignore"
rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/.github"
rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/autom4te.cache"
rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/toolchain-detect/autom4te.cache"
rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/cross-detect/autom4te.cache"
rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/test"
rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/screenshot.png"
rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/bochsrc"
@ -207,17 +209,16 @@ dist:
.PHONY: distclean
distclean: clean
rm -rf toolchain ovmf* config.log config.status GNUmakefile config.h toolchain-files
rm -rf toolchain ovmf* config.log config.status GNUmakefile config.h cross-files
.PHONY: maintainer-clean
maintainer-clean: distclean
cd '$(call SHESCAPE,$(SRCDIR))' && rm -rf freestanding-headers libgcc-binaries make_toolchain.sh limine-efi configure build-aux *'~' autom4te.cache *.tar.xz *.tar.gz
cd '$(call SHESCAPE,$(SRCDIR))'/toolchain-detect && rm -rf configure *'~' autom4te.cache
cd '$(call SHESCAPE,$(SRCDIR))' && rm -rf freestanding-headers libgcc-binaries make_toolchain.sh limine-efi cross-detect configure build-aux *'~' autom4te.cache *.tar.xz *.tar.gz
.PHONY: common-uefi-x86-64
common-uefi-x86-64:
$(MAKE) -C '$(call SHESCAPE,$(SRCDIR))/common' all \
TOOLCHAIN_FILE='$(call SHESCAPE,$(BUILDDIR))/toolchain-files/x86_64-toolchain.mk' \
CROSS_FILE='$(call SHESCAPE,$(BUILDDIR))/cross-files/x86_64-toolchain.mk' \
TARGET=uefi-x86-64 \
BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/common-uefi-x86-64'
@ -228,7 +229,7 @@ common-uefi-x86-64-clean:
.PHONY: common-uefi-ia32
common-uefi-ia32:
$(MAKE) -C '$(call SHESCAPE,$(SRCDIR))/common' all \
TOOLCHAIN_FILE='$(call SHESCAPE,$(BUILDDIR))/toolchain-files/i686-toolchain.mk' \
CROSS_FILE='$(call SHESCAPE,$(BUILDDIR))/cross-files/i686-toolchain.mk' \
TARGET=uefi-ia32 \
BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/common-uefi-ia32'
@ -239,7 +240,7 @@ common-uefi-ia32-clean:
.PHONY: common-bios
common-bios:
$(MAKE) -C '$(call SHESCAPE,$(SRCDIR))/common' all \
TOOLCHAIN_FILE='$(call SHESCAPE,$(BUILDDIR))/toolchain-files/i686-toolchain.mk' \
CROSS_FILE='$(call SHESCAPE,$(BUILDDIR))/cross-files/i686-toolchain.mk' \
TARGET=bios \
BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/common-bios'
@ -250,7 +251,7 @@ common-bios-clean:
.PHONY: decompressor
decompressor:
$(MAKE) -C '$(call SHESCAPE,$(SRCDIR))/decompressor' all \
TOOLCHAIN_FILE='$(call SHESCAPE,$(BUILDDIR))/toolchain-files/i686-toolchain.mk' \
CROSS_FILE='$(call SHESCAPE,$(BUILDDIR))/cross-files/i686-toolchain.mk' \
BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/decompressor-build'
.PHONY: decompressor-clean

View File

@ -7,6 +7,7 @@ test -z "$srcdir" && srcdir=.
cd "$srcdir"
[ -d cross-detect ] || git clone https://github.com/mintsuki/cross-detect.git
[ -d freestanding-headers ] || git clone https://github.com/mintsuki/freestanding-headers.git
[ -d libgcc-binaries ] || git clone https://github.com/mintsuki/libgcc-binaries.git
[ -d limine-efi ] || git clone https://github.com/limine-bootloader/limine-efi.git

View File

@ -1,4 +1,4 @@
include $(TOOLCHAIN_FILE)
include $(CROSS_FILE)
TARGET ?=
BUILDDIR ?=
@ -28,7 +28,7 @@ endif
COM_OUTPUT ?= false
E9_OUTPUT ?= false
override S2CFLAGS := $(LIMINE_CFLAGS) -Os
override S2CFLAGS := $(CROSS_CFLAGS) -Os
override INTERNAL_CFLAGS := \
-g \
@ -180,11 +180,11 @@ $(call MKESCAPE,$(BUILDDIR))/sys/smp_trampoline.bin: sys/smp_trampoline.real
$(call MKESCAPE,$(BUILDDIR))/sys/smp_trampoline.o: $(call MKESCAPE,$(BUILDDIR))/sys/smp_trampoline.bin
mkdir -p "$$(dirname '$(call SHESCAPE,$@)')"
cd '$(call SHESCAPE,$(BUILDDIR))/sys' && \
$(LIMINE_OBJCOPY) -B i8086 -I binary -O $(OBJCOPY_ARCH) smp_trampoline.bin '$(call SHESCAPE,$@)'
$(CROSS_OBJCOPY) -B i8086 -I binary -O $(OBJCOPY_ARCH) smp_trampoline.bin '$(call SHESCAPE,$@)'
$(call MKESCAPE,$(BUILDDIR))/font.o: font.bin
mkdir -p "$$(dirname '$(call SHESCAPE,$@)')"
$(LIMINE_OBJCOPY) -B i8086 -I binary -O $(OBJCOPY_ARCH) font.bin '$(call SHESCAPE,$@)'
$(CROSS_OBJCOPY) -B i8086 -I binary -O $(OBJCOPY_ARCH) font.bin '$(call SHESCAPE,$@)'
$(call MKESCAPE,$(BUILDDIR))/tinf-copied: ../tinf/*
rm -rf '$(call SHESCAPE,$(BUILDDIR))/tinf'
@ -194,11 +194,11 @@ $(call MKESCAPE,$(BUILDDIR))/tinf-copied: ../tinf/*
$(call MKESCAPE,$(BUILDDIR))/tinf/tinfgzip.o: $(call MKESCAPE,$(BUILDDIR))/tinf-copied
mkdir -p "$$(dirname '$(call SHESCAPE,$@)')"
$(LIMINE_CC) $(LIMINE_CFLAGS) $(INTERNAL_CFLAGS) -c '$(call SHESCAPE,$(@:.o=.c))' -o '$(call SHESCAPE,$@)'
$(CROSS_CC) $(CROSS_CFLAGS) $(INTERNAL_CFLAGS) -c '$(call SHESCAPE,$(@:.o=.c))' -o '$(call SHESCAPE,$@)'
$(call MKESCAPE,$(BUILDDIR))/tinf/tinflate.o: $(call MKESCAPE,$(BUILDDIR))/tinf-copied
mkdir -p "$$(dirname '$(call SHESCAPE,$@)')"
$(LIMINE_CC) $(LIMINE_CFLAGS) $(INTERNAL_CFLAGS) -c '$(call SHESCAPE,$(@:.o=.c))' -o '$(call SHESCAPE,$@)'
$(CROSS_CC) $(CROSS_CFLAGS) $(INTERNAL_CFLAGS) -c '$(call SHESCAPE,$(@:.o=.c))' -o '$(call SHESCAPE,$@)'
ifeq ($(TARGET), bios)
@ -206,62 +206,62 @@ $(call MKESCAPE,$(BUILDDIR))/stage2.bin.gz: $(call MKESCAPE,$(BUILDDIR))/stage2.
gzip -n -9 < '$(call SHESCAPE,$<)' > '$(call SHESCAPE,$@)'
$(call MKESCAPE,$(BUILDDIR))/stage2.bin: $(call MKESCAPE,$(BUILDDIR))/limine.sys
dd if='$(call SHESCAPE,$<)' bs=$$(( 0x$$("$(LIMINE_READELF)" -S '$(call SHESCAPE,$(BUILDDIR))/limine.elf' | $(GREP) .text.stage3 | $(SED) 's/^.*] //' | $(AWK) '{print $$3}' | $(SED) 's/^0*//') - 0x8000 )) count=1 of='$(call SHESCAPE,$@)' 2>/dev/null
dd if='$(call SHESCAPE,$<)' bs=$$(( 0x$$("$(CROSS_READELF)" -S '$(call SHESCAPE,$(BUILDDIR))/limine.elf' | $(GREP) .text.stage3 | $(SED) 's/^.*] //' | $(AWK) '{print $$3}' | $(SED) 's/^0*//') - 0x8000 )) count=1 of='$(call SHESCAPE,$@)' 2>/dev/null
$(call MKESCAPE,$(BUILDDIR))/stage2.map.o: $(call MKESCAPE,$(BUILDDIR))/limine_stage2only.elf
cd '$(call SHESCAPE,$(BUILDDIR))' && \
'$(call SHESCAPE,$(SRCDIR))/gensyms.sh' '$(call SHESCAPE,$<)' stage2 32 '\.text'
$(LIMINE_CC) $(LIMINE_CFLAGS) $(INTERNAL_CFLAGS) -c '$(call SHESCAPE,$(BUILDDIR))/stage2.map.S' -o '$(call SHESCAPE,$@)'
$(CROSS_CC) $(CROSS_CFLAGS) $(INTERNAL_CFLAGS) -c '$(call SHESCAPE,$(BUILDDIR))/stage2.map.S' -o '$(call SHESCAPE,$@)'
rm -f '$(call SHESCAPE,$(BUILDDIR))/stage2.map.S' '$(call SHESCAPE,$(BUILDDIR))/stage2.map.d'
$(call MKESCAPE,$(BUILDDIR))/full.map.o: $(call MKESCAPE,$(BUILDDIR))/limine_nomap.elf
cd '$(call SHESCAPE,$(BUILDDIR))' && \
'$(call SHESCAPE,$(SRCDIR))/gensyms.sh' '$(call SHESCAPE,$<)' full 32 '\.text'
$(LIMINE_CC) $(LIMINE_CFLAGS) $(INTERNAL_CFLAGS) -c '$(call SHESCAPE,$(BUILDDIR))/full.map.S' -o '$(call SHESCAPE,$@)'
$(CROSS_CC) $(CROSS_CFLAGS) $(INTERNAL_CFLAGS) -c '$(call SHESCAPE,$(BUILDDIR))/full.map.S' -o '$(call SHESCAPE,$@)'
rm -f '$(call SHESCAPE,$(BUILDDIR))/full.map.S' '$(call SHESCAPE,$(BUILDDIR))/full.map.d'
$(call MKESCAPE,$(BUILDDIR))/limine.sys: $(call MKESCAPE,$(BUILDDIR))/limine.elf
$(LIMINE_OBJCOPY) -O binary '$(call SHESCAPE,$<)' '$(call SHESCAPE,$@)'
$(CROSS_OBJCOPY) -O binary '$(call SHESCAPE,$<)' '$(call SHESCAPE,$@)'
$(call MKESCAPE,$(BUILDDIR))/linker_stage2only.ld: linker_bios.ld.in
mkdir -p '$(call SHESCAPE,$(BUILDDIR))'
$(LIMINE_CC) -x c -E -P -undef -DLINKER_STAGE2ONLY linker_bios.ld.in -o '$(call SHESCAPE,$(BUILDDIR))/linker_stage2only.ld'
$(CROSS_CC) -x c -E -P -undef -DLINKER_STAGE2ONLY linker_bios.ld.in -o '$(call SHESCAPE,$(BUILDDIR))/linker_stage2only.ld'
$(call MKESCAPE,$(BUILDDIR))/limine_stage2only.elf: $(OBJ) ../libgcc-binaries/libgcc-i686.a
$(MAKE) '$(call SHESCAPE,$(BUILDDIR))/linker_stage2only.ld'
$(LIMINE_LD) '$(call OBJESCAPE,$^)' $(LIMINE_LDFLAGS) $(INTERNAL_LDFLAGS) -T'$(call SHESCAPE,$(BUILDDIR))/linker_stage2only.ld' -o '$(call SHESCAPE,$@)' || \
$(CROSS_LD) '$(call OBJESCAPE,$^)' $(CROSS_LDFLAGS) $(INTERNAL_LDFLAGS) -T'$(call SHESCAPE,$(BUILDDIR))/linker_stage2only.ld' -o '$(call SHESCAPE,$@)' || \
( echo "This error may mean that stage 2 was trying to use stage 3 symbols before loading stage 3" && \
false )
$(call MKESCAPE,$(BUILDDIR))/linker_nomap.ld: linker_bios.ld.in
mkdir -p '$(call SHESCAPE,$(BUILDDIR))'
$(LIMINE_CC) -x c -E -P -undef -DLINKER_NOMAP linker_bios.ld.in -o '$(call SHESCAPE,$(BUILDDIR))/linker_nomap.ld'
$(CROSS_CC) -x c -E -P -undef -DLINKER_NOMAP linker_bios.ld.in -o '$(call SHESCAPE,$(BUILDDIR))/linker_nomap.ld'
$(call MKESCAPE,$(BUILDDIR))/limine_nomap.elf: $(OBJ) ../libgcc-binaries/libgcc-i686.a $(call MKESCAPE,$(BUILDDIR))/tinf/tinfgzip.o $(call MKESCAPE,$(BUILDDIR))/tinf/tinflate.o $(call MKESCAPE,$(BUILDDIR))/font.o $(call MKESCAPE,$(BUILDDIR))/sys/smp_trampoline.o $(call MKESCAPE,$(BUILDDIR))/stage2.map.o
$(MAKE) '$(call SHESCAPE,$(BUILDDIR))/linker_nomap.ld'
$(LIMINE_LD) '$(call OBJESCAPE,$^)' $(LIMINE_LDFLAGS) $(INTERNAL_LDFLAGS) -T'$(call SHESCAPE,$(BUILDDIR))/linker_nomap.ld' -o '$(call SHESCAPE,$@)'
$(LIMINE_OBJCOPY) -O binary --only-section=.note.gnu.build-id '$(call SHESCAPE,$@)' '$(call SHESCAPE,$(BUILDDIR))/build-id.s2.bin'
$(CROSS_LD) '$(call OBJESCAPE,$^)' $(CROSS_LDFLAGS) $(INTERNAL_LDFLAGS) -T'$(call SHESCAPE,$(BUILDDIR))/linker_nomap.ld' -o '$(call SHESCAPE,$@)'
$(CROSS_OBJCOPY) -O binary --only-section=.note.gnu.build-id '$(call SHESCAPE,$@)' '$(call SHESCAPE,$(BUILDDIR))/build-id.s2.bin'
cd '$(call SHESCAPE,$(BUILDDIR))' && \
$(LIMINE_OBJCOPY) -B i8086 -I binary -O $(OBJCOPY_ARCH) build-id.s2.bin build-id.s2.o
$(LIMINE_OBJCOPY) -O binary --only-section=.note.gnu.build-id '$(call SHESCAPE,$@)' '$(call SHESCAPE,$(BUILDDIR))/build-id.s3.bin'
$(CROSS_OBJCOPY) -B i8086 -I binary -O $(OBJCOPY_ARCH) build-id.s2.bin build-id.s2.o
$(CROSS_OBJCOPY) -O binary --only-section=.note.gnu.build-id '$(call SHESCAPE,$@)' '$(call SHESCAPE,$(BUILDDIR))/build-id.s3.bin'
cd '$(call SHESCAPE,$(BUILDDIR))' && \
$(LIMINE_OBJCOPY) -B i8086 -I binary -O $(OBJCOPY_ARCH) build-id.s3.bin build-id.s3.o
$(LIMINE_LD) '$(call OBJESCAPE,$^)' '$(call SHESCAPE,$(BUILDDIR))/build-id.s2.o' '$(call SHESCAPE,$(BUILDDIR))/build-id.s3.o' $(LIMINE_LDFLAGS) $(INTERNAL_LDFLAGS) -T'$(call SHESCAPE,$(BUILDDIR))/linker_nomap.ld' -o '$(call SHESCAPE,$@)'
$(CROSS_OBJCOPY) -B i8086 -I binary -O $(OBJCOPY_ARCH) build-id.s3.bin build-id.s3.o
$(CROSS_LD) '$(call OBJESCAPE,$^)' '$(call SHESCAPE,$(BUILDDIR))/build-id.s2.o' '$(call SHESCAPE,$(BUILDDIR))/build-id.s3.o' $(CROSS_LDFLAGS) $(INTERNAL_LDFLAGS) -T'$(call SHESCAPE,$(BUILDDIR))/linker_nomap.ld' -o '$(call SHESCAPE,$@)'
$(call MKESCAPE,$(BUILDDIR))/linker.ld: linker_bios.ld.in
mkdir -p '$(call SHESCAPE,$(BUILDDIR))'
$(LIMINE_CC) -x c -E -P -undef linker_bios.ld.in -o '$(call SHESCAPE,$(BUILDDIR))/linker.ld'
$(CROSS_CC) -x c -E -P -undef linker_bios.ld.in -o '$(call SHESCAPE,$(BUILDDIR))/linker.ld'
$(call MKESCAPE,$(BUILDDIR))/limine.elf: $(OBJ) ../libgcc-binaries/libgcc-i686.a $(call MKESCAPE,$(BUILDDIR))/tinf/tinfgzip.o $(call MKESCAPE,$(BUILDDIR))/tinf/tinflate.o $(call MKESCAPE,$(BUILDDIR))/font.o $(call MKESCAPE,$(BUILDDIR))/sys/smp_trampoline.o $(call MKESCAPE,$(BUILDDIR))/stage2.map.o $(call MKESCAPE,$(BUILDDIR))/full.map.o
$(MAKE) '$(call SHESCAPE,$(BUILDDIR))/linker.ld'
$(LIMINE_LD) '$(call OBJESCAPE,$^)' $(LIMINE_LDFLAGS) $(INTERNAL_LDFLAGS) -T'$(call SHESCAPE,$(BUILDDIR))/linker.ld' -o '$(call SHESCAPE,$@)'
$(LIMINE_OBJCOPY) -O binary --only-section=.note.gnu.build-id '$(call SHESCAPE,$@)' '$(call SHESCAPE,$(BUILDDIR))/build-id.s2.bin'
$(CROSS_LD) '$(call OBJESCAPE,$^)' $(CROSS_LDFLAGS) $(INTERNAL_LDFLAGS) -T'$(call SHESCAPE,$(BUILDDIR))/linker.ld' -o '$(call SHESCAPE,$@)'
$(CROSS_OBJCOPY) -O binary --only-section=.note.gnu.build-id '$(call SHESCAPE,$@)' '$(call SHESCAPE,$(BUILDDIR))/build-id.s2.bin'
cd '$(call SHESCAPE,$(BUILDDIR))' && \
$(LIMINE_OBJCOPY) -B i8086 -I binary -O $(OBJCOPY_ARCH) build-id.s2.bin build-id.s2.o
$(LIMINE_OBJCOPY) -O binary --only-section=.note.gnu.build-id '$(call SHESCAPE,$@)' '$(call SHESCAPE,$(BUILDDIR))/build-id.s3.bin'
$(CROSS_OBJCOPY) -B i8086 -I binary -O $(OBJCOPY_ARCH) build-id.s2.bin build-id.s2.o
$(CROSS_OBJCOPY) -O binary --only-section=.note.gnu.build-id '$(call SHESCAPE,$@)' '$(call SHESCAPE,$(BUILDDIR))/build-id.s3.bin'
cd '$(call SHESCAPE,$(BUILDDIR))' && \
$(LIMINE_OBJCOPY) -B i8086 -I binary -O $(OBJCOPY_ARCH) build-id.s3.bin build-id.s3.o
$(LIMINE_LD) '$(call OBJESCAPE,$^)' '$(call SHESCAPE,$(BUILDDIR))/build-id.s2.o' '$(call SHESCAPE,$(BUILDDIR))/build-id.s3.o' $(LIMINE_LDFLAGS) $(INTERNAL_LDFLAGS) -T'$(call SHESCAPE,$(BUILDDIR))/linker.ld' -o '$(call SHESCAPE,$@)'
$(CROSS_OBJCOPY) -B i8086 -I binary -O $(OBJCOPY_ARCH) build-id.s3.bin build-id.s3.o
$(CROSS_LD) '$(call OBJESCAPE,$^)' '$(call SHESCAPE,$(BUILDDIR))/build-id.s2.o' '$(call SHESCAPE,$(BUILDDIR))/build-id.s3.o' $(CROSS_LDFLAGS) $(INTERNAL_LDFLAGS) -T'$(call SHESCAPE,$(BUILDDIR))/linker.ld' -o '$(call SHESCAPE,$@)'
endif
@ -274,11 +274,11 @@ ifeq ($(TARGET), uefi-x86-64)
$(call MKESCAPE,$(BUILDDIR))/full.map.o: $(call MKESCAPE,$(BUILDDIR))/limine_nomap.elf
cd '$(call SHESCAPE,$(BUILDDIR))' && \
'$(call SHESCAPE,$(SRCDIR))/gensyms.sh' '$(call SHESCAPE,$<)' full 64 '\.text'
$(LIMINE_CC) $(LIMINE_CFLAGS) $(INTERNAL_CFLAGS) -c '$(call SHESCAPE,$(BUILDDIR))/full.map.S' -o '$(call SHESCAPE,$@)'
$(CROSS_CC) $(CROSS_CFLAGS) $(INTERNAL_CFLAGS) -c '$(call SHESCAPE,$(BUILDDIR))/full.map.S' -o '$(call SHESCAPE,$@)'
rm -f '$(call SHESCAPE,$(BUILDDIR))/full.map.S' '$(call SHESCAPE,$(BUILDDIR))/full.map.d'
$(call MKESCAPE,$(BUILDDIR))/BOOTX64.EFI: $(call MKESCAPE,$(BUILDDIR))/limine.elf
$(LIMINE_OBJCOPY) -O binary '$(call SHESCAPE,$<)' '$(call SHESCAPE,$@)'
$(CROSS_OBJCOPY) -O binary '$(call SHESCAPE,$<)' '$(call SHESCAPE,$@)'
$(call MKESCAPE,$(BUILDDIR))/limine-efi/gnuefi/crt0-efi-x86_64.o: limine-efi
true
@ -290,30 +290,30 @@ $(call MKESCAPE,$(BUILDDIR))/limine-efi/gnuefi/reloc_x86_64.o: limine-efi
limine-efi: $(call MKESCAPE,$(BUILDDIR))/limine-efi
unset CPPFLAGS; \
$(MAKE) -C '$(call SHESCAPE,$(BUILDDIR))/limine-efi/gnuefi' \
CC="$(LIMINE_CC) -m64 -march=x86-64 -mtune=generic" \
CC="$(CROSS_CC) -m64 -march=x86-64 -mtune=generic" \
CFLAGS='-nostdinc' \
INCDIR='-I$(call SHESCAPE,$(SRCDIR))/../freestanding-headers' \
ARCH=x86_64
$(call MKESCAPE,$(BUILDDIR))/linker_nomap.ld: linker_uefi_x86_64.ld.in
mkdir -p '$(call SHESCAPE,$(BUILDDIR))'
$(LIMINE_CC) -x c -E -P -undef -DLINKER_NOMAP linker_uefi_x86_64.ld.in -o '$(call SHESCAPE,$(BUILDDIR))/linker_nomap.ld'
$(CROSS_CC) -x c -E -P -undef -DLINKER_NOMAP linker_uefi_x86_64.ld.in -o '$(call SHESCAPE,$(BUILDDIR))/linker_nomap.ld'
$(call MKESCAPE,$(BUILDDIR))/limine_nomap.elf: $(call MKESCAPE,$(BUILDDIR))/limine-efi/gnuefi/crt0-efi-x86_64.o $(call MKESCAPE,$(BUILDDIR))/limine-efi/gnuefi/reloc_x86_64.o $(OBJ) ../libgcc-binaries/libgcc-x86_64-no-red-zone.a $(call MKESCAPE,$(BUILDDIR))/tinf/tinfgzip.o $(call MKESCAPE,$(BUILDDIR))/tinf/tinflate.o $(call MKESCAPE,$(BUILDDIR))/font.o $(call MKESCAPE,$(BUILDDIR))/sys/smp_trampoline.o
$(MAKE) '$(call SHESCAPE,$(BUILDDIR))/linker_nomap.ld'
$(LIMINE_LD) \
$(CROSS_LD) \
-T'$(call SHESCAPE,$(BUILDDIR))/linker_nomap.ld' \
'$(call OBJESCAPE,$^)' $(LIMINE_LDFLAGS) $(INTERNAL_LDFLAGS) -o '$(call SHESCAPE,$@)'
'$(call OBJESCAPE,$^)' $(CROSS_LDFLAGS) $(INTERNAL_LDFLAGS) -o '$(call SHESCAPE,$@)'
$(call MKESCAPE,$(BUILDDIR))/linker.ld: linker_uefi_x86_64.ld.in
mkdir -p '$(call SHESCAPE,$(BUILDDIR))'
$(LIMINE_CC) -x c -E -P -undef linker_uefi_x86_64.ld.in -o '$(call SHESCAPE,$(BUILDDIR))/linker.ld'
$(CROSS_CC) -x c -E -P -undef linker_uefi_x86_64.ld.in -o '$(call SHESCAPE,$(BUILDDIR))/linker.ld'
$(call MKESCAPE,$(BUILDDIR))/limine.elf: $(call MKESCAPE,$(BUILDDIR))/limine-efi/gnuefi/crt0-efi-x86_64.o $(call MKESCAPE,$(BUILDDIR))/limine-efi/gnuefi/reloc_x86_64.o $(OBJ) ../libgcc-binaries/libgcc-x86_64-no-red-zone.a $(call MKESCAPE,$(BUILDDIR))/tinf/tinfgzip.o $(call MKESCAPE,$(BUILDDIR))/tinf/tinflate.o $(call MKESCAPE,$(BUILDDIR))/font.o $(call MKESCAPE,$(BUILDDIR))/sys/smp_trampoline.o $(call MKESCAPE,$(BUILDDIR))/full.map.o
$(MAKE) '$(call SHESCAPE,$(BUILDDIR))/linker.ld'
$(LIMINE_LD) \
$(CROSS_LD) \
-T'$(call SHESCAPE,$(BUILDDIR))/linker.ld' \
'$(call OBJESCAPE,$^)' $(LIMINE_LDFLAGS) $(INTERNAL_LDFLAGS) -o '$(call SHESCAPE,$@)'
'$(call OBJESCAPE,$^)' $(CROSS_LDFLAGS) $(INTERNAL_LDFLAGS) -o '$(call SHESCAPE,$@)'
endif
@ -322,11 +322,11 @@ ifeq ($(TARGET), uefi-ia32)
$(call MKESCAPE,$(BUILDDIR))/full.map.o: $(call MKESCAPE,$(BUILDDIR))/limine_nomap.elf
cd '$(call SHESCAPE,$(BUILDDIR))' && \
'$(call SHESCAPE,$(SRCDIR))/gensyms.sh' '$(call SHESCAPE,$<)' full 32 '\.text'
$(LIMINE_CC) $(LIMINE_CFLAGS) $(INTERNAL_CFLAGS) -c '$(call SHESCAPE,$(BUILDDIR))/full.map.S' -o '$(call SHESCAPE,$@)'
$(CROSS_CC) $(CROSS_CFLAGS) $(INTERNAL_CFLAGS) -c '$(call SHESCAPE,$(BUILDDIR))/full.map.S' -o '$(call SHESCAPE,$@)'
rm -f '$(call SHESCAPE,$(BUILDDIR))/full.map.S' '$(call SHESCAPE,$(BUILDDIR))/full.map.d'
$(call MKESCAPE,$(BUILDDIR))/BOOTIA32.EFI: $(call MKESCAPE,$(BUILDDIR))/limine.elf
$(LIMINE_OBJCOPY) -O binary '$(call SHESCAPE,$<)' '$(call SHESCAPE,$@)'
$(CROSS_OBJCOPY) -O binary '$(call SHESCAPE,$<)' '$(call SHESCAPE,$@)'
$(call MKESCAPE,$(BUILDDIR))/limine-efi/gnuefi/crt0-efi-ia32.o: limine-efi
true
@ -338,30 +338,30 @@ $(call MKESCAPE,$(BUILDDIR))/limine-efi/gnuefi/reloc_ia32.o: limine-efi
limine-efi: $(call MKESCAPE,$(BUILDDIR))/limine-efi
unset CPPFLAGS; \
$(MAKE) -C '$(call SHESCAPE,$(BUILDDIR))/limine-efi/gnuefi' \
CC="$(LIMINE_CC) -m32 -march=i686 -mtune=generic" \
CC="$(CROSS_CC) -m32 -march=i686 -mtune=generic" \
CFLAGS='-nostdinc' \
INCDIR='-I$(call SHESCAPE,$(SRCDIR))/../freestanding-headers' \
ARCH=ia32
$(call MKESCAPE,$(BUILDDIR))/linker_nomap.ld: linker_uefi_ia32.ld.in
mkdir -p '$(call SHESCAPE,$(BUILDDIR))'
$(LIMINE_CC) -x c -E -P -undef -DLINKER_NOMAP linker_uefi_ia32.ld.in -o '$(call SHESCAPE,$(BUILDDIR))/linker_nomap.ld'
$(CROSS_CC) -x c -E -P -undef -DLINKER_NOMAP linker_uefi_ia32.ld.in -o '$(call SHESCAPE,$(BUILDDIR))/linker_nomap.ld'
$(call MKESCAPE,$(BUILDDIR))/limine_nomap.elf: $(call MKESCAPE,$(BUILDDIR))/limine-efi/gnuefi/crt0-efi-ia32.o $(call MKESCAPE,$(BUILDDIR))/limine-efi/gnuefi/reloc_ia32.o $(OBJ) ../libgcc-binaries/libgcc-i686.a $(call MKESCAPE,$(BUILDDIR))/tinf/tinfgzip.o $(call MKESCAPE,$(BUILDDIR))/tinf/tinflate.o $(call MKESCAPE,$(BUILDDIR))/font.o $(call MKESCAPE,$(BUILDDIR))/sys/smp_trampoline.o
$(MAKE) '$(call SHESCAPE,$(BUILDDIR))/linker_nomap.ld'
$(LIMINE_LD) \
$(CROSS_LD) \
-T'$(call SHESCAPE,$(BUILDDIR))/linker_nomap.ld' \
'$(call OBJESCAPE,$^)' $(LIMINE_LDFLAGS) $(INTERNAL_LDFLAGS) -o '$(call SHESCAPE,$@)'
'$(call OBJESCAPE,$^)' $(CROSS_LDFLAGS) $(INTERNAL_LDFLAGS) -o '$(call SHESCAPE,$@)'
$(call MKESCAPE,$(BUILDDIR))/linker.ld: linker_uefi_ia32.ld.in
mkdir -p '$(call SHESCAPE,$(BUILDDIR))'
$(LIMINE_CC) -x c -E -P -undef linker_uefi_ia32.ld.in -o '$(call SHESCAPE,$(BUILDDIR))/linker.ld'
$(CROSS_CC) -x c -E -P -undef linker_uefi_ia32.ld.in -o '$(call SHESCAPE,$(BUILDDIR))/linker.ld'
$(call MKESCAPE,$(BUILDDIR))/limine.elf: $(call MKESCAPE,$(BUILDDIR))/limine-efi/gnuefi/crt0-efi-ia32.o $(call MKESCAPE,$(BUILDDIR))/limine-efi/gnuefi/reloc_ia32.o $(OBJ) ../libgcc-binaries/libgcc-i686.a $(call MKESCAPE,$(BUILDDIR))/tinf/tinfgzip.o $(call MKESCAPE,$(BUILDDIR))/tinf/tinflate.o $(call MKESCAPE,$(BUILDDIR))/font.o $(call MKESCAPE,$(BUILDDIR))/sys/smp_trampoline.o $(call MKESCAPE,$(BUILDDIR))/full.map.o
$(MAKE) '$(call SHESCAPE,$(BUILDDIR))/linker.ld'
$(LIMINE_LD) \
$(CROSS_LD) \
-T'$(call SHESCAPE,$(BUILDDIR))/linker.ld' \
'$(call OBJESCAPE,$^)' $(LIMINE_LDFLAGS) $(INTERNAL_LDFLAGS) -o '$(call SHESCAPE,$@)'
'$(call OBJESCAPE,$^)' $(CROSS_LDFLAGS) $(INTERNAL_LDFLAGS) -o '$(call SHESCAPE,$@)'
endif
@ -370,19 +370,19 @@ endif
ifeq ($(TARGET), uefi-x86-64)
$(call MKESCAPE,$(BUILDDIR))/%.o: %.c $(call MKESCAPE,$(BUILDDIR))/tinf-copied $(call MKESCAPE,$(BUILDDIR))/limine-efi
mkdir -p "$$(dirname '$(call SHESCAPE,$@)')"
$(LIMINE_CC) $(LIMINE_CFLAGS) $(INTERNAL_CFLAGS) -c '$(call SHESCAPE,$<)' -o '$(call SHESCAPE,$@)'
$(CROSS_CC) $(CROSS_CFLAGS) $(INTERNAL_CFLAGS) -c '$(call SHESCAPE,$<)' -o '$(call SHESCAPE,$@)'
endif
ifeq ($(TARGET), uefi-ia32)
$(call MKESCAPE,$(BUILDDIR))/%.o: %.c $(call MKESCAPE,$(BUILDDIR))/tinf-copied $(call MKESCAPE,$(BUILDDIR))/limine-efi
mkdir -p "$$(dirname '$(call SHESCAPE,$@)')"
$(LIMINE_CC) $(LIMINE_CFLAGS) $(INTERNAL_CFLAGS) -c '$(call SHESCAPE,$<)' -o '$(call SHESCAPE,$@)'
$(CROSS_CC) $(CROSS_CFLAGS) $(INTERNAL_CFLAGS) -c '$(call SHESCAPE,$<)' -o '$(call SHESCAPE,$@)'
endif
ifeq ($(TARGET), bios)
$(call MKESCAPE,$(BUILDDIR))/%.o: %.c $(call MKESCAPE,$(BUILDDIR))/tinf-copied
mkdir -p "$$(dirname '$(call SHESCAPE,$@)')"
$(LIMINE_CC) $(LIMINE_CFLAGS) $(INTERNAL_CFLAGS) -c '$(call SHESCAPE,$<)' -o '$(call SHESCAPE,$@)'
$(CROSS_CC) $(CROSS_CFLAGS) $(INTERNAL_CFLAGS) -c '$(call SHESCAPE,$<)' -o '$(call SHESCAPE,$@)'
endif
-include $(HEADER_DEPS)
@ -390,7 +390,7 @@ endif
ifeq ($(TARGET), bios)
$(call MKESCAPE,$(BUILDDIR))/%.s2.o: %.s2.c
mkdir -p "$$(dirname '$(call SHESCAPE,$@)')"
$(LIMINE_CC) $(S2CFLAGS) $(INTERNAL_CFLAGS) -c '$(call SHESCAPE,$<)' -o '$(call SHESCAPE,$@)'
$(CROSS_CC) $(S2CFLAGS) $(INTERNAL_CFLAGS) -c '$(call SHESCAPE,$<)' -o '$(call SHESCAPE,$@)'
endif
-include $(HEADER_DEPS)
@ -398,8 +398,8 @@ endif
ifeq ($(TARGET), uefi-x86-64)
$(call MKESCAPE,$(BUILDDIR))/%.32.o: %.32.c $(call MKESCAPE,$(BUILDDIR))/limine-efi
mkdir -p "$$(dirname '$(call SHESCAPE,$@)')"
$(LIMINE_CC) $(LIMINE_CFLAGS) $(INTERNAL_CFLAGS32) -c '$(call SHESCAPE,$<)' -o '$(call SHESCAPE,$@).32'
$(LIMINE_OBJCOPY) -I elf32-i386 -O elf64-x86-64 '$(call SHESCAPE,$@).32' '$(call SHESCAPE,$@)'
$(CROSS_CC) $(CROSS_CFLAGS) $(INTERNAL_CFLAGS32) -c '$(call SHESCAPE,$<)' -o '$(call SHESCAPE,$@).32'
$(CROSS_OBJCOPY) -I elf32-i386 -O elf64-x86-64 '$(call SHESCAPE,$@).32' '$(call SHESCAPE,$@)'
rm '$(call SHESCAPE,$@).32'
endif

View File

@ -28,7 +28,7 @@ TMP4="$(mktemp)"
trap "rm -f '$TMP1' '$TMP2' '$TMP3' '$TMP4'; trap - EXIT; exit" EXIT INT TERM QUIT HUP
"$LIMINE_OBJDUMP" -t "$1" | ( "$SED" '/[[:<:]]d[[:>:]]/d' 2>/dev/null || "$SED" '/\bd\b/d' ) | sort > "$TMP1"
"$CROSS_OBJDUMP" -t "$1" | ( "$SED" '/[[:<:]]d[[:>:]]/d' 2>/dev/null || "$SED" '/\bd\b/d' ) | sort > "$TMP1"
"$GREP" "$4" < "$TMP1" | cut -d' ' -f1 > "$TMP2"
"$GREP" "$4" < "$TMP1" | "$AWK" 'NF{ print $NF }' > "$TMP3"

View File

@ -3,7 +3,7 @@ AC_INIT([Limine], m4_esyscmd([./version.sh]), [https://github.com/limine-bootloa
AC_PREREQ(2.69)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_SUBDIRS([toolchain-detect])
AC_CONFIG_SUBDIRS([cross-detect])
SRCDIR="$(cd "$srcdir" && pwd -P)"
BUILDDIR="$(pwd -P)"
@ -47,7 +47,7 @@ if ! test "x$GZIP_FOUND" = "xyes"; then
AC_MSG_ERROR([gzip not found, please install gzip before configuring])
fi
rm -rf "$BUILDDIR/toolchain-files"
rm -rf "$BUILDDIR/cross-files"
BUILD_ALL="no"
@ -65,9 +65,9 @@ if test "x$BUILD_BIOS" = "xno"; then
BUILD_BIOS=""
else
(
mkdir -p "$BUILDDIR/toolchain-files"
cd "$BUILDDIR/toolchain-files"
ARCHITECTURE=i686 "$SRCDIR/toolchain-detect/configure"
mkdir -p "$BUILDDIR/cross-files"
cd "$BUILDDIR/cross-files"
TRIPLET=i686-elf "$SRCDIR/cross-detect/configure"
) || exit 1
BUILD_BIOS="limine-bios"
fi
@ -108,9 +108,9 @@ if test "x$BUILD_UEFI_IA32" = "xno"; then
BUILD_UEFI_IA32=""
else
(
mkdir -p "$BUILDDIR/toolchain-files"
cd "$BUILDDIR/toolchain-files"
ARCHITECTURE=i686 "$SRCDIR/toolchain-detect/configure"
mkdir -p "$BUILDDIR/cross-files"
cd "$BUILDDIR/cross-files"
TRIPLET=i686-elf "$SRCDIR/cross-detect/configure"
) || exit 1
BUILD_UEFI_IA32="limine-uefi-ia32"
fi
@ -127,9 +127,9 @@ if test "x$BUILD_UEFI_X86_64" = "xno"; then
BUILD_UEFI_X86_64=""
else
(
mkdir -p "$BUILDDIR/toolchain-files"
cd "$BUILDDIR/toolchain-files"
ARCHITECTURE=x86_64 "$SRCDIR/toolchain-detect/configure"
mkdir -p "$BUILDDIR/cross-files"
cd "$BUILDDIR/cross-files"
TRIPLET=x86_64-elf "$SRCDIR/cross-detect/configure"
) || exit 1
BUILD_UEFI_X86_64="limine-uefi-x86-64"
fi
@ -155,20 +155,20 @@ fi
AC_SUBST(BUILD_CD_EFI, [$BUILD_CD_EFI])
AC_ARG_VAR(TOOLCHAIN, [alternative toolchain prefix (or 'llvm')])
AC_ARG_VAR(LIMINE_CC, [C compiler command for Limine])
AC_ARG_VAR(LIMINE_LD, [linker command for Limine])
AC_ARG_VAR(LIMINE_OBJCOPY, [objcopy command for Limine])
AC_ARG_VAR(LIMINE_OBJDUMP, [objdump command for Limine])
AC_ARG_VAR(LIMINE_READELF, [readelf command for Limine])
AC_ARG_VAR(CROSS_TOOLCHAIN, [alternative toolchain prefix (or 'llvm')])
AC_ARG_VAR(CROSS_CC, [C compiler command for Limine])
AC_ARG_VAR(CROSS_LD, [linker command for Limine])
AC_ARG_VAR(CROSS_OBJCOPY, [objcopy command for Limine])
AC_ARG_VAR(CROSS_OBJDUMP, [objdump command for Limine])
AC_ARG_VAR(CROSS_READELF, [readelf command for Limine])
m4_define([DEFAULT_LIMINE_CFLAGS], [-O3 -pipe -Wall -Wextra])
AC_ARG_VAR(LIMINE_CFLAGS, [C flags for Limine @<:@default: ]DEFAULT_LIMINE_CFLAGS[@:>@])
test "x$LIMINE_CFLAGS" = "x" && LIMINE_CFLAGS="DEFAULT_LIMINE_CFLAGS"
m4_define([DEFAULT_CROSS_CFLAGS], [-O3 -pipe -Wall -Wextra])
AC_ARG_VAR(CROSS_CFLAGS, [C flags for Limine @<:@default: ]DEFAULT_CROSS_CFLAGS[@:>@])
test "x$CROSS_CFLAGS" = "x" && CROSS_CFLAGS="DEFAULT_CROSS_CFLAGS"
m4_define([DEFAULT_LIMINE_LDFLAGS], [])
AC_ARG_VAR(LIMINE_LDFLAGS, [Linker flags for Limine @<:@default: ]DEFAULT_LIMINE_LDFLAGS[@:>@])
test "x$LIMINE_LDFLAGS" = "x" && LIMINE_LDFLAGS="DEFAULT_LIMINE_LDFLAGS"
m4_define([DEFAULT_CROSS_LDFLAGS], [])
AC_ARG_VAR(CROSS_LDFLAGS, [Linker flags for Limine @<:@default: ]DEFAULT_CROSS_LDFLAGS[@:>@])
test "x$CROSS_LDFLAGS" = "x" && CROSS_LDFLAGS="DEFAULT_CROSS_LDFLAGS"
LIMINE_COPYRIGHT=$($GREP Copyright "$SRCDIR/LICENSE.md")
AC_SUBST(LIMINE_COPYRIGHT, [$LIMINE_COPYRIGHT])

View File

@ -1,4 +1,4 @@
include $(TOOLCHAIN_FILE)
include $(CROSS_FILE)
BUILDDIR ?=
@ -57,8 +57,8 @@ override HEADER_DEPS := $(addprefix $(call MKESCAPE,$(BUILDDIR))/, $(C_FILES:.c=
all: $(call MKESCAPE,$(BUILDDIR))/decompressor.bin
$(call MKESCAPE,$(BUILDDIR))/decompressor.bin: $(OBJ) ../libgcc-binaries/libgcc-i686.a $(call MKESCAPE,$(BUILDDIR))/tinf/tinfgzip.o $(call MKESCAPE,$(BUILDDIR))/tinf/tinflate.o
$(LIMINE_LD) '$(call OBJESCAPE,$^)' $(LIMINE_LDFLAGS) $(INTERNAL_LDFLAGS) -o '$(call SHESCAPE,$(BUILDDIR))/decompressor.elf'
$(LIMINE_OBJCOPY) -O binary '$(call SHESCAPE,$(BUILDDIR))/decompressor.elf' '$(call SHESCAPE,$@)'
$(CROSS_LD) '$(call OBJESCAPE,$^)' $(CROSS_LDFLAGS) $(INTERNAL_LDFLAGS) -o '$(call SHESCAPE,$(BUILDDIR))/decompressor.elf'
$(CROSS_OBJCOPY) -O binary '$(call SHESCAPE,$(BUILDDIR))/decompressor.elf' '$(call SHESCAPE,$@)'
$(call MKESCAPE,$(BUILDDIR))/tinf-copied: ../tinf/*
rm -rf '$(call SHESCAPE,$(BUILDDIR))/tinf'
@ -68,17 +68,17 @@ $(call MKESCAPE,$(BUILDDIR))/tinf-copied: ../tinf/*
$(call MKESCAPE,$(BUILDDIR))/tinf/tinfgzip.o: $(call MKESCAPE,$(BUILDDIR))/tinf-copied
mkdir -p "$$(dirname '$(call SHESCAPE,$@)')"
$(LIMINE_CC) $(LIMINE_CFLAGS) -Os $(INTERNAL_CFLAGS) -c '$(call SHESCAPE,$(@:.o=.c))' -o '$(call SHESCAPE,$@)'
$(CROSS_CC) $(CROSS_CFLAGS) -Os $(INTERNAL_CFLAGS) -c '$(call SHESCAPE,$(@:.o=.c))' -o '$(call SHESCAPE,$@)'
$(call MKESCAPE,$(BUILDDIR))/tinf/tinflate.o: $(call MKESCAPE,$(BUILDDIR))/tinf-copied
mkdir -p "$$(dirname '$(call SHESCAPE,$@)')"
$(LIMINE_CC) $(LIMINE_CFLAGS) -Os $(INTERNAL_CFLAGS) -c '$(call SHESCAPE,$(@:.o=.c))' -o '$(call SHESCAPE,$@)'
$(CROSS_CC) $(CROSS_CFLAGS) -Os $(INTERNAL_CFLAGS) -c '$(call SHESCAPE,$(@:.o=.c))' -o '$(call SHESCAPE,$@)'
-include $(HEADER_DEPS)
$(call MKESCAPE,$(BUILDDIR))/%.o: %.c $(call MKESCAPE,$(BUILDDIR))/tinf-copied
mkdir -p "$$(dirname '$(call SHESCAPE,$@)')"
$(LIMINE_CC) $(LIMINE_CFLAGS) -Os $(INTERNAL_CFLAGS) -c '$(call SHESCAPE,$<)' -o '$(call SHESCAPE,$@)'
$(CROSS_CC) $(CROSS_CFLAGS) -Os $(INTERNAL_CFLAGS) -c '$(call SHESCAPE,$<)' -o '$(call SHESCAPE,$@)'
$(call MKESCAPE,$(BUILDDIR))/%.o: %.asm
mkdir -p "$$(dirname '$(call SHESCAPE,$@)')"

View File

@ -1,135 +0,0 @@
AC_INIT([Limine], m4_esyscmd([../version.sh]), [https://github.com/limine-bootloader/limine/issues], [limine], [https://limine-bootloader.org/])
AC_PREREQ(2.69)
BUILDDIR="$(pwd -P)"
if test -f "$BUILDDIR/$ARCHITECTURE-toolchain.mk"; then
exit 0
fi
AC_PROG_GREP
AC_PROG_SED
ENFORCE_TOOLCHAIN=no
if test "x$TOOLCHAIN" = "x"; then
TOOLCHAIN=$ARCHITECTURE-elf
else
ENFORCE_TOOLCHAIN=yes
fi
AC_DEFUN([CC_ERROR_MSG], [
AC_MSG_ERROR([no suitable LIMINE_CC found, run $srcdir/make_toolchain.sh or install the appropriate GCC/Clang])
])
if ! test "x$LIMINE_CC" = "x"; then
AC_CHECK_PROG([LIMINE_CC_0], [$LIMINE_CC], [yes])
if ! test "x$LIMINE_CC_0" = "xyes"; then
AC_MSG_ERROR([LIMINE_CC ($LIMINE_CC) not found])
fi
else
if test "$TOOLCHAIN" = 'llvm'; then
LIMINE_CC='clang'
else
LIMINE_CC="$TOOLCHAIN-gcc"
fi
AC_CHECK_PROG([LIMINE_CC_1], [$LIMINE_CC], [yes])
if ! test "x$LIMINE_CC_1" = "xyes"; then
if test "x$ENFORCE_TOOLCHAIN" = "xyes"; then
CC_ERROR_MSG
fi
LIMINE_CC="clang"
AC_CHECK_PROG([LIMINE_CC_2], [$LIMINE_CC], [yes])
if ! test "x$LIMINE_CC_2" = "xyes"; then
LIMINE_CC="gcc"
AC_CHECK_PROG([LIMINE_CC_3], [$LIMINE_CC], [yes])
if ! test "x$LIMINE_CC_3" = "xyes"; then
LIMINE_CC="cc"
AC_CHECK_PROG([LIMINE_CC_4], [$LIMINE_CC], [yes])
if ! test "x$LIMINE_CC_4" = "xyes"; then
CC_ERROR_MSG
fi
fi
fi
fi
fi
AC_SUBST(LIMINE_CC, $LIMINE_CC)
if ! $LIMINE_CC --version >/dev/null 2>&1; then
CC_ERROR_MSG
fi
if $LIMINE_CC --version | $GREP clang >/dev/null 2>&1; then
LIMINE_CC="$LIMINE_CC --target=$ARCHITECTURE-elf"
elif $LIMINE_CC --version | $GREP 'Free Software Foundation' >/dev/null 2>&1; then
true
else
CC_ERROR_MSG
fi
if ! $LIMINE_CC -dumpmachine >/dev/null 2>&1; then
CC_ERROR_MSG
fi
CC_MACHINE="$($LIMINE_CC -dumpmachine | $SED 's/-.*//g')"
if test "x$CC_MACHINE" = "xamd64"; then
CC_MACHINE=x86_64
fi
if test "x$CC_MACHINE" = "xx86_64"; then
case "$ARCHITECTURE" in
i?86)
CC_MACHINE="$ARCHITECTURE"
;;
*)
;;
esac
fi
if ! test "x$CC_MACHINE" = "x$ARCHITECTURE"; then
CC_ERROR_MSG
fi
AC_DEFUN([GET_BINUTILS_PROG], [
if ! test "x$LIMINE_$1" = "x"; then
AC_CHECK_PROG([LIMINE_$1_0], [$LIMINE_$1], [yes])
if ! test "x$LIMINE_$1_0" = "xyes"; then
AC_MSG_ERROR([LIMINE_$1 ($LIMINE_$1) not found])
fi
else
if test "$TOOLCHAIN" = 'llvm' && test '$2' = 'ld'; then
LIMINE_$1='ld.lld'
else
LIMINE_$1="$TOOLCHAIN-$2"
fi
AC_CHECK_PROG([LIMINE_$1_1], [$LIMINE_$1], [yes])
if ! test "x$LIMINE_$1_1" = "xyes"; then
if test "x$ENFORCE_TOOLCHAIN" = "xyes"; then
AC_MSG_ERROR([LIMINE_$1 ($LIMINE_$1) not found])
fi
if test '$2' = 'ld'; then
LIMINE_$1='ld.lld'
else
LIMINE_$1='llvm-$2'
fi
AC_CHECK_PROG([LIMINE_$1_2], [$LIMINE_$1], [yes])
if ! test "x$LIMINE_$1_2" = "xyes"; then
LIMINE_$1='$2'
AC_CHECK_PROG([LIMINE_$1_3], [$LIMINE_$1], [yes])
if ! test "x$LIMINE_$1_3" = "xyes"; then
AC_MSG_ERROR([no suitable LIMINE_$1 found, run $srcdir/make_toolchain.sh or install the appropriate LLVM/GNU binutils])
fi
fi
fi
fi
AC_SUBST(LIMINE_$1, $LIMINE_$1)
])
GET_BINUTILS_PROG(LD, ld, linker)
GET_BINUTILS_PROG(OBJCOPY, objcopy, objcopy)
GET_BINUTILS_PROG(OBJDUMP, objdump, objdump)
GET_BINUTILS_PROG(READELF, readelf, readelf)
AC_CONFIG_FILES([$ARCHITECTURE-toolchain.mk:toolchain.mk.in])
AC_OUTPUT

View File

@ -1,3 +0,0 @@
#! /bin/sh
exit 0

View File

@ -1,10 +0,0 @@
override LIMINE_CC := @LIMINE_CC@
export LIMINE_CC
override LIMINE_LD := @LIMINE_LD@
export LIMINE_LD
override LIMINE_OBJCOPY := @LIMINE_OBJCOPY@
export LIMINE_OBJCOPY
override LIMINE_OBJDUMP := @LIMINE_OBJDUMP@
export LIMINE_OBJDUMP
override LIMINE_READELF := @LIMINE_READELF@
export LIMINE_READELF