# HG changeset patch # User John Tsiombikas # Date 1317771298 -10800 # Node ID e49fdda976079284405fe2511856dee9b5af4b44 # Parent c2692696f9abb09249abdb7e3faad8562c7af6ae 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 diff -r c2692696f9ab -r e49fdda97607 Makefile --- a/Makefile Wed Aug 17 05:43:47 2011 +0300 +++ b/Makefile Wed Oct 05 02:34:58 2011 +0300 @@ -1,3 +1,13 @@ +ifneq ($(shell uname -m), i386) + ccemu = -m32 + + ifeq ($(shell uname -s), FreeBSD) + ldemu = elf_i386_fbsd + else + ldemu = elf_i386 + endif +endif + # collect all of our C and assembly source files csrc = $(wildcard src/boot/*.c) $(wildcard src/*.c) $(wildcard src/klibc/*.c) asmsrc = $(wildcard src/boot/*.S) $(wildcard src/*.S) $(wildcard src/klibc/*.S) @@ -12,8 +22,8 @@ # -nostdinc instructs the compiler to ignore standard include directories # -m32 instructs the compiler to produce 32bit code (in case we have a 64bit compiler) -CFLAGS = -m32 -Wall -g -nostdinc -fno-builtin $(inc) -ASFLAGS = -m32 -g -nostdinc -fno-builtin $(inc) +CFLAGS = $(ccemu) -Wall -g -nostdinc -fno-builtin $(inc) +ASFLAGS = $(ccemu) -g -nostdinc -fno-builtin $(inc) bin = kernel.elf @@ -21,7 +31,7 @@ # we need to specify where to assume the text section (code) is going # in memory, as well as the kernel entry point (kentry). $(bin): $(obj) - ld -melf_i386 -o $@ -Ttext 0x100000 -e kentry $(obj) -Map link.map + ld $(ldemu) -o $@ -Ttext 0x100000 -e kentry $(obj) -Map link.map %.s: %.c $(CC) $(CFLAGS) -S -o $@ $<