You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

111 lines
2.7 KiB

Makefile redo & other features (#395) * .build containment implemented * no destructive variable setting - builds in either folder * make from 3 places * cleans before each build * make from root with keyboard=keyboard, keymap=keymap * make from keyboard/keyboard with keymap=keymap * make from keymaps/keymap * only implemented on planck * adds color diag to avr-gcc * makefiles for all plancks, clean-up * quick build-all makefile for plancks * reformatting of make output (colors) * color toggle, tmk path corrections * correct if statement for color * move config.h to main makefile, updates preonic, atomic * format update, all keyboards targets * makefile optional for build all target, alps and arrow_pad updated * alps updated * make planck default, trying out travis recipe for all-keyboards * all-keymaps target, different travis recipe * updates alps64 * updates keyboards to new format * updates clue* projects * all projects updated, specialise EZ .hex, let .hex through * updates travis * automatically find root, keyboard, keymap * silent echo, cleaned-up mass make output * updates all keyboards' .hex files except EZ * Rename Bantam44.c to bantam44.c * Rename Bantam44.h to bantam44.h * nananana * adds six key keyboard * does same to ez as rest * updates send_string example * brings ergodox_ez up to date * updates template/new project script * adds sixkeyboard * adds readme for sixkeyboard * adds sixkeyboard to travis * filenames, gitignore mess * define clock prescaler stuff manually * make quick, size test example * documentation and dfu-no-build
8 years ago
  1. ifndef VERBOSE
  2. .SILENT:
  3. endif
  4. starting_makefile := $(abspath $(firstword $(MAKEFILE_LIST)))
  5. mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
  6. tmk_root := $(patsubst %/,%,$(dir $(mkfile_path)))
  7. ifneq (,$(findstring /keyboard/,$(starting_makefile)))
  8. possible_keyboard:=$(patsubst %/,%,$(dir $(patsubst $(tmk_root)/keyboard/%,%,$(starting_makefile))))
  9. ifneq (,$(findstring /keymaps/,$(possible_keyboard)))
  10. KEYBOARD_DIR:=$(firstword $(subst /keymaps/, ,$(possible_keyboard)))
  11. KEYMAP_DIR:=$(lastword $(subst /keymaps/, ,$(possible_keyboard)))
  12. else
  13. KEYBOARD_DIR:=$(possible_keyboard)
  14. KEYMAP_DIR:=default
  15. endif
  16. endif
  17. # $(info $(KEYBOARD_DIR))
  18. # $(info $(KEYMAP_DIR))
  19. # Directory common source filess exist
  20. TOP_DIR = $(tmk_root)
  21. TMK_DIR = tmk_core
  22. TMK_PATH = $(TOP_DIR)/$(TMK_DIR)
  23. QUANTUM_DIR = quantum
  24. QUANTUM_PATH = $(TOP_DIR)/$(QUANTUM_DIR)
  25. ifdef keyboard
  26. KEYBOARD ?= $(keyboard)
  27. endif
  28. ifdef KEYBOARD_DIR
  29. KEYBOARD ?= $(KEYBOARD_DIR)
  30. endif
  31. ifndef KEYBOARD
  32. KEYBOARD=planck
  33. endif
  34. KEYBOARD_PATH = $(TOP_DIR)/keyboard/$(KEYBOARD)
  35. ifneq ("$(wildcard $(KEYBOARD_PATH)/$(KEYBOARD).c)","")
  36. KEYBOARD_FILE = keyboard/$(KEYBOARD)/$(KEYBOARD).c
  37. ifndef ARCH
  38. include $(KEYBOARD_PATH)/Makefile
  39. endif
  40. else
  41. $(error "$(KEYBOARD_PATH)/$(KEYBOARD).c" does not exist)
  42. endif
  43. ifdef keymap
  44. KEYMAP ?= $(keymap)
  45. endif
  46. ifdef KEYMAP_DIR
  47. KEYMAP ?= $(KEYMAP_DIR)
  48. endif
  49. ifndef KEYMAP
  50. KEYMAP = default
  51. endif
  52. KEYMAP_PATH = $(KEYBOARD_PATH)/keymaps/$(KEYMAP)
  53. ifneq ("$(wildcard $(KEYMAP_PATH)/keymap.c)","")
  54. KEYMAP_FILE = keyboard/$(KEYBOARD)/keymaps/$(KEYMAP)/keymap.c
  55. -include $(KEYMAP_PATH)/Makefile
  56. else
  57. $(error "$(KEYMAP_PATH)/keymap.c" does not exist)
  58. endif
  59. TARGET = $(KEYBOARD)_$(KEYMAP)
  60. ifneq ("$(wildcard $(KEYMAP_PATH)/config.h)","")
  61. CONFIG_H = $(KEYMAP_PATH)/config.h
  62. else
  63. CONFIG_H = $(KEYBOARD_PATH)/config.h
  64. endif
  65. # # project specific files
  66. SRC += $(KEYBOARD_FILE) \
  67. $(KEYMAP_FILE) \
  68. $(QUANTUM_DIR)/quantum.c \
  69. $(QUANTUM_DIR)/keymap_common.c \
  70. $(QUANTUM_DIR)/led.c
  71. ifndef CUSTOM_MATRIX
  72. SRC += $(QUANTUM_DIR)/matrix.c
  73. endif
  74. ifeq ($(strip $(AUDIO_ENABLE)), yes)
  75. SRC += $(QUANTUM_DIR)/audio/audio.c
  76. SRC += $(QUANTUM_DIR)/audio/voices.c
  77. SRC += $(QUANTUM_DIR)/audio/luts.c
  78. endif
  79. ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
  80. SRC += $(QUANTUM_DIR)/light_ws2812.c
  81. SRC += $(QUANTUM_DIR)/rgblight.c
  82. OPT_DEFS += -DRGBLIGHT_ENABLE
  83. endif
  84. # Optimize size but this may cause error "relocation truncated to fit"
  85. #EXTRALDFLAGS = -Wl,--relax
  86. # Search Path
  87. VPATH += $(KEYMAP_PATH)
  88. VPATH += $(KEYBOARD_PATH)
  89. VPATH += $(TOP_DIR)
  90. VPATH += $(TMK_PATH)
  91. VPATH += $(QUANTUM_PATH)
  92. VPATH += $(QUANTUM_PATH)/keymap_extras
  93. VPATH += $(QUANTUM_PATH)/audio
  94. include $(TMK_PATH)/protocol/lufa.mk
  95. include $(TMK_PATH)/common.mk
  96. include $(TMK_PATH)/rules.mk