tmk_core/common: Fixing TIMER_DIFF macro to calculate difference correctly after...
[jackhill/qmk/firmware.git] / tmk_core / rules.mk
CommitLineData
a074364c 1# Hey Emacs, this is a -*- makefile -*-
2#----------------------------------------------------------------------------
3# WinAVR Makefile Template written by Eric B. Weddington, Jg Wunsch, et al.
4#
5# Released to the Public Domain
6#
7# Additional material for this makefile was written by:
8# Peter Fleury
9# Tim Henigan
10# Colin O'Flynn
11# Reiner Patommel
12# Markus Pfaff
13# Sander Pool
14# Frederik Rouleau
15# Carlos Lamas
16#
a8375fa1 17
f11a0275
FS
18# Enable vpath seraching for source files only
19# Without this, output files, could be read from the wrong .build directories
20VPATH_SRC := $(VPATH)
21vpath %.c $(VPATH_SRC)
22vpath %.h $(VPATH_SRC)
23vpath %.cpp $(VPATH_SRC)
8a9aac6e 24vpath %.cc $(VPATH_SRC)
f11a0275
FS
25vpath %.hpp $(VPATH_SRC)
26vpath %.S $(VPATH_SRC)
27VPATH :=
28
3aac4e95
FS
29# Convert all SRC to OBJ
30define OBJ_FROM_SRC
8f790948 31$(patsubst %.c,$1/%.o,$(patsubst %.cpp,$1/%.o,$(patsubst %.cc,$1/%.o,$(patsubst %.S,$1/%.o,$(patsubst %.clib,$1/%.a,$($1_SRC))))))
3aac4e95
FS
32endef
33$(foreach OUTPUT,$(OUTPUTS),$(eval $(OUTPUT)_OBJ +=$(call OBJ_FROM_SRC,$(OUTPUT))))
34
35# Define a list of all objects
36OBJ := $(foreach OUTPUT,$(OUTPUTS),$($(OUTPUT)_OBJ))
8f790948 37NO_LTO_OBJ := $(filter %.a,$(OBJ))
3aac4e95
FS
38
39MASTER_OUTPUT := $(firstword $(OUTPUTS))
40
41
a074364c 42
a074364c 43# Output format. (can be srec, ihex, binary)
44FORMAT = ihex
45
e175b8d5 46# Optimization level, can be [0, 1, 2, 3, s].
a074364c 47# 0 = turn off optimization. s = optimize for size.
48# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
49OPT = s
50
a074364c 51# Compiler flag to set the C Standard level.
52# c89 = "ANSI" C
53# gnu89 = c89 plus GCC extensions
54# c99 = ISO C99 standard (not yet fully implemented)
55# gnu99 = c99 plus GCC extensions
56CSTANDARD = -std=gnu99
57
58
59# Place -D or -U options here for C sources
3aac4e95 60#CDEFS +=
a074364c 61
62
63# Place -D or -U options here for ASM sources
3aac4e95 64#ADEFS +=
a074364c 65
66
67# Place -D or -U options here for C++ sources
b28ee6b0
NB
68#CXXDEFS += -D__STDC_LIMIT_MACROS
69#CXXDEFS += -D__STDC_CONSTANT_MACROS
70#CXXDEFS +=
3aac4e95 71
a074364c 72
73
74
75#---------------- Compiler Options C ----------------
76# -g*: generate debugging information
77# -O*: optimization level
78# -f...: tuning, see GCC manual and avr-libc documentation
79# -Wall...: warning level
80# -Wa,...: tell GCC to pass this to the assembler.
81# -adhlns...: create assembler listing
8f790948
TI
82ifndef SKIP_DEBUG_INFO
83 CFLAGS += -g$(DEBUG)
84endif
a074364c 85CFLAGS += $(CDEFS)
86CFLAGS += -O$(OPT)
d9e4dad0
JH
87# add color
88ifeq ($(COLOR),true)
13bb6b4b 89ifeq ("$(shell echo "int main(){}" | $(CC) -fdiagnostics-color -x c - -o /dev/null 2>&1)", "")
d9e4dad0 90 CFLAGS+= -fdiagnostics-color
d9e4dad0
JH
91endif
92endif
a074364c 93CFLAGS += -Wall
94CFLAGS += -Wstrict-prototypes
d6829461
FS
95ifneq ($(strip $(ALLOW_WARNINGS)), yes)
96 CFLAGS += -Werror
97endif
a074364c 98#CFLAGS += -mshort-calls
99#CFLAGS += -fno-unit-at-a-time
100#CFLAGS += -Wundef
101#CFLAGS += -Wunreachable-code
102#CFLAGS += -Wsign-compare
103CFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
a074364c 104CFLAGS += $(CSTANDARD)
a074364c 105
a074364c 106#---------------- Compiler Options C++ ----------------
107# -g*: generate debugging information
108# -O*: optimization level
109# -f...: tuning, see GCC manual and avr-libc documentation
110# -Wall...: warning level
111# -Wa,...: tell GCC to pass this to the assembler.
112# -adhlns...: create assembler listing
8f790948 113ifndef SKIP_DEBUG_INFO
b28ee6b0 114 CXXFLAGS += -g$(DEBUG)
8f790948 115endif
b28ee6b0
NB
116CXXFLAGS += $(CXXDEFS)
117CXXFLAGS += -O$(OPT)
a074364c 118# to supress "warning: only initialized variables can be placed into program memory area"
b28ee6b0
NB
119CXXFLAGS += -w
120CXXFLAGS += -Wall
121CXXFLAGS += -Wundef
d6829461 122ifneq ($(strip $(ALLOW_WARNINGS)), yes)
b28ee6b0 123 CXXFLAGS += -Werror
d6829461 124endif
b28ee6b0
NB
125#CXXFLAGS += -mshort-calls
126#CXXFLAGS += -fno-unit-at-a-time
127#CXXFLAGS += -Wstrict-prototypes
128#CXXFLAGS += -Wunreachable-code
129#CXXFLAGS += -Wsign-compare
130CXXFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
131#CXXFLAGS += $(CSTANDARD)
a074364c 132
133#---------------- Assembler Options ----------------
134# -Wa,...: tell GCC to pass this to the assembler.
135# -adhlns: create listing
136# -gstabs: have the assembler create line number information; note that
137# for use in COFF files, additional information about filenames
138# and function names needs to be present in the assembler source
139# files -- see avr-libc docs [FIXME: not yet described there]
e175b8d5 140# -listing-cont-lines: Sets the maximum number of continuation lines of hex
a074364c 141# dump that will be displayed for a given single line of source input.
d3f7910e 142ASFLAGS += $(ADEFS)
8f790948
TI
143ifndef SKIP_DEBUG_INFO
144 ASFLAGS += -Wa,-adhlns=$(@:%.o=%.lst),-gstabs,--listing-cont-lines=100
145else
146 ASFLAGS += -Wa,-adhlns=$(@:%.o=%.lst),--listing-cont-lines=100
147endif
a074364c 148
149#---------------- Library Options ----------------
150# Minimalistic printf version
151PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
152
153# Floating point printf version (requires MATH_LIB = -lm below)
154PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
155
156# If this is left blank, then it will use the Standard printf version.
e175b8d5 157PRINTF_LIB =
a074364c 158#PRINTF_LIB = $(PRINTF_LIB_MIN)
159#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
160
161
162# Minimalistic scanf version
163SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
164
165# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
166SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
167
168# If this is left blank, then it will use the Standard scanf version.
e175b8d5 169SCANF_LIB =
a074364c 170#SCANF_LIB = $(SCANF_LIB_MIN)
171#SCANF_LIB = $(SCANF_LIB_FLOAT)
172
173
174MATH_LIB = -lm
42baa6cf 175CREATE_MAP ?= yes
a074364c 176
177
a074364c 178#---------------- Linker Options ----------------
179# -Wl,...: tell GCC to pass this to linker.
180# -Map: create map file
181# --cref: add cross reference to map file
182#
183# Comennt out "--relax" option to avoid a error such:
184# (.vectors+0x30): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_12'
185#
42baa6cf
FS
186
187ifeq ($(CREATE_MAP),yes)
188 LDFLAGS += -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref
189endif
a074364c 190#LDFLAGS += -Wl,--relax
a074364c 191LDFLAGS += $(EXTMEMOPTS)
192LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
193LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
194#LDFLAGS += -T linker_script.x
195# You can give EXTRALDFLAGS at 'make' command line.
196LDFLAGS += $(EXTRALDFLAGS)
197
a074364c 198# Define programs and commands.
199SHELL = sh
a074364c 200REMOVE = rm -f
201REMOVEDIR = rmdir
202COPY = cp
203WINSHELL = cmd
d9e4dad0 204SECHO = $(SILENT) || echo
a074364c 205
a074364c 206
207# Compiler flags to generate dependency files.
208#GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
e58e9af2 209GENDEPFLAGS = -MMD -MP -MF $(patsubst %.o,%.td,$@)
a074364c 210
211
212# Combine all necessary flags and optional flags.
213# Add target processor to flags.
214# You can give extra flags at 'make' command line like: make EXTRAFLAGS=-DFOO=bar
84bfb195 215ALL_CFLAGS = $(MCUFLAGS) $(CFLAGS) $(EXTRAFLAGS)
b28ee6b0 216ALL_CXXFLAGS = $(MCUFLAGS) -x c++ $(CXXFLAGS) $(EXTRAFLAGS)
4d4f7684 217ALL_ASFLAGS = $(MCUFLAGS) -x assembler-with-cpp $(ASFLAGS) $(EXTRAFLAGS)
a074364c 218
8f790948
TI
219define NO_LTO
220$(patsubst %.a,%.o,$1): NOLTO_CFLAGS += -fno-lto
221endef
222$(foreach LOBJ, $(NO_LTO_OBJ), $(eval $(call NO_LTO,$(LOBJ))))
223
e58e9af2
FS
224MOVE_DEP = mv -f $(patsubst %.o,%.td,$@) $(patsubst %.o,%.d,$@)
225
75795186 226# Add QMK specific flags
227DFU_SUFFIX ?= dfu-suffix
228DFU_SUFFIX_ARGS ?=
229
a074364c 230
d9e4dad0
JH
231elf: $(BUILD_DIR)/$(TARGET).elf
232hex: $(BUILD_DIR)/$(TARGET).hex
9bfaf667 233cpfirmware: $(FIRMWARE_FORMAT)
234 $(SILENT) || printf "Copying $(TARGET).$(FIRMWARE_FORMAT) to qmk_firmware folder" | $(AWK_CMD)
235 $(COPY) $(BUILD_DIR)/$(TARGET).$(FIRMWARE_FORMAT) $(TARGET).$(FIRMWARE_FORMAT) && $(PRINT_OK)
d9e4dad0
JH
236eep: $(BUILD_DIR)/$(TARGET).eep
237lss: $(BUILD_DIR)/$(TARGET).lss
238sym: $(BUILD_DIR)/$(TARGET).sym
a074364c 239LIBNAME=lib$(TARGET).a
240lib: $(LIBNAME)
241
a074364c 242# Display size of file.
9fdc2762 243HEXSIZE = $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex
a074364c 244#ELFSIZE = $(SIZE) --mcu=$(MCU) --format=avr $(TARGET).elf
d9e4dad0 245ELFSIZE = $(SIZE) $(BUILD_DIR)/$(TARGET).elf
a074364c 246
247sizebefore:
9fdc2762 248 @if test -f $(BUILD_DIR)/$(TARGET).hex; then $(SECHO) $(MSG_SIZE_BEFORE); $(SILENT) || $(HEXSIZE); \
d9e4dad0 249 2>/dev/null; $(SECHO); fi
a074364c 250
b86b0480 251sizeafter: $(BUILD_DIR)/$(TARGET).hex
9fdc2762 252 @if test -f $(BUILD_DIR)/$(TARGET).hex; then $(SECHO); $(SECHO) $(MSG_SIZE_AFTER); $(SILENT) || $(HEXSIZE); \
d9e4dad0 253 2>/dev/null; $(SECHO); fi
a074364c 254
255# Display compiler version information.
e175b8d5 256gccversion :
d9e4dad0 257 @$(SILENT) || $(CC) --version
a074364c 258
a074364c 259# Create final output files (.hex, .eep) from ELF output file.
260%.hex: %.elf
d9e4dad0 261 @$(SILENT) || printf "$(MSG_FLASH) $@" | $(AWK_CMD)
4d4f7684 262 $(eval CMD=$(HEX) $< $@)
d9e4dad0 263 @$(BUILD_CMD)
a074364c 264
265%.eep: %.elf
d9e4dad0 266 @$(SILENT) || printf "$(MSG_EEPROM) $@" | $(AWK_CMD)
4d4f7684 267 $(eval CMD=$(EEP) $< $@ || exit 0)
d9e4dad0 268 @$(BUILD_CMD)
a074364c 269
270# Create extended listing file from ELF output file.
271%.lss: %.elf
d9e4dad0
JH
272 @$(SILENT) || printf "$(MSG_EXTENDED_LISTING) $@" | $(AWK_CMD)
273 $(eval CMD=$(OBJDUMP) -h -S -z $< > $@)
274 @$(BUILD_CMD)
a074364c 275
276# Create a symbol table from ELF output file.
277%.sym: %.elf
d9e4dad0
JH
278 @$(SILENT) || printf "$(MSG_SYMBOL_TABLE) $@" | $(AWK_CMD)
279 $(eval CMD=$(NM) -n $< > $@ )
280 @$(BUILD_CMD)
a074364c 281
f9a6e34c
FS
282%.bin: %.elf
283 @$(SILENT) || printf "$(MSG_BIN) $@" | $(AWK_CMD)
284 $(eval CMD=$(BIN) $< $@ || exit 0)
285 @$(BUILD_CMD)
75795186 286 if [ ! -z "$(DFU_SUFFIX_ARGS)" ]; then \
287 $(DFU_SUFFIX) $(DFU_SUFFIX_ARGS) -a $(BUILD_DIR)/$(TARGET).bin 1>/dev/null ;\
288 fi
289 $(COPY) $(BUILD_DIR)/$(TARGET).bin $(TARGET).bin;
f9a6e34c 290
26d348b6 291BEGIN = gccversion sizebefore
6911ead0 292
a074364c 293# Link: create ELF output file from object files.
d9e4dad0 294.SECONDARY : $(BUILD_DIR)/$(TARGET).elf
a074364c 295.PRECIOUS : $(OBJ)
84bfb195 296# Note the obj.txt depeendency is there to force linking if a source file is deleted
3aac4e95 297%.elf: $(OBJ) $(MASTER_OUTPUT)/cflags.txt $(MASTER_OUTPUT)/ldflags.txt $(MASTER_OUTPUT)/obj.txt | $(BEGIN)
d9e4dad0 298 @$(SILENT) || printf "$(MSG_LINKING) $@" | $(AWK_CMD)
84bfb195 299 $(eval CMD=$(CC) $(ALL_CFLAGS) $(filter-out %.txt,$^) --output $@ $(LDFLAGS))
d9e4dad0 300 @$(BUILD_CMD)
d3f7910e 301
a074364c 302
bf1c865c 303define GEN_OBJRULE
33fbd3be 304$1_INCFLAGS := $$(patsubst %,-I%,$$($1_INC))
9028a412 305ifdef $1_CONFIG
800ec55d 306$1_CONFIG_FLAGS += $$(patsubst %,-include %,$$($1_CONFIG))
9028a412 307endif
8f790948 308$1_CFLAGS = $$(ALL_CFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS) $$(NOLTO_CFLAGS)
b28ee6b0 309$1_CXXFLAGS= $$(ALL_CXXFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS) $$(NOLTO_CFLAGS)
9028a412 310$1_ASFLAGS= $$(ALL_ASFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS)
3aac4e95 311
a074364c 312# Compile: create object files from C source files.
d5a947b3 313$1/%.o : %.c $1/%.d $1/cflags.txt $1/compiler.txt | $(BEGIN)
bf1c865c
FS
314 @mkdir -p $$(@D)
315 @$$(SILENT) || printf "$$(MSG_COMPILING) $$<" | $$(AWK_CMD)
3aac4e95 316 $$(eval CMD := $$(CC) -c $$($1_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
bf1c865c 317 @$$(BUILD_CMD)
a074364c 318
319# Compile: create object files from C++ source files.
b28ee6b0 320$1/%.o : %.cpp $1/%.d $1/cxxflags.txt $1/compiler.txt | $(BEGIN)
bf1c865c 321 @mkdir -p $$(@D)
b28ee6b0
NB
322 @$$(SILENT) || printf "$$(MSG_COMPILING_CXX) $$<" | $$(AWK_CMD)
323 $$(eval CMD=$$(CC) -c $$($1_CXXFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
8a9aac6e
FS
324 @$$(BUILD_CMD)
325
b28ee6b0 326$1/%.o : %.cc $1/%.d $1/cxxflags.txt $1/compiler.txt | $(BEGIN)
8a9aac6e 327 @mkdir -p $$(@D)
b28ee6b0
NB
328 @$$(SILENT) || printf "$$(MSG_COMPILING_CXX) $$<" | $$(AWK_CMD)
329 $$(eval CMD=$$(CC) -c $$($1_CXXFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
8a9aac6e 330 @$$(BUILD_CMD)
a074364c 331
bf1c865c 332# Assemble: create object files from assembler source files.
d5a947b3 333$1/%.o : %.S $1/asflags.txt $1/compiler.txt | $(BEGIN)
bf1c865c
FS
334 @mkdir -p $$(@D)
335 @$(SILENT) || printf "$$(MSG_ASSEMBLING) $$<" | $$(AWK_CMD)
3aac4e95 336 $$(eval CMD=$$(CC) -c $$($1_ASFLAGS) $$< -o $$@)
bf1c865c 337 @$$(BUILD_CMD)
84bfb195 338
8f790948
TI
339$1/%.a : $1/%.o
340 @mkdir -p $$(@D)
341 @$(SILENT) || printf "Archiving: $$<" | $$(AWK_CMD)
6d73fe12 342 $$(eval CMD=$$(AR) rcs $$@ $$<)
8f790948
TI
343 @$$(BUILD_CMD)
344
84bfb195
FS
345$1/force:
346
347$1/cflags.txt: $1/force
3aac4e95 348 echo '$$($1_CFLAGS)' | cmp -s - $$@ || echo '$$($1_CFLAGS)' > $$@
84bfb195 349
b28ee6b0
NB
350$1/cxxflags.txt: $1/force
351 echo '$$($1_CXXFLAGS)' | cmp -s - $$@ || echo '$$($1_CXXFLAGS)' > $$@
84bfb195
FS
352
353$1/asflags.txt: $1/force
3aac4e95 354 echo '$$($1_ASFLAGS)' | cmp -s - $$@ || echo '$$($1_ASFLAGS)' > $$@
84bfb195 355
d5a947b3
FS
356$1/compiler.txt: $1/force
357 $$(CC) --version | cmp -s - $$@ || $$(CC) --version > $$@
bf1c865c
FS
358endef
359
13f3c733 360.PRECIOUS: $(MASTER_OUTPUT)/obj.txt
3aac4e95 361$(MASTER_OUTPUT)/obj.txt: $(MASTER_OUTPUT)/force
13f3c733 362 echo '$(OBJ)' | cmp -s - $@ || echo '$(OBJ)' > $@
3aac4e95 363
13f3c733 364.PRECIOUS: $(MASTER_OUTPUT)/ldflags.txt
3aac4e95 365$(MASTER_OUTPUT)/ldflags.txt: $(MASTER_OUTPUT)/force
13f3c733 366 echo '$(LDFLAGS)' | cmp -s - $@ || echo '$(LDFLAGS)' > $@
3aac4e95
FS
367
368
e58e9af2 369# We have to use static rules for the .d files for some reason
8f790948 370DEPS = $(patsubst %.o,%.d,$(patsubst %.a,%.o,$(OBJ)))
e58e9af2
FS
371# Keep the .d files
372.PRECIOUS: $(DEPS)
373# Empty rule to force recompilation if the .d file is missing
374$(DEPS):
d3f7910e 375
e58e9af2 376
3aac4e95 377$(foreach OUTPUT,$(OUTPUTS),$(eval $(call GEN_OBJRULE,$(OUTPUT))))
a074364c 378
a074364c 379# Create preprocessed source for use in sending a bug report.
6911ead0 380%.i : %.c | $(BEGIN)
e175b8d5 381 $(CC) -E -mmcu=$(MCU) $(CFLAGS) $< -o $@
a074364c 382
a074364c 383# Target: clean project.
e58e9af2 384clean:
48f8ab1a 385 $(foreach OUTPUT,$(OUTPUTS), $(REMOVE) -r $(OUTPUT) 2>/dev/null)
a0dc6221 386 $(REMOVE) $(BUILD_DIR)/$(TARGET).*
a074364c 387
388show_path:
389 @echo VPATH=$(VPATH)
390 @echo SRC=$(SRC)
3aac4e95 391 @echo OBJ=$(OBJ)
a074364c 392
0f95c086
TI
393objs-size:
394 for i in $(OBJ); do echo $$i; done | sort | xargs $(SIZE)
395
19a1fbac 396ifeq ($(findstring avr-gcc,$(CC)),avr-gcc)
b9f6ff05
TI
397SIZE_MARGIN = 1024
398
9fdc2762 399check-size:
7874f297 400 $(eval MAX_SIZE=$(shell n=`$(CC) -E -mmcu=$(MCU) $(CFLAGS) $(OPT_DEFS) tmk_core/common/avr/bootloader_size.c 2> /dev/null | sed -ne 's/\r//;/^#/n;/^AVR_SIZE:/,$${s/^AVR_SIZE: //;p;}'` && echo $$(($$n)) || echo 0))
9fdc2762 401 $(eval CURRENT_SIZE=$(shell if [ -f $(BUILD_DIR)/$(TARGET).hex ]; then $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex | $(AWK) 'NR==2 {print $$4}'; else printf 0; fi))
fe068393 402 $(eval FREE_SIZE=$(shell expr $(MAX_SIZE) - $(CURRENT_SIZE)))
403 $(eval OVER_SIZE=$(shell expr $(CURRENT_SIZE) - $(MAX_SIZE)))
8e348c42 404 $(eval PERCENT_SIZE=$(shell expr $(CURRENT_SIZE) \* 100 / $(MAX_SIZE)))
9fdc2762
JH
405 if [ $(MAX_SIZE) -gt 0 ] && [ $(CURRENT_SIZE) -gt 0 ]; then \
406 $(SILENT) || printf "$(MSG_CHECK_FILESIZE)" | $(AWK_CMD); \
b9f6ff05
TI
407 if [ $(CURRENT_SIZE) -gt $(MAX_SIZE) ]; then \
408 printf "\n * $(MSG_FILE_TOO_BIG)"; $(PRINT_ERROR_PLAIN); \
409 else \
410 if [ $(FREE_SIZE) -lt $(SIZE_MARGIN) ]; then \
411 $(PRINT_WARNING_PLAIN); printf " * $(MSG_FILE_NEAR_LIMIT)"; \
412 else \
413 $(PRINT_OK); $(SILENT) || printf " * $(MSG_FILE_JUST_RIGHT)"; \
414 fi \
415 fi \
9fdc2762 416 fi
fca31693
ML
417else
418check-size:
a71c461d 419 $(SILENT) || echo "(Firmware size check does not yet support $(MCU) microprocessors; skipping.)"
fca31693 420endif
9fdc2762 421
d9e4dad0 422# Create build directory
03b1d142 423$(shell mkdir -p $(BUILD_DIR) 2>/dev/null)
a074364c 424
425# Create object files directory
03b1d142 426$(eval $(foreach OUTPUT,$(OUTPUTS),$(shell mkdir -p $(OUTPUT) 2>/dev/null)))
a074364c 427
428# Include the dependency files.
8f790948 429-include $(patsubst %.o,%.d,$(patsubst %.a,%.o,$(OBJ)))
a074364c 430
431
432# Listing of phony targets.
5210f94a
JH
433.PHONY : all finish sizebefore sizeafter qmkversion \
434gccversion build elf hex eep lss sym coff extcoff \
a074364c 435clean clean_list debug gdb-config show_path \
4003d077
DJ
436program teensy dfu flip dfu-ee flip-ee dfu-start \
437flash dfu-split-left dfu-split-right \
438avrdude-split-left avrdude-split-right \
439avrdude-loop usbasp