makefile
来自「The high portable FAT filesystem library」· 代码 · 共 60 行
TXT
60 行
# makefile configuration
OUTPUT_DIR = bin
NAME = ccfatlib
OBJECTS = main.o halayer.o fatlib.o
CPU = msp430x449
CFLAGS = -mmcu=${CPU} -O2 -Wall -g
#switch the compiler (for the internal make rules)
CC = msp430-gcc
LD=msp430-ld
.PHONY: all FORCE clean download download-jtag download-bsl dist
#all should be the first target. it's built when make is run without args
all: ${NAME}.elf ${NAME}.a43 # ${NAME}.lst
rm -f main.o
#additional rules for files
${NAME}.elf: ${OBJECTS}
${CC} -mmcu=${CPU} -Wl,-Map=${NAME}.map -o $@ ${OBJECTS}
${NAME}.a43: ${NAME}.elf
msp430-objcopy -O ihex $^ $@
${NAME}.lst: ${NAME}.elf
msp430-objdump -dSt $^ >$@
# How to make listings (with assembly code):
%.lst: %.o
msp430-objdump -DS $^ > $@
# GNU make contains a built-in implicit rule for making .o files from .c files.
clean:
rm -f ${NAME}.elf ${NAME}.a43 ${NAME}.lst ${OBJECTS}
#backup archive
dist:
tar czf dist.tgz *.c *.h *.txt makefile
#dummy target as dependecy if something has to be build everytime
FORCE:
#project dependencies
-include dependencies.in
#target to update the file, it's removed first
depend: rmdepend dependencies.in
#remove the file
rmdepend:
rm -f dependencies.in
#build the file that contains the dependencies. no deps in this rule.
#if there were deps it would be rebuilt every chnage, which is unneded:
dependencies.in:
$(CC) -MM ${CFLAGS} $(patsubst %.o,%.c,$(OBJECTS)) >$@
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?