rules.mk 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  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. #
  17. # Output format. (can be srec, ihex, binary)
  18. FORMAT = ihex
  19. # Optimization level, can be [0, 1, 2, 3, s].
  20. # 0 = turn off optimization. s = optimize for size.
  21. # (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
  22. OPT = s
  23. COLOR ?= true
  24. ifeq ($(COLOR),true)
  25. NO_COLOR=\033[0m
  26. OK_COLOR=\033[32;01m
  27. ERROR_COLOR=\033[31;01m
  28. WARN_COLOR=\033[33;01m
  29. BLUE=\033[0;34m
  30. BOLD=\033[1m
  31. endif
  32. ifdef quick
  33. QUICK = $(quick)
  34. endif
  35. QUICK ?= false
  36. AUTOGEN ?= false
  37. ifneq ($(shell awk --version 2>/dev/null),)
  38. AWK=awk
  39. else
  40. AWK=cat && test
  41. endif
  42. OK_STRING=$(OK_COLOR)[OK]$(NO_COLOR)\n
  43. ERROR_STRING=$(ERROR_COLOR)[ERRORS]$(NO_COLOR)\n
  44. WARN_STRING=$(WARN_COLOR)[WARNINGS]$(NO_COLOR)\n
  45. ifndef $(SILENT)
  46. SILENT = false
  47. endif
  48. TAB_LOG = printf "\n$$LOG\n\n" | $(AWK) '{ sub(/^/," | "); print }'
  49. TAB_LOG_PLAIN = printf "$$LOG\n"
  50. AWK_STATUS = $(AWK) '{ printf " %-10s\n", $$1; }'
  51. AWK_CMD = $(AWK) '{ printf "%-99s", $$0; }'
  52. PRINT_ERROR = ($(SILENT) ||printf " $(ERROR_STRING)" | $(AWK_STATUS)) && $(TAB_LOG) && false
  53. PRINT_WARNING = ($(SILENT) || printf " $(WARN_STRING)" | $(AWK_STATUS)) && $(TAB_LOG)
  54. PRINT_ERROR_PLAIN = ($(SILENT) ||printf " $(ERROR_STRING)" | $(AWK_STATUS)) && $(TAB_LOG_PLAIN) && false && break
  55. PRINT_WARNING_PLAIN = ($(SILENT) || printf " $(WARN_STRING)" | $(AWK_STATUS)) && $(TAB_LOG_PLAIN)
  56. PRINT_OK = $(SILENT) || printf " $(OK_STRING)" | $(AWK_STATUS)
  57. BUILD_CMD = LOG=$$($(CMD) 2>&1) ; if [ $$? -gt 0 ]; then $(PRINT_ERROR); elif [ "$$LOG" != "" ] ; then $(PRINT_WARNING); else $(PRINT_OK); fi;
  58. # List any extra directories to look for include files here.
  59. # Each directory must be seperated by a space.
  60. # Use forward slashes for directory separators.
  61. # For a directory that has spaces, enclose it in quotes.
  62. EXTRAINCDIRS += $(subst :, ,$(VPATH))
  63. # Compiler flag to set the C Standard level.
  64. # c89 = "ANSI" C
  65. # gnu89 = c89 plus GCC extensions
  66. # c99 = ISO C99 standard (not yet fully implemented)
  67. # gnu99 = c99 plus GCC extensions
  68. CSTANDARD = -std=gnu99
  69. # Place -D or -U options here for C sources
  70. CDEFS += $(OPT_DEFS)
  71. # Place -D or -U options here for ASM sources
  72. ADEFS += $(OPT_DEFS)
  73. # Place -D or -U options here for C++ sources
  74. #CPPDEFS += -D__STDC_LIMIT_MACROS
  75. #CPPDEFS += -D__STDC_CONSTANT_MACROS
  76. CPPDEFS += $(OPT_DEFS)
  77. #---------------- Compiler Options C ----------------
  78. # -g*: generate debugging information
  79. # -O*: optimization level
  80. # -f...: tuning, see GCC manual and avr-libc documentation
  81. # -Wall...: warning level
  82. # -Wa,...: tell GCC to pass this to the assembler.
  83. # -adhlns...: create assembler listing
  84. CFLAGS += -g$(DEBUG)
  85. CFLAGS += $(CDEFS)
  86. CFLAGS += -O$(OPT)
  87. # add color
  88. ifeq ($(COLOR),true)
  89. ifeq ("$(shell echo "int main(){}" | $(CC) -fdiagnostics-color -x c - -o /dev/null 2>&1)", "")
  90. CFLAGS+= -fdiagnostics-color
  91. endif
  92. endif
  93. CFLAGS += -Wall
  94. CFLAGS += -Wstrict-prototypes
  95. #CFLAGS += -mshort-calls
  96. #CFLAGS += -fno-unit-at-a-time
  97. #CFLAGS += -Wundef
  98. #CFLAGS += -Wunreachable-code
  99. #CFLAGS += -Wsign-compare
  100. CFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
  101. CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
  102. CFLAGS += $(CSTANDARD)
  103. ifdef CONFIG_H
  104. CFLAGS += -include $(CONFIG_H)
  105. endif
  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
  113. CPPFLAGS += -g$(DEBUG)
  114. CPPFLAGS += $(CPPDEFS)
  115. CPPFLAGS += -O$(OPT)
  116. # to supress "warning: only initialized variables can be placed into program memory area"
  117. CPPFLAGS += -w
  118. CPPFLAGS += -Wall
  119. CPPFLAGS += -Wundef
  120. #CPPFLAGS += -mshort-calls
  121. #CPPFLAGS += -fno-unit-at-a-time
  122. #CPPFLAGS += -Wstrict-prototypes
  123. #CPPFLAGS += -Wunreachable-code
  124. #CPPFLAGS += -Wsign-compare
  125. CPPFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
  126. CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
  127. #CPPFLAGS += $(CSTANDARD)
  128. ifdef CONFIG_H
  129. CPPFLAGS += -include $(CONFIG_H)
  130. endif
  131. #---------------- Assembler Options ----------------
  132. # -Wa,...: tell GCC to pass this to the assembler.
  133. # -adhlns: create listing
  134. # -gstabs: have the assembler create line number information; note that
  135. # for use in COFF files, additional information about filenames
  136. # and function names needs to be present in the assembler source
  137. # files -- see avr-libc docs [FIXME: not yet described there]
  138. # -listing-cont-lines: Sets the maximum number of continuation lines of hex
  139. # dump that will be displayed for a given single line of source input.
  140. ASFLAGS += $(ADEFS) -Wa,-adhlns=$(@:%.o=%.lst),-gstabs,--listing-cont-lines=100
  141. ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
  142. ifdef CONFIG_H
  143. ASFLAGS += -include $(CONFIG_H)
  144. endif
  145. #---------------- Library Options ----------------
  146. # Minimalistic printf version
  147. PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
  148. # Floating point printf version (requires MATH_LIB = -lm below)
  149. PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
  150. # If this is left blank, then it will use the Standard printf version.
  151. PRINTF_LIB =
  152. #PRINTF_LIB = $(PRINTF_LIB_MIN)
  153. #PRINTF_LIB = $(PRINTF_LIB_FLOAT)
  154. # Minimalistic scanf version
  155. SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
  156. # Floating point + %[ scanf version (requires MATH_LIB = -lm below)
  157. SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
  158. # If this is left blank, then it will use the Standard scanf version.
  159. SCANF_LIB =
  160. #SCANF_LIB = $(SCANF_LIB_MIN)
  161. #SCANF_LIB = $(SCANF_LIB_FLOAT)
  162. MATH_LIB = -lm
  163. #---------------- Linker Options ----------------
  164. # -Wl,...: tell GCC to pass this to linker.
  165. # -Map: create map file
  166. # --cref: add cross reference to map file
  167. #
  168. # Comennt out "--relax" option to avoid a error such:
  169. # (.vectors+0x30): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_12'
  170. #
  171. LDFLAGS += -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref
  172. #LDFLAGS += -Wl,--relax
  173. LDFLAGS += $(EXTMEMOPTS)
  174. LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
  175. LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
  176. #LDFLAGS += -T linker_script.x
  177. # You can give EXTRALDFLAGS at 'make' command line.
  178. LDFLAGS += $(EXTRALDFLAGS)
  179. # Define programs and commands.
  180. SHELL = sh
  181. REMOVE = rm -f
  182. REMOVEDIR = rmdir
  183. COPY = cp
  184. WINSHELL = cmd
  185. SECHO = $(SILENT) || echo
  186. # Define Messages
  187. # English
  188. MSG_ERRORS_NONE = Errors: none
  189. MSG_BEGIN = -------- begin --------
  190. MSG_END = -------- end --------
  191. MSG_SIZE_BEFORE = Size before:
  192. MSG_SIZE_AFTER = Size after:
  193. MSG_COFF = Converting to AVR COFF:
  194. MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
  195. MSG_FLASH = Creating load file for Flash:
  196. MSG_EEPROM = Creating load file for EEPROM:
  197. MSG_EXTENDED_LISTING = Creating Extended Listing:
  198. MSG_SYMBOL_TABLE = Creating Symbol Table:
  199. MSG_LINKING = Linking:
  200. MSG_COMPILING = Compiling:
  201. MSG_COMPILING_CPP = Compiling:
  202. MSG_ASSEMBLING = Assembling:
  203. MSG_CLEANING = Cleaning project:
  204. MSG_CREATING_LIBRARY = Creating library:
  205. # Define all object files.
  206. OBJ = $(patsubst %.c,$(OBJDIR)/%.o,$(patsubst %.cpp,$(OBJDIR)/%.o,$(patsubst %.S,$(OBJDIR)/%.o,$(SRC))))
  207. # Define all listing files.
  208. LST = $(patsubst %.c,$(OBJDIR)/%.lst,$(patsubst %.cpp,$(OBJDIR)/%.lst,$(patsubst %.S,$(OBJDIR)/%.lst,$(SRC))))
  209. # Compiler flags to generate dependency files.
  210. #GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
  211. GENDEPFLAGS = -MMD -MP -MF $(BUILD_DIR)/.dep/$(subst /,_,$@).d
  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
  215. ALL_CFLAGS = $(MCUFLAGS) $(CFLAGS) $(GENDEPFLAGS) $(EXTRAFLAGS)
  216. ALL_CPPFLAGS = $(MCUFLAGS) -x c++ $(CPPFLAGS) $(GENDEPFLAGS) $(EXTRAFLAGS)
  217. ALL_ASFLAGS = $(MCUFLAGS) -x assembler-with-cpp $(ASFLAGS) $(EXTRAFLAGS)
  218. # Default target.
  219. all:
  220. @$(MAKE) begin
  221. @$(MAKE) gccversion
  222. @$(MAKE) sizebefore
  223. @$(MAKE) clean_list # force clean each time
  224. @$(MAKE) build
  225. @$(MAKE) sizeafter
  226. @$(MAKE) end
  227. # Quick make that doesn't clean
  228. quick:
  229. @$(MAKE) begin
  230. @$(MAKE) gccversion
  231. @$(MAKE) sizebefore
  232. @$(MAKE) build
  233. @$(MAKE) sizeafter
  234. @$(MAKE) end
  235. # Change the build target to build a HEX file or a library.
  236. build: elf hex
  237. #build: elf hex eep lss sym
  238. #build: lib
  239. elf: $(BUILD_DIR)/$(TARGET).elf
  240. hex: $(BUILD_DIR)/$(TARGET).hex
  241. eep: $(BUILD_DIR)/$(TARGET).eep
  242. lss: $(BUILD_DIR)/$(TARGET).lss
  243. sym: $(BUILD_DIR)/$(TARGET).sym
  244. LIBNAME=lib$(TARGET).a
  245. lib: $(LIBNAME)
  246. # Eye candy.
  247. # AVR Studio 3.x does not check make's exit code but relies on
  248. # the following magic strings to be generated by the compile job.
  249. begin:
  250. @$(SECHO) $(MSG_BEGIN)
  251. end:
  252. @$(SECHO) $(MSG_END)
  253. # Display size of file.
  254. HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
  255. #ELFSIZE = $(SIZE) --mcu=$(MCU) --format=avr $(TARGET).elf
  256. ELFSIZE = $(SIZE) $(BUILD_DIR)/$(TARGET).elf
  257. sizebefore:
  258. @if test -f $(TARGET).hex; then $(SECHO) $(MSG_SIZE_BEFORE); $(SILENT) || $(HEXSIZE); \
  259. 2>/dev/null; $(SECHO); fi
  260. sizeafter:
  261. @if test -f $(TARGET).hex; then $(SECHO); $(SECHO) $(MSG_SIZE_AFTER); $(SILENT) || $(HEXSIZE); \
  262. 2>/dev/null; $(SECHO); fi
  263. # test file sizes eventually
  264. # @if [[ $($(SIZE) --target=$(FORMAT) $(TARGET).hex | $(AWK) 'NR==2 {print "0x"$5}') -gt 0x200 ]]; then $(SECHO) "File is too big!"; fi
  265. # Display compiler version information.
  266. gccversion :
  267. @$(SILENT) || $(CC) --version
  268. # Create final output files (.hex, .eep) from ELF output file.
  269. %.hex: %.elf
  270. @$(SILENT) || printf "$(MSG_FLASH) $@" | $(AWK_CMD)
  271. $(eval CMD=$(HEX) $< $@)
  272. @$(BUILD_CMD)
  273. @if $(AUTOGEN); then \
  274. $(SILENT) || printf "Copying $(TARGET).hex to keymaps/$(KEYMAP)/$(KEYBOARD)_$(KEYMAP).hex\n"; \
  275. $(COPY) $@ $(KEYMAP_PATH)/$(KEYBOARD)_$(KEYMAP).hex; \
  276. else \
  277. $(COPY) $@ $(TARGET).hex; \
  278. fi
  279. %.eep: %.elf
  280. @$(SILENT) || printf "$(MSG_EEPROM) $@" | $(AWK_CMD)
  281. $(eval CMD=$(EEP) $< $@ || exit 0)
  282. @$(BUILD_CMD)
  283. # Create extended listing file from ELF output file.
  284. %.lss: %.elf
  285. @$(SILENT) || printf "$(MSG_EXTENDED_LISTING) $@" | $(AWK_CMD)
  286. $(eval CMD=$(OBJDUMP) -h -S -z $< > $@)
  287. @$(BUILD_CMD)
  288. # Create a symbol table from ELF output file.
  289. %.sym: %.elf
  290. @$(SILENT) || printf "$(MSG_SYMBOL_TABLE) $@" | $(AWK_CMD)
  291. $(eval CMD=$(NM) -n $< > $@ )
  292. @$(BUILD_CMD)
  293. # Create library from object files.
  294. .SECONDARY : $(BUILD_DIR)/$(TARGET).a
  295. .PRECIOUS : $(OBJ)
  296. %.a: $(OBJ)
  297. @$(SILENT) || printf "$(MSG_CREATING_LIBRARY) $@" | $(AWK_CMD)
  298. $(eval CMD=$(AR) $@ $(OBJ) )
  299. @$(BUILD_CMD)
  300. # Link: create ELF output file from object files.
  301. .SECONDARY : $(BUILD_DIR)/$(TARGET).elf
  302. .PRECIOUS : $(OBJ)
  303. %.elf: $(OBJ)
  304. @$(SILENT) || printf "$(MSG_LINKING) $@" | $(AWK_CMD)
  305. $(eval CMD=$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS))
  306. @$(BUILD_CMD)
  307. # Compile: create object files from C source files.
  308. $(OBJDIR)/%.o : %.c
  309. @mkdir -p $(@D)
  310. @$(SILENT) || printf "$(MSG_COMPILING) $<" | $(AWK_CMD)
  311. $(eval CMD=$(CC) -c $(ALL_CFLAGS) $< -o $@)
  312. @$(BUILD_CMD)
  313. # Compile: create object files from C++ source files.
  314. $(OBJDIR)/%.o : %.cpp
  315. @mkdir -p $(@D)
  316. @$(SILENT) || printf "$(MSG_COMPILING_CPP) $<" | $(AWK_CMD)
  317. $(eval CMD=$(CC) -c $(ALL_CPPFLAGS) $< -o $@)
  318. @$(BUILD_CMD)
  319. # Compile: create assembler files from C source files.
  320. %.s : %.c
  321. @$(SILENT) || printf "$(MSG_ASSEMBLING) $<" | $(AWK_CMD)
  322. $(eval CMD=$(CC) -S $(ALL_CFLAGS) $< -o $@)
  323. @$(BUILD_CMD)
  324. # Compile: create assembler files from C++ source files.
  325. %.s : %.cpp
  326. @$(SILENT) || printf "$(MSG_ASSEMBLING) $<" | $(AWK_CMD)
  327. $(eval CMD=$(CC) -S $(ALL_CPPFLAGS) $< -o $@)
  328. @$(BUILD_CMD)
  329. # Assemble: create object files from assembler source files.
  330. $(OBJDIR)/%.o : %.S
  331. @mkdir -p $(@D)
  332. @$(SILENT) || printf "$(MSG_ASSEMBLING) $<" | $(AWK_CMD)
  333. $(eval CMD=$(CC) -c $(ALL_ASFLAGS) $< -o $@)
  334. @$(BUILD_CMD)
  335. # Create preprocessed source for use in sending a bug report.
  336. %.i : %.c
  337. $(CC) -E -mmcu=$(MCU) $(CFLAGS) $< -o $@
  338. # Target: clean project.
  339. clean: begin clean_list end
  340. clean_list :
  341. @$(REMOVE) -r $(BUILD_DIR)
  342. @$(REMOVE) -r $(TOP_DIR)/$(BUILD_DIR)
  343. @$(REMOVE) -r $(KEYBOARD_PATH)/$(BUILD_DIR)
  344. @if $$SUBPROJECT; then $(REMOVE) -r $(SUBPROJECT_PATH)/$(BUILD_DIR); fi
  345. @$(REMOVE) -r $(KEYMAP_PATH)/$(BUILD_DIR)
  346. show_path:
  347. @echo VPATH=$(VPATH)
  348. @echo SRC=$(SRC)
  349. SUBDIRS := $(filter-out %/util/ %/doc/ %/keymaps/ %/old_keymap_files/,$(dir $(wildcard $(TOP_DIR)/keyboards/**/*/Makefile)))
  350. SUBDIRS := $(SUBDIRS) $(dir $(wildcard $(TOP_DIR)/keyboards/*/.))
  351. SUBDIRS := $(sort $(SUBDIRS))
  352. # $(error $(SUBDIRS))
  353. all-keyboards-defaults-%:
  354. @for x in $(SUBDIRS) ; do \
  355. printf "Compiling with default: $$x" | $(AWK_CMD); \
  356. LOG=$$($(MAKE) -C $$x $(subst all-keyboards-defaults-,,$@) VERBOSE=$(VERBOSE) COLOR=$(COLOR) SILENT=true 2>&1) ; if [ $$? -gt 0 ]; then $(PRINT_ERROR_PLAIN); elif [ "$$LOG" != "" ] ; then $(PRINT_WARNING_PLAIN); else $(PRINT_OK); fi; \
  357. done
  358. all-keyboards-defaults: all-keyboards-defaults-all
  359. KEYBOARDS := $(SUBDIRS:$(TOP_DIR)/keyboards/%/=/keyboards/%)
  360. all-keyboards-all: $(addsuffix -all,$(KEYBOARDS))
  361. all-keyboards-quick: $(addsuffix -quick,$(KEYBOARDS))
  362. all-keyboards-clean: $(addsuffix -clean,$(KEYBOARDS))
  363. all-keyboards: all-keyboards-all
  364. define make_keyboard
  365. $(eval KEYBOARD=$(patsubst /keyboards/%,%,$1))
  366. $(eval SUBPROJECT=$(lastword $(subst /, ,$(KEYBOARD))))
  367. $(eval KEYBOARD=$(firstword $(subst /, ,$(KEYBOARD))))
  368. $(eval KEYMAPS=$(notdir $(patsubst %/.,%,$(wildcard $(TOP_DIR)/keyboards/$(KEYBOARD)/keymaps/*/.))))
  369. $(eval KEYMAPS+=$(notdir $(patsubst %/.,%,$(wildcard $(TOP_DIR)/keyboards/$(KEYBOARD)/$(SUBPROJECT)/keymaps/*/.))))
  370. @for x in $(KEYMAPS) ; do \
  371. printf "Compiling $(BOLD)$(KEYBOARD)/$(SUBPROJECT)$(NO_COLOR) with $(BOLD)$$x$(NO_COLOR)" | $(AWK) '{ printf "%-118s", $$0; }'; \
  372. LOG=$$($(MAKE) -C $(TOP_DIR)$1 $2 keymap=$$x VERBOSE=$(VERBOSE) COLOR=$(COLOR) SILENT=true 2>&1) ; if [ $$? -gt 0 ]; then $(PRINT_ERROR_PLAIN); elif [ "$$LOG" != "" ] ; then $(PRINT_WARNING_PLAIN); else $(PRINT_OK); fi; \
  373. done
  374. endef
  375. define make_keyboard_helper
  376. # Just remove the -quick, -all and so on from the first argument and pass it forward
  377. $(call make_keyboard,$(subst -$2,,$1),$2)
  378. endef
  379. /keyboards/%-quick:
  380. $(call make_keyboard_helper,$@,quick)
  381. /keyboards/%-all:
  382. $(call make_keyboard_helper,$@,all)
  383. /keyboards/%-clean:
  384. $(call make_keyboard_helper,$@,clean)
  385. /keyboards/%:
  386. $(call make_keyboard_helper,$@,all)
  387. all-keymaps-%:
  388. $(eval MAKECONFIG=$(call get_target,all-keymaps,$@))
  389. $(eval KEYMAPS=$(notdir $(patsubst %/.,%,$(wildcard $(TOP_DIR)/keyboards/$(KEYBOARD)/keymaps/*/.))))
  390. @for x in $(KEYMAPS) ; do \
  391. printf "Compiling $(BOLD)$(KEYBOARD)$(NO_COLOR) with $(BOLD)$$x$(NO_COLOR)" | $(AWK) '{ printf "%-118s", $$0; }'; \
  392. LOG=$$($(MAKE) $(subst all-keymaps-,,$@) keyboard=$(KEYBOARD) keymap=$$x VERBOSE=$(VERBOSE) COLOR=$(COLOR) SILENT=true 2>&1) ; if [ $$? -gt 0 ]; then $(PRINT_ERROR_PLAIN); elif [ "$$LOG" != "" ] ; then $(PRINT_WARNING_PLAIN); else $(PRINT_OK); fi; \
  393. done
  394. all-keymaps: all-keymaps-all
  395. # Create build directory
  396. $(shell mkdir $(BUILD_DIR) 2>/dev/null)
  397. # Create object files directory
  398. $(shell mkdir $(OBJDIR) 2>/dev/null)
  399. # Include the dependency files.
  400. -include $(shell mkdir $(BUILD_DIR)/.dep 2>/dev/null) $(wildcard $(BUILD_DIR)/.dep/*)
  401. # Listing of phony targets.
  402. .PHONY : all quick begin finish end sizebefore sizeafter gccversion \
  403. build elf hex eep lss sym coff extcoff \
  404. clean clean_list debug gdb-config show_path \
  405. program teensy dfu flip dfu-ee flip-ee dfu-start \
  406. all-keyboards-defaults all-keyboards all-keymaps \
  407. all-keyboards-defaults-% all-keyboards-% all-keymaps-%