kern
diff Makefile @ 65:e49fdda97607
changed the makefile to only pass "emulation" (-m32 -melf_i386) only when not
running on a i386 system. Also made that work for freebsd too
author | John Tsiombikas <nuclear@mutantstargoat.com> |
---|---|
date | Wed, 05 Oct 2011 02:34:58 +0300 |
parents | 928b0ebfff4d |
children | 637efe95d0d1 |
line diff
1.1 --- a/Makefile Wed Aug 17 05:43:47 2011 +0300 1.2 +++ b/Makefile Wed Oct 05 02:34:58 2011 +0300 1.3 @@ -1,3 +1,13 @@ 1.4 +ifneq ($(shell uname -m), i386) 1.5 + ccemu = -m32 1.6 + 1.7 + ifeq ($(shell uname -s), FreeBSD) 1.8 + ldemu = elf_i386_fbsd 1.9 + else 1.10 + ldemu = elf_i386 1.11 + endif 1.12 +endif 1.13 + 1.14 # collect all of our C and assembly source files 1.15 csrc = $(wildcard src/boot/*.c) $(wildcard src/*.c) $(wildcard src/klibc/*.c) 1.16 asmsrc = $(wildcard src/boot/*.S) $(wildcard src/*.S) $(wildcard src/klibc/*.S) 1.17 @@ -12,8 +22,8 @@ 1.18 1.19 # -nostdinc instructs the compiler to ignore standard include directories 1.20 # -m32 instructs the compiler to produce 32bit code (in case we have a 64bit compiler) 1.21 -CFLAGS = -m32 -Wall -g -nostdinc -fno-builtin $(inc) 1.22 -ASFLAGS = -m32 -g -nostdinc -fno-builtin $(inc) 1.23 +CFLAGS = $(ccemu) -Wall -g -nostdinc -fno-builtin $(inc) 1.24 +ASFLAGS = $(ccemu) -g -nostdinc -fno-builtin $(inc) 1.25 1.26 bin = kernel.elf 1.27 1.28 @@ -21,7 +31,7 @@ 1.29 # we need to specify where to assume the text section (code) is going 1.30 # in memory, as well as the kernel entry point (kentry). 1.31 $(bin): $(obj) 1.32 - ld -melf_i386 -o $@ -Ttext 0x100000 -e kentry $(obj) -Map link.map 1.33 + ld $(ldemu) -o $@ -Ttext 0x100000 -e kentry $(obj) -Map link.map 1.34 1.35 %.s: %.c 1.36 $(CC) $(CFLAGS) -S -o $@ $<