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