PACKAGE = time_keeper.hex BIN_PATH = /usr/bin:/usr/local/bin CXX = sdcc AS = asx8051 CPPFLAGS = -V --use-stdout -D__SDCC__ -D__F410_VER__ CFLAGS = -V --debug --stack-auto --nooverlay --model-small --use-stdout -D__SDCC__ -D__F410_VER__ --iram-size 0x0100 --xram-loc 0x0000 --xram-size 0x0800 --code-size 0x7e00 --opt-code-speed #-mmcs51 LFLAGS = -V --debug --use-stdout --stack-auto --model-small --xram-loc 0x0000 #-mmcs51 ASFLAGS = -plosgff INCLUDES = -I"c:\program files\sdcc\include" LIBS = #-L BUILD_DIR = build_by_sdcc 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 $(CPPFLAGS) $$i | sed -e 's/^+.*//g' -e 's/[^\.]*\.rel/$(BUILD_DIR)\/&/g' >> $(BUILD_DIR)/depend.inc;\ done -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)/$(PACKAGE) : $(patsubst %,$(BUILD_DIR)/%,$(OBJS)) export PATH=$(BIN_PATH):$$PATH; \ $(CXX) $(LFLAGS) $(INCLUDES) -o $@ $(LIBS) $^ $(BUILD_DIR) : mkdir $@ clean : rm -f $(PACKAGE:.hex=*) $(BUILD_DIR)/* run : all .PHONY : clean all depend