Mercurial > hg > Members > innparusu > xv6-rpi
diff src/makefile-osx.inc @ 3:0bbeb1a284e2
fix entry asmcode
author | tobaru |
---|---|
date | Fri, 04 Aug 2017 20:53:15 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/makefile-osx.inc Fri Aug 04 20:53:15 2017 +0900 @@ -0,0 +1,48 @@ +# Cross-compiling (e.g., on Mac OS X, install arm-none-eabi-gcc with MacPorts) +CROSSCOMPILE := + +CC = $(CROSSCOMPILE)/Users/one/src/cbclang-arm/build/bin/clang +AS = $(CROSSCOMPILE)as +LD = $(CROSSCOMPILE)ld +OBJCOPY = $(CROSSCOMPILE)objcopy +OBJDUMP = $(CROSSCOMPILE)objdump + +CFLAGS = -arch arm -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -Werror -I. -g -O0 \ + -Wno-macro-redefined -Wno-gnu-designator -Wno-sometimes-uninitialized -Wno-tautological-compare \ + -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include +LDFLAGS = -L. -arch armv7 +ASFLAGS = -arch arm + +LIBGCC = $(shell $(CC) -print-libgcc-file-name) + +# host compiler +HOSTCC_preferred = clang +define get_hostcc + $(if $(shell which $(HOSTCC_preferred)),$(HOSTCC_preferred),"cc") +endef +HOSTCC := $(call get_hostcc) + +# general rules +quiet-command = $(if $(V),$1,$(if $(2),@echo $2 && $1, @$1)) + +LINK_BIN = $(call quiet-command,$(LD) $(LDFLAGS) \ + -T $(1) -o $(2) $(3) $(LIBS) -b binary $(4), " LINK $(TARGET_DIR)$@") + +LINK_INIT = $(call quiet-command,$(LD) $(LDFLAGS) \ + $(1) -o $@.out $<, " LINK $(TARGET_DIR)$@") +OBJCOPY_INIT = $(call quiet-command,$(OBJCOPY) \ + -S -O binary --prefix-symbols="_binary_$@" $@.out $@, " OBJCOPY $(TARGET_DIR)$@") + +build-directory = $(shell mkdir -p build build/device build/lib) + +build/%.o: %.c + $(call build-directory) + $(call quiet-command,$(CC) $(CFLAGS) \ + -c -o $@ $<," CC $(TARGET_DIR)$@") + +AS_WITH = $(call quiet-command,$(CC) $(ASFLAGS) \ + $(1) -c -o $@ $<," AS $(TARGET_DIR)$@") + +build/%.o: %.S + $(call build-directory) + $(call AS_WITH, )