redox/mk/kernel.mk
Jose Narvaez 8a43b5a3e5 Small fixes to Makefiles to be able to build the kernel on
macOS again.

Details

- We are using the toolchain compiler and archiver in order
to generate a proper ELF file when building the 'raw-cpuid'
crate C code which is currently being compiled by the macOS
toolchain.

- I added the 'findutils' and 'coreutils' Homebrew/MacPorts
packages to the bootstrap script in order to setup the proper
environment for the cookbook scripts (as the assume GNU tools).
This should be temporary until the cookbook scripts get migrated
to Rust.
2017-07-13 21:09:47 +01:00

17 lines
1 KiB
Makefile

build/libkernel.a: kernel/Cargo.toml kernel/src/* kernel/src/*/* kernel/src/*/*/* build/initfs.tag
# Temporary fix for https://github.com/redox-os/redox/issues/963 allowing to build on macOS
ifeq ($(UNAME),Darwin)
cd kernel && CC=$(ARCH)-elf-gcc AR=$(ARCH)-elf-ar CFLAGS=-ffreestanding xargo rustc --lib --target $(KTARGET) --release -- -C soft-float --emit link=../$@
else
cd kernel && xargo rustc --lib --target $(KTARGET) --release -- -C soft-float --emit link=../$@
endif
build/libkernel_live.a: kernel/Cargo.toml kernel/src/* kernel/src/*/* kernel/src/*/*/* build/initfs.tag build/filesystem.bin
cd kernel && FILESYSTEM="$(PWD)/build/filesystem.bin" xargo rustc --lib --features live --target $(KTARGET) --release -- -C soft-float --emit link=../$@
build/kernel: build/libkernel.a kernel/linkers/$(ARCH).ld
$(LD) --gc-sections -z max-page-size=0x1000 -T kernel/linkers/$(ARCH).ld -o $@ $<
build/kernel_live: build/libkernel_live.a kernel/linkers/$(ARCH).ld
$(LD) --gc-sections -z max-page-size=0x1000 -T kernel/linkers/$(ARCH).ld -o $@ $<