2 # !!!! Do NOT edit this makefile with an editor which replace tabs by spaces !!!!
4 ##############################################################################################
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
22 AS = $(TRGT)gcc -x assembler-with-cpp
27 # List all default C defines here, like -D_DEBUG=1
30 # List all default ASM defines here, like -D_DEBUG=1
33 # List all default directories to look for include files here
36 # List the default directory to look for the libraries here
39 # List all default libraries here
43 # End of default section
44 ##############################################################################################
46 ##############################################################################################
47 # Start of user section
50 # Define project name here
53 # Define linker script file here
54 LDSCRIPT= ./prj/str7_ram.ld
56 # List all user C define here, like -D_DEBUG=1
59 # Define ASM defines here
62 # List C source files here
65 # List ASM source files here
68 # List all user directories here
71 # List the user directory to look for the libraries here
74 # List all user libraries here
77 # Define optimisation level here
82 ##############################################################################################
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)
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)
97 # Generate dependency information
98 CPFLAGS += -MD -MP -MF .dep/$(@F).d
104 all: $(OBJS) $(PROJECT).elf $(PROJECT).hex
107 $(CC) -c $(CPFLAGS) -I . $(INCDIR) $< -o $@
110 $(AS) -c $(ASFLAGS) $< -o $@
113 $(CC) $(OBJS) $(LDFLAGS) $(LIBS) -o $@
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)
130 # Include the dependency files, should be the last of the makefile
132 -include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)