sdcc編譯器使用makefile
環境:make(window下有mingw32-make)和sdcc
############################################
# 主程序,根據自己程序更改
MainFile := Demo
# 所有的c文件,根據運行平臺更改
ALLC := $(shell dir /b *.c)
############################################
OBJ := $(patsubst %.c, %.rel, $(ALLC))
CC := sdcc
tmp1 := $(strip $(MainFile))$(strip .hex)
tmp2 := $(strip $(MainFile))$(strip .ihx)
all: end
$(OBJ):%.rel: %.c
$(CC) -c $^
ihx: $(OBJ)
$(CC) $(OBJ)
end: ihx
packihx $(tmp2)>$(tmp1)
clean:
del *.hex *.ihx *.map *.asm *.lk *.lst *.mem *.rel *.rst *sym