jtag: fix opendous typo
[openocd/ntfreak.git] / testing / examples / SAM7S256Test / makefile
blob9e1e83f8e0dd9378a53591bba63735b9a23ad53d
2 # !!!! Do NOT edit this makefile with an editor which replace tabs by spaces !!!!
4 ##############################################################################################
5 #
6 # On command line:
8 # make all = Create project
10 # make clean = Clean project files.
12 # To rebuild project do "make clean" and "make all".
15 ##############################################################################################
16 # Start of default section
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
25 MCU = arm7tdmi
27 # List all default C defines here, like -D_DEBUG=1
28 DDEFS =
30 # List all default ASM defines here, like -D_DEBUG=1
31 DADEFS =
33 # List all default directories to look for include files here
34 DINCDIR =
36 # List the default directory to look for the libraries here
37 DLIBDIR =
39 # List all default libraries here
40 DLIBS =
43 # End of default section
44 ##############################################################################################
46 ##############################################################################################
47 # Start of user section
50 # Define project name here
51 PROJECT = test
53 # Define linker script file here
54 LDSCRIPT_RAM = ./prj/sam7s256_ram.ld
55 LDSCRIPT_ROM = ./prj/sam7s256_rom.ld
57 # List all user C define here, like -D_DEBUG=1
58 UDEFS =
60 # Define ASM defines here
61 UADEFS =
63 # List C source files here
64 SRC = ./src/main.c
66 # List ASM source files here
67 ASRC = ./src/crt.s
69 # List all user directories here
70 UINCDIR = ./inc
72 # List the user directory to look for the libraries here
73 ULIBDIR =
75 # List all user libraries here
76 ULIBS =
78 # Define optimisation level here
79 OPT = -O0
82 # End of user defines
83 ##############################################################################################
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)
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 LDFLAGS_ROM = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT_ROM) -Wl,-Map=$(PROJECT)_rom.map,--cref,--no-warn-mismatch $(LIBDIR)
99 # Generate dependency information
100 CPFLAGS += -MD -MP -MF .dep/$(@F).d
103 # makefile rules
106 all: RAM ROM
108 RAM: $(OBJS) $(PROJECT)_ram.elf $(PROJECT)_ram.hex
110 ROM: $(OBJS) $(PROJECT)_rom.elf $(PROJECT)_rom.hex
112 %o : %c
113 $(CC) -c $(CPFLAGS) -I . $(INCDIR) $< -o $@
115 %o : %s
116 $(AS) -c $(ASFLAGS) $< -o $@
118 %ram.elf: $(OBJS)
119 $(CC) $(OBJS) $(LDFLAGS_RAM) $(LIBS) -o $@
121 %rom.elf: $(OBJS)
122 $(CC) $(OBJS) $(LDFLAGS_ROM) $(LIBS) -o $@
124 %hex: %elf
125 $(BIN) $< $@
127 clean:
128 -rm -f $(OBJS)
129 -rm -f $(PROJECT)_ram.elf
130 -rm -f $(PROJECT)_ram.map
131 -rm -f $(PROJECT)_ram.hex
132 -rm -f $(PROJECT)_rom.elf
133 -rm -f $(PROJECT)_rom.map
134 -rm -f $(PROJECT)_rom.hex
135 -rm -f $(SRC:.c=.c.bak)
136 -rm -f $(SRC:.c=.lst)
137 -rm -f $(ASRC:.s=.s.bak)
138 -rm -f $(ASRC:.s=.lst)
139 -rm -fR .dep
142 # Include the dependency files, should be the last of the makefile
144 -include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
146 # *** EOF ***