PACKAGE = test.hex INCLUDE_DIR = ../include LIB_DIR = ../lib BUILD_DIR = build_by_sdcc SRCS_C = \ test.c timer.c led.c SRCS_ASM = \ OBJS = $(SRCS_ASM:.asm=.rel) $(SRCS_C:.c=.rel) all : $(BUILD_DIR) $(PACKAGE) $(BUILD_DIR)/%.rel : %.c sdcc -c -mmcs51 -DSDCC -I$(INCLUDE_DIR) -o $@ $< $(BUILD_DIR)/%.rel : %.asm cp $< $(BUILD_DIR)/; \ cd $(BUILD_DIR); \ asx8051 -losg $< $(PACKAGE:.hex=.ihx) : $(patsubst %,$(BUILD_DIR)/%,$(OBJS)) sdcc -mmcs51 -o $@ -L$(LIB_DIR) -l ezusb $^ $(PACKAGE) : $(PACKAGE:.hex=.ihx) cp -p $< $@ $(BUILD_DIR) : mkdir $@ clean : rm -f $(PACKAGE) $(BUILD_DIR)/* run : all .PHONY : clean all