Ein uC Projekt wird mit untenstehendem makefile übersetzt.
Das Makro OBJECTS wird bereits erfolgreich für den Linker eingesetzt.
Nun habe ich gehört (irgendwo gelesen) dass es irgendwas wie implizite
Regeln oder Suffixregeln gibt, mit welchen man die CC Aufrufe so machen
kann dass CC für jedes File von CSOURCES aufgerufen wird ohne daß man
die Dateien einzeln im makefile angeben muss. Geht das auch wenn der AS
Aufruf andere Parameter haben soll und wie muß das dann aussehen ?
1 | CC = arm-none-eabi-gcc
|
2 | CFLAGS = -Wall -O0 -funsigned-char --function-sections -mthumb -c -mcpu=cortex-m3
|
3 |
|
4 | AS = arm-none-eabi-as
|
5 | AFLAGS = -mcpu=cortex-m3 -mthumb
|
6 |
|
7 | LD = arm-none-eabi-ld
|
8 | LFLAGS = -gc-sections -M=map.txt -T./lscript_ld.txt
|
9 |
|
10 | CSOURCES = *.c
|
11 | ASOURCES = *.s
|
12 | OBJECTS = ./o/*.o
|
13 |
|
14 | ./o/out.bin : ./o/out.elf
|
15 | @echo ${OBJECTS}
|
16 | arm-none-eabi-objcopy -O binary ./$< ./$@
|
17 |
|
18 | ./o/out.elf : ${OBJECTS}
|
19 | ${LD} ${LFLAGS} ${OBJECTS} -o./o/out.elf
|
20 |
|
21 | ./o/startup_stm32f10x_ld.o : startup_stm32f10x_ld.s
|
22 | ${AS} ${AFLAGS} -I./ -o./o/startup_stm32f10x_ld.o ./startup_stm32f10x_ld.s
|
23 |
|
24 | ./o/cpuinit.o : cpuinit.c
|
25 | ${CC} ${CFLAGS} -I./ -o$@ ./$<
|
26 | ./o/main.o : main.c
|
27 | ${CC} ${CFLAGS} -I./ -o$@ ./$<
|
28 | ./o/flop.o : flop.c
|
29 | ${CC} ${CFLAGS} -I./ -o$@ ./$<
|
30 | ./o/misc.o : misc.c
|
31 | ${CC} ${CFLAGS} -I./ -o$@ ./$<
|
32 | ./o/stm32f10x_adc.o : stm32f10x_adc.c
|
33 | ${CC} ${CFLAGS} -I./ -o$@ ./$<
|
34 | ./o/stm32f10x_dma.o : stm32f10x_dma.c
|
35 | ${CC} ${CFLAGS} -I./ -o$@ ./$<
|
36 | ./o/stm32f10x_gpio.o : stm32f10x_gpio.c
|
37 | ${CC} ${CFLAGS} -I./ -o$@ ./$<
|
38 | ./o/stm32f10x_flash.o : stm32f10x_flash.c
|
39 | ${CC} ${CFLAGS} -I./ -o$@ ./$<
|
40 | ./o/stm32f10x_it.o : stm32f10x_it.c
|
41 | ${CC} ${CFLAGS} -I./ -o$@ ./$<
|
42 | ./o/stm32f10x_rcc.o : stm32f10x_rcc.c
|
43 | ${CC} ${CFLAGS} -I./ -o$@ ./$<
|
44 | ./o/stm32f10x_tim.o : stm32f10x_tim.c
|
45 | ${CC} ${CFLAGS} -I./ -o$@ ./$<
|