From f7b12cfbf51a3e10f6eb7ef661b966dd688575c2 Mon Sep 17 00:00:00 2001 From: Shinichiro Hamaji Date: Mon, 21 Mar 2011 13:07:43 +0900 Subject: [PATCH] Create test mac binaries using ld-mac. --- Makefile | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 9d30a5657..688eedd96 100644 --- a/Makefile +++ b/Makefile @@ -8,15 +8,29 @@ MACSRCS=$(wildcard mach/*.c) MACBINS=$(MACSRCS:.c=.bin) MACTXTS=$(MACSRCS:.c=.txt) +OS=$(shell uname) + +ifeq ($(OS), Linux) +MAC_TOOL_DIR=/usr/i686-apple-darwin10 +MAC_BIN_DIR=$(MAC_TOOL_DIR)/usr/bin +MAC_CC=PATH=$(MAC_BIN_DIR) ./ld-mac $(MAC_BIN_DIR)/gcc --sysroot=$(MAC_TOOL_DIR) +MAC_OTOOL=./ld-mac $(MAC_BIN_DIR)/otool +MAC_TARGETS=ld-mac $(MACBINS) $(MACTXTS) +else +MAC_CC=$(CC) +MAC_OTOOL=otool +MAC_TARGETS=$(MACBINS) $(MACTXTS) +endif + all: $(EXES) -mac: $(MACBINS) $(MACTXTS) +mach: $(MAC_TARGETS) $(MACBINS): %.bin: %.c - $(CC) -g $^ -o $@ + $(MAC_CC) -g $^ -o $@ $(MACTXTS): %.txt: %.bin - otool -hLltvV $^ > $@ + $(MAC_OTOOL) -hLltvV $^ > $@ #ok: macho2elf # ./genelf.sh