PACKAGE = GPS_IF_sniffer.bix BIN_PATH = /usr/bin:/usr/local/bin FRAMWORK_DIR = ../framework/dependency/EZUSB CXX = sdcc AS = asx8051 CPPFLAGS = -V #--use-stdout CFLAGS = -V --debug --opt-code-speed --model-small LFLAGS = -V --debug --model-small --xram-loc 0xe000 --xram-size 0x200 --iram-size 0x100 ASFLAGS = -plosgff INCLUDES = -I"c:\program files\sdcc\include" -I$(FRAMWORK_DIR)/include LIBS = -L $(FRAMWORK_DIR)/lib/fx2 -l ezusb BUILD_DIR = build_by_sdcc HEX2BIX = '/cygdrive/c/Program Files/Cypress/USB/Bin/Hex2bix.exe' SRCS_C = \ $(shell ls *.c) SRCS_ASM = \ $(shell ls *.asm) OBJS = $(SRCS_C:.c=.rel) $(SRCS_ASM:.asm=.rel) all : $(BUILD_DIR) depend $(PACKAGE) # ヘッダーファイルの依存関係 depend: $(SRCS_C) export PATH=$(BIN_PATH):$$PATH; \ rm -f $(BUILD_DIR)/depend.inc; \ for i in $^; do \ $(CXX) -E -MMM $(INCLUDES) $(CPPFLAGS) $$i >> tempfile; \ if ! [ $$? = 0 ]; then \ rm -f tempfile; \ exit 1; \ fi; \ done; \ cat tempfile | sed -e 's/^+.*//g' -e 's/[^\.]*\.rel/$(BUILD_DIR)\/&/g' >> $(BUILD_DIR)/depend.inc; \ rm -f tempfile -include $(BUILD_DIR)/depend.inc $(BUILD_DIR)/%.rel : %.c export PATH=$(BIN_PATH):$$PATH; \ $(CXX) -c $(CFLAGS) $(INCLUDES) -o $@ $< $(BUILD_DIR)/%.rel : %.asm export PATH=$(BIN_PATH):$$PATH; \ cp $< $(BUILD_DIR)/; \ cd $(BUILD_DIR); \ $(AS) $(ASFLAGS) $< $(PACKAGE) : $(patsubst %,$(BUILD_DIR)/%,$(PACKAGE)) $(BUILD_DIR)/%.bix : $(BUILD_DIR)/%.hex $(HEX2BIX) -o $@ $< $(BUILD_DIR)/%.hex : $(patsubst %,$(BUILD_DIR)/%,$(OBJS)) export PATH=$(BIN_PATH):$$PATH; \ $(CXX) $(LFLAGS) $(INCLUDES) -o $@ $(LIBS) $^ $(BUILD_DIR) : mkdir $@ clean : rm -f $(PACKAGE) $(BUILD_DIR)/* .PHONY : clean all depend .PRECIOUS : $(BUILD_DIR)/%.hex $(BUILD_DIR)/%.rel