Make build system more portable
This commit is contained in:
parent
cbc66a5cdb
commit
f671adba06
12
config.sh
12
config.sh
@ -21,6 +21,18 @@ export CPPFLAGS=''
|
||||
export SYSROOT="$(pwd)/sysroot"
|
||||
export CC="$CC --sysroot=$SYSROOT"
|
||||
|
||||
if command -V grub2-file >/dev/null 2>&1; then
|
||||
export GRUB_FILE="grub2-file"
|
||||
else
|
||||
export GRUB_FILE="grub-file"
|
||||
fi
|
||||
|
||||
if command -V grub2-mkrescue >/dev/null 2>&1; then
|
||||
export GRUB_MKRESCUE="grub2-mkrescue"
|
||||
else
|
||||
export GRUB_MKRESCUE="grub-mkrescue"
|
||||
fi
|
||||
|
||||
# Work around that the -elf gcc targets doesn't have a system include directory
|
||||
# because it was configured with --without-headers rather than --with-sysroot.
|
||||
if echo "$HOST" | grep -Eq -- '-elf($|-)'; then
|
||||
|
2
iso.sh
2
iso.sh
@ -12,4 +12,4 @@ menuentry "rockOS" {
|
||||
multiboot /boot/rockos.kernel
|
||||
}
|
||||
EOF
|
||||
grub2-mkrescue -o rockos.iso isodir
|
||||
"${GRUB_MKRESCUE}" -o rockos.iso isodir
|
||||
|
@ -1,6 +1,6 @@
|
||||
DEFAULT_HOST!=../default-host.sh
|
||||
DEFAULT_HOST=$(shell ../default-host.sh)
|
||||
HOST?=DEFAULT_HOST
|
||||
HOSTARCH!=../target-triplet-to-arch.sh $(HOST)
|
||||
HOSTARCH=$(shell ../target-triplet-to-arch.sh $(HOST))
|
||||
|
||||
CFLAGS?=-O3 -g
|
||||
CPPFLAGS?=
|
||||
@ -55,7 +55,7 @@ all: rockos.kernel
|
||||
|
||||
rockos.kernel: $(OBJS) $(ARCHDIR)/linker.ld
|
||||
$(CC) -T $(ARCHDIR)/linker.ld -o $@ $(CFLAGS) $(LINK_LIST)
|
||||
grub2-file --is-x86-multiboot rockos.kernel
|
||||
$(GRUB_FILE) --is-x86-multiboot rockos.kernel
|
||||
|
||||
$(ARCHDIR)/crtbegin.o $(ARCHDIR)/crtend.o:
|
||||
OBJ=`$(CC) $(CFLAGS) $(LDFLAGS) -print-file-name=$(@F)` && cp "$$OBJ" $@
|
||||
@ -75,7 +75,7 @@ install: install-headers install-kernel
|
||||
|
||||
install-headers:
|
||||
mkdir -p $(DESTDIR)$(INCLUDEDIR)
|
||||
cp -R --preserve=timestamps include/. $(DESTDIR)$(INCLUDEDIR)/.
|
||||
cp -Rp include/. $(DESTDIR)$(INCLUDEDIR)/.
|
||||
|
||||
install-kernel: rockos.kernel
|
||||
mkdir -p $(DESTDIR)$(BOOTDIR)
|
||||
|
@ -1,6 +1,6 @@
|
||||
DEFAULT_HOST!=../default-host.sh
|
||||
DEFAULT_HOST=$(shell ../default-host.sh)
|
||||
HOST?=DEFAULT_HOST
|
||||
HOSTARCH!=../target-triplet-to-arch.sh $(HOST)
|
||||
HOSTARCH=$(shell ../target-triplet-to-arch.sh $(HOST))
|
||||
|
||||
CFLAGS?=-O3 -g
|
||||
CPPFLAGS?=
|
||||
@ -89,7 +89,7 @@ install: install-headers install-libs
|
||||
|
||||
install-headers:
|
||||
mkdir -p $(DESTDIR)$(INCLUDEDIR)
|
||||
cp -R --preserve=timestamps include/. $(DESTDIR)$(INCLUDEDIR)/.
|
||||
cp -Rp include/. $(DESTDIR)$(INCLUDEDIR)/.
|
||||
|
||||
install-libs: $(BINARIES)
|
||||
mkdir -p $(DESTDIR)$(LIBDIR)
|
||||
|
Reference in New Issue
Block a user