24898a3298db477e90927cee28d25a10ae09bd52
[fw/openocd] / testing / examples / AT91R40008Test / makefile
1 ##############################################################################################
2 #
3 #       !!!! Do NOT edit this makefile with an editor which replace tabs by spaces !!!!    
4 #
5 ##############################################################################################
6
7 # On command line:
8 #
9 # make all = Create project
10 #
11 # make clean = Clean project files.
12 #
13 # To rebuild project do "make clean" and "make all".
14 #
15
16 ##############################################################################################
17 # Start of default section
18 #
19
20 TRGT = arm-elf-
21 CC   = $(TRGT)gcc
22 CP   = $(TRGT)objcopy
23 AS   = $(TRGT)gcc -x assembler-with-cpp
24 BIN  = $(CP) -O ihex 
25
26 MCU  = arm7tdmi
27
28 # List all default C defines here, like -D_DEBUG=1
29 DDEFS = 
30
31 # List all default ASM defines here, like -D_DEBUG=1
32 DADEFS = 
33
34 # List all default directories to look for include files here
35 DINCDIR = 
36
37 # List the default directory to look for the libraries here
38 DLIBDIR =
39
40 # List all default libraries here
41 DLIBS = 
42
43 #
44 # End of default section
45 ##############################################################################################
46
47 ##############################################################################################
48 # Start of user section
49 #
50
51 # Define project name here
52 PROJECT = test
53
54 # Define linker script file here
55 LDSCRIPT_RAM = ./prj/ethernut3_ram.ld
56
57 # List all user C define here, like -D_DEBUG=1
58 UDEFS = 
59
60 # Define ASM defines here
61 UADEFS = 
62
63 # List C source files here
64 SRC  = ./src/main.c
65
66 # List ASM source files here
67 ASRC = ./src/crt.s
68
69 # List all user directories here
70 UINCDIR = ./inc
71
72 # List the user directory to look for the libraries here
73 ULIBDIR =
74
75 # List all user libraries here
76 ULIBS = 
77
78 # Define optimisation level here
79 OPT = -O0
80
81 #
82 # End of user defines
83 ##############################################################################################
84
85
86 INCDIR  = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR))
87 LIBDIR  = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR))
88 DEFS    = $(DDEFS) $(UDEFS)
89 ADEFS   = $(DADEFS) $(UADEFS)
90 OBJS    = $(ASRC:.s=.o) $(SRC:.c=.o)
91 LIBS    = $(DLIBS) $(ULIBS)
92 MCFLAGS = -mcpu=$(MCU)
93
94 ASFLAGS = $(MCFLAGS) -g -gdwarf-2 -Wa,-amhls=$(<:.s=.lst) $(ADEFS)
95 CPFLAGS = $(MCFLAGS) $(OPT) -gdwarf-2 -mthumb-interwork -fomit-frame-pointer -Wall -Wstrict-prototypes -fverbose-asm -Wa,-ahlms=$(<:.c=.lst) $(DEFS)
96 LDFLAGS_RAM = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT_RAM) -Wl,-Map=$(PROJECT)_ram.map,--cref,--no-warn-mismatch $(LIBDIR)
97
98 # Generate dependency information
99 CPFLAGS += -MD -MP -MF .dep/$(@F).d
100
101 #
102 # makefile rules
103 #
104
105 all: RAM
106
107 RAM: $(OBJS) $(PROJECT)_ram.elf $(PROJECT)_ram.hex
108
109 %o : %c
110         $(CC) -c $(CPFLAGS) -I . $(INCDIR) $< -o $@
111
112 %o : %s
113         $(AS) -c $(ASFLAGS) $< -o $@
114
115 %ram.elf: $(OBJS)
116         $(CC) $(OBJS) $(LDFLAGS_RAM) $(LIBS) -o $@
117
118 %hex: %elf
119         $(BIN) $< $@
120
121 clean:
122         -rm -f $(OBJS)
123         -rm -f $(PROJECT)_ram.elf
124         -rm -f $(PROJECT)_ram.map
125         -rm -f $(PROJECT)_ram.hex
126         -rm -f $(SRC:.c=.c.bak)
127         -rm -f $(SRC:.c=.lst)
128         -rm -f $(ASRC:.s=.s.bak)
129         -rm -f $(ASRC:.s=.lst)
130         -rm -fR .dep
131
132
133 # Include the dependency files, should be the last of the makefile
134 #
135 -include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
136
137 # *** EOF ***