Merge pull request #596 from fredizzimo/rid_of_quick
Fix the makefile dependencies and remove quick targets
This commit is contained in:
		
						commit
						d5baa4773d
					
				
					 10 changed files with 87 additions and 56 deletions
				
			
		
							
								
								
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							| 
						 | 
					@ -17,6 +17,7 @@ build/
 | 
				
			||||||
.build/
 | 
					.build/
 | 
				
			||||||
*.bak
 | 
					*.bak
 | 
				
			||||||
.vagrant/
 | 
					.vagrant/
 | 
				
			||||||
 | 
					quantum/version.h
 | 
				
			||||||
.idea/
 | 
					.idea/
 | 
				
			||||||
CMakeLists.txt
 | 
					CMakeLists.txt
 | 
				
			||||||
.DS_STORE
 | 
					.DS_STORE
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,7 +10,7 @@ env:
 | 
				
			||||||
  global:
 | 
					  global:
 | 
				
			||||||
  - secure: vBTSL34BDPxDilKUuTXqU4CJ26Pv5hogD2nghatkxSQkI1/jbdnLj/DQdPUrMJFDIY6TK3AltsBx72MaMsLQ1JO/Ou24IeHINHXzUC1FlS9yQa48cpxnhX5kzXNyGs3oa0qaFbvnr7RgYRWtmD52n4bIZuSuW+xpBv05x2OCizdT2ZonH33nATaHGFasxROm4qYZ241VfzcUv766V6RVHgL4x9V08warugs+RENVkfzxxwhk3NmkrISabze0gSVJLHBPHxroZC6EUcf/ocobcuDrCwFqtEt90i7pNIAFUE7gZsN2uE75LmpzAWin21G7lLPcPL2k4FJVd8an1HiP2WmscJU6U89fOfMb2viObnKcCzebozBCmKGtHEuXZo9FcReOx49AnQSpmESJGs+q2dL/FApkTjQiyT4J6O5dJpoww0/r57Wx0cmmqjETKBb5rSgXM51Etk3wO09mvcPHsEwrT7qH8r9XWdyCDoEn7FCLX3/LYnf/D4SmZ633YPl5gv3v9XEwxR5+04akjgnvWDSNIaDbWBdxHNb7l4pMc+WR1bwCyMyA7KXj0RrftEGOrm9ZRLe6BkbT4cycA+j77nbPOMcyZChliV9pPQos+4TOJoTzcK2L8yWVoY409aDNVuAjdP6Yum0R2maBGl/etLmIMpJC35C5/lZ+dUNjJAM=
 | 
					  - secure: vBTSL34BDPxDilKUuTXqU4CJ26Pv5hogD2nghatkxSQkI1/jbdnLj/DQdPUrMJFDIY6TK3AltsBx72MaMsLQ1JO/Ou24IeHINHXzUC1FlS9yQa48cpxnhX5kzXNyGs3oa0qaFbvnr7RgYRWtmD52n4bIZuSuW+xpBv05x2OCizdT2ZonH33nATaHGFasxROm4qYZ241VfzcUv766V6RVHgL4x9V08warugs+RENVkfzxxwhk3NmkrISabze0gSVJLHBPHxroZC6EUcf/ocobcuDrCwFqtEt90i7pNIAFUE7gZsN2uE75LmpzAWin21G7lLPcPL2k4FJVd8an1HiP2WmscJU6U89fOfMb2viObnKcCzebozBCmKGtHEuXZo9FcReOx49AnQSpmESJGs+q2dL/FApkTjQiyT4J6O5dJpoww0/r57Wx0cmmqjETKBb5rSgXM51Etk3wO09mvcPHsEwrT7qH8r9XWdyCDoEn7FCLX3/LYnf/D4SmZ633YPl5gv3v9XEwxR5+04akjgnvWDSNIaDbWBdxHNb7l4pMc+WR1bwCyMyA7KXj0RrftEGOrm9ZRLe6BkbT4cycA+j77nbPOMcyZChliV9pPQos+4TOJoTzcK2L8yWVoY409aDNVuAjdP6Yum0R2maBGl/etLmIMpJC35C5/lZ+dUNjJAM=
 | 
				
			||||||
script:
 | 
					script:
 | 
				
			||||||
- make all-keyboards-quick AUTOGEN=true
 | 
					- make all-keyboards AUTOGEN=true
 | 
				
			||||||
addons:
 | 
					addons:
 | 
				
			||||||
  apt:
 | 
					  apt:
 | 
				
			||||||
    packages:
 | 
					    packages:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										30
									
								
								Makefile
									
										
									
									
									
								
							
							
						
						
									
										30
									
								
								Makefile
									
										
									
									
									
								
							| 
						 | 
					@ -5,8 +5,9 @@ endif
 | 
				
			||||||
.DEFAULT_GOAL := all
 | 
					.DEFAULT_GOAL := all
 | 
				
			||||||
 | 
					
 | 
				
			||||||
space := $(subst ,, )
 | 
					space := $(subst ,, )
 | 
				
			||||||
starting_makefile := $(subst $(space),_SPACE_,$(abspath $(firstword $(MAKEFILE_LIST))))
 | 
					ESCAPED_ABS_PATH = $(subst $(space),_SPACE_,$(abspath $1))
 | 
				
			||||||
mkfile_path := $(subst $(space),_SPACE_,$(abspath $(lastword $(MAKEFILE_LIST))))
 | 
					starting_makefile := $(call ESCAPED_ABS_PATH,$(firstword $(MAKEFILE_LIST)))
 | 
				
			||||||
 | 
					mkfile_path := $(call ESCAPED_ABS_PATH,$(lastword $(MAKEFILE_LIST))))
 | 
				
			||||||
abs_tmk_root := $(patsubst %/,%,$(dir $(mkfile_path)))
 | 
					abs_tmk_root := $(patsubst %/,%,$(dir $(mkfile_path)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ifneq (,$(findstring /keyboards/,$(starting_makefile)))
 | 
					ifneq (,$(findstring /keyboards/,$(starting_makefile)))
 | 
				
			||||||
| 
						 | 
					@ -83,10 +84,8 @@ endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ifneq ("$(wildcard $(KEYBOARD_PATH)/$(KEYBOARD).c)","")
 | 
					ifneq ("$(wildcard $(KEYBOARD_PATH)/$(KEYBOARD).c)","")
 | 
				
			||||||
	KEYBOARD_FILE = keyboards/$(KEYBOARD)/$(KEYBOARD).c
 | 
						KEYBOARD_FILE = keyboards/$(KEYBOARD)/$(KEYBOARD).c
 | 
				
			||||||
	ifndef ARCH
 | 
						ifneq ($(call ESCAPED_ABS_PATH,$(KEYBOARD_PATH)/Makefile),$(starting_makefile))
 | 
				
			||||||
		ifneq ("$(wildcard $(KEYBOARD_PATH)/Makefile)","")
 | 
							-include $(KEYBOARD_PATH)/Makefile
 | 
				
			||||||
			include $(KEYBOARD_PATH)/Makefile
 | 
					 | 
				
			||||||
		endif
 | 
					 | 
				
			||||||
	endif
 | 
						endif
 | 
				
			||||||
else 
 | 
					else 
 | 
				
			||||||
$(error "$(KEYBOARD_PATH)/$(KEYBOARD).c" does not exist)
 | 
					$(error "$(KEYBOARD_PATH)/$(KEYBOARD).c" does not exist)
 | 
				
			||||||
| 
						 | 
					@ -101,7 +100,9 @@ ifdef SUBPROJECT
 | 
				
			||||||
	ifneq ("$(wildcard $(SUBPROJECT_PATH)/$(SUBPROJECT).c)","")
 | 
						ifneq ("$(wildcard $(SUBPROJECT_PATH)/$(SUBPROJECT).c)","")
 | 
				
			||||||
		OPT_DEFS += -DSUBPROJECT_$(SUBPROJECT)
 | 
							OPT_DEFS += -DSUBPROJECT_$(SUBPROJECT)
 | 
				
			||||||
		SUBPROJECT_FILE = keyboards/$(KEYBOARD)/$(SUBPROJECT)/$(SUBPROJECT).c
 | 
							SUBPROJECT_FILE = keyboards/$(KEYBOARD)/$(SUBPROJECT)/$(SUBPROJECT).c
 | 
				
			||||||
		-include $(SUBPROJECT_PATH)/Makefile
 | 
							ifneq ($(call ESCAPED_ABS_PATH,$(SUBPROJECT_PATH)/Makefile),$(starting_makefile))
 | 
				
			||||||
 | 
								-include $(SUBPROJECT_PATH)/Makefile
 | 
				
			||||||
 | 
							endif
 | 
				
			||||||
	else 
 | 
						else 
 | 
				
			||||||
$(error "$(SUBPROJECT_PATH)/$(SUBPROJECT).c" does not exist)
 | 
					$(error "$(SUBPROJECT_PATH)/$(SUBPROJECT).c" does not exist)
 | 
				
			||||||
	endif
 | 
						endif
 | 
				
			||||||
| 
						 | 
					@ -119,14 +120,18 @@ endif
 | 
				
			||||||
KEYMAP_PATH = $(KEYBOARD_PATH)/keymaps/$(KEYMAP)
 | 
					KEYMAP_PATH = $(KEYBOARD_PATH)/keymaps/$(KEYMAP)
 | 
				
			||||||
ifneq ("$(wildcard $(KEYMAP_PATH)/keymap.c)","")
 | 
					ifneq ("$(wildcard $(KEYMAP_PATH)/keymap.c)","")
 | 
				
			||||||
	KEYMAP_FILE = keyboards/$(KEYBOARD)/keymaps/$(KEYMAP)/keymap.c
 | 
						KEYMAP_FILE = keyboards/$(KEYBOARD)/keymaps/$(KEYMAP)/keymap.c
 | 
				
			||||||
	-include $(KEYMAP_PATH)/Makefile
 | 
						ifneq ($(call ESCAPED_ABS_PATH,$(KEYMAP_PATH)/Makefile),$(starting_makefile))
 | 
				
			||||||
 | 
							-include $(KEYMAP_PATH)/Makefile
 | 
				
			||||||
 | 
						endif
 | 
				
			||||||
else 
 | 
					else 
 | 
				
			||||||
	ifeq ("$(wildcard $(SUBPROJECT_PATH)/keymaps/$(KEYMAP)/keymap.c)","")
 | 
						ifeq ("$(wildcard $(SUBPROJECT_PATH)/keymaps/$(KEYMAP)/keymap.c)","")
 | 
				
			||||||
$(error "$(KEYMAP_PATH)/keymap.c" does not exist)
 | 
					$(error "$(KEYMAP_PATH)/keymap.c" does not exist)
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		KEYMAP_PATH = $(SUBPROJECT_PATH)/keymaps/$(KEYMAP)
 | 
							KEYMAP_PATH = $(SUBPROJECT_PATH)/keymaps/$(KEYMAP)
 | 
				
			||||||
		KEYMAP_FILE = keyboards/$(KEYBOARD)/$(SUBPROJECT)/keymaps/$(KEYMAP)/keymap.c
 | 
							KEYMAP_FILE = keyboards/$(KEYBOARD)/$(SUBPROJECT)/keymaps/$(KEYMAP)/keymap.c
 | 
				
			||||||
		-include $(KEYMAP_PATH)/Makefile
 | 
							ifneq ($(call ESCAPED_ABS_PATH,$(KEYMAP_PATH)/Makefile),$(starting_makefile))
 | 
				
			||||||
 | 
								-include $(KEYMAP_PATH)/Makefile
 | 
				
			||||||
 | 
							endif
 | 
				
			||||||
	endif
 | 
						endif
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -135,7 +140,8 @@ ifdef SUBPROJECT
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
	TARGET ?= $(KEYBOARD)_$(KEYMAP)
 | 
						TARGET ?= $(KEYBOARD)_$(KEYMAP)
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
BUILD_DIR = .build
 | 
					
 | 
				
			||||||
 | 
					BUILD_DIR = $(TOP_DIR)/.build
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Object files directory
 | 
					# Object files directory
 | 
				
			||||||
#     To put object files in current directory, use a dot (.), do NOT make
 | 
					#     To put object files in current directory, use a dot (.), do NOT make
 | 
				
			||||||
| 
						 | 
					@ -265,4 +271,6 @@ include $(TMK_PATH)/rules.mk
 | 
				
			||||||
GIT_VERSION := $(shell git describe --abbrev=6 --dirty --always --tags 2>/dev/null || date +"%Y-%m-%d-%H:%M:%S")
 | 
					GIT_VERSION := $(shell git describe --abbrev=6 --dirty --always --tags 2>/dev/null || date +"%Y-%m-%d-%H:%M:%S")
 | 
				
			||||||
BUILD_DATE := $(shell date +"%Y-%m-%d-%H:%M:%S")
 | 
					BUILD_DATE := $(shell date +"%Y-%m-%d-%H:%M:%S")
 | 
				
			||||||
OPT_DEFS += -DQMK_KEYBOARD=\"$(KEYBOARD)\" -DQMK_KEYMAP=\"$(KEYMAP)\"
 | 
					OPT_DEFS += -DQMK_KEYBOARD=\"$(KEYBOARD)\" -DQMK_KEYMAP=\"$(KEYMAP)\"
 | 
				
			||||||
OPT_DEFS += -DQMK_VERSION=\"$(GIT_VERSION)\" -DQMK_BUILDDATE=\"$(BUILD_DATE)\"
 | 
					
 | 
				
			||||||
 | 
					$(shell echo '#define QMK_VERSION "$(GIT_VERSION)"' > $(QUANTUM_PATH)/version.h)
 | 
				
			||||||
 | 
					$(shell echo '#define QMK_BUILDDATE "$(BUILD_DATE)"' >> $(QUANTUM_PATH)/version.h)
 | 
				
			||||||
| 
						 | 
					@ -12,6 +12,7 @@
 | 
				
			||||||
#include "keymap_plover.h"
 | 
					#include "keymap_plover.h"
 | 
				
			||||||
#include "eeconfig.h"
 | 
					#include "eeconfig.h"
 | 
				
			||||||
#include "wait.h"
 | 
					#include "wait.h"
 | 
				
			||||||
 | 
					#include "version.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Layers */
 | 
					/* Layers */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,7 @@
 | 
				
			||||||
#include "ergodox.h"
 | 
					#include "ergodox.h"
 | 
				
			||||||
#include "debug.h"
 | 
					#include "debug.h"
 | 
				
			||||||
#include "action_layer.h"
 | 
					#include "action_layer.h"
 | 
				
			||||||
 | 
					#include "version.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define BASE 0 // default layer
 | 
					#define BASE 0 // default layer
 | 
				
			||||||
#define SYMB 1 // symbols
 | 
					#define SYMB 1 // symbols
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,7 @@
 | 
				
			||||||
#include "ergodox.h"
 | 
					#include "ergodox.h"
 | 
				
			||||||
#include "debug.h"
 | 
					#include "debug.h"
 | 
				
			||||||
#include "action_layer.h"
 | 
					#include "action_layer.h"
 | 
				
			||||||
 | 
					#include "version.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define BASE 0 // default layer
 | 
					#define BASE 0 // default layer
 | 
				
			||||||
#define SYMB 1 // symbols
 | 
					#define SYMB 1 // symbols
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,6 +4,7 @@
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#include "config.h"
 | 
					#include "config.h"
 | 
				
			||||||
#include "quantum.h"
 | 
					#include "quantum.h"
 | 
				
			||||||
 | 
					#include "version.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Each layer is given a name to aid in readability, which is then
 | 
					/* Each layer is given a name to aid in readability, which is then
 | 
				
			||||||
   used in the keymap matrix below.  The underscores do not denote 
 | 
					   used in the keymap matrix below.  The underscores do not denote 
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,6 +8,7 @@
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "eeconfig.h"
 | 
					#include "eeconfig.h"
 | 
				
			||||||
 | 
					#include "version.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern keymap_config_t keymap_config;
 | 
					extern keymap_config_t keymap_config;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -122,17 +122,16 @@ Below are some definitions that will be useful:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Below is a list of the useful `make` commands in QMK:
 | 
					Below is a list of the useful `make` commands in QMK:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* `make` - cleans automatically and builds your keyboard and keymap depending on which folder you're in. This defaults to the "default" layout (unless in a keymap folder), and Planck keyboard in the root folder
 | 
					* `make` - builds your keyboard and keymap depending on which folder you're in. This defaults to the "default" layout (unless in a keymap folder), and Planck keyboard in the root folder
 | 
				
			||||||
  * `make keyboard=<keyboard>` - specifies the keyboard (only to be used in root)
 | 
					  * `make keyboard=<keyboard>` - specifies the keyboard (only to be used in root)
 | 
				
			||||||
  * `make keymap=<keymap>` - specifies the keymap (only to be used in root and keyboard folder - not needed when in keymap folder)
 | 
					  * `make keymap=<keymap>` - specifies the keymap (only to be used in root and keyboard folder - not needed when in keymap folder)
 | 
				
			||||||
* `make quick` - skips the clean step (cannot be used immediately after modifying config.h or Makefiles)
 | 
					* `make clean` - cleans the `.build` folder, ensuring that everything is re-built
 | 
				
			||||||
* `make dfu` - (requires dfu-programmer) builds and flashes the keymap to your keyboard once placed in reset/dfu mode (button or press `KC_RESET`). This does not work for Teensy-based keyboards like the ErgoDox EZ.
 | 
					* `make dfu` - (requires dfu-programmer) builds and flashes the keymap to your keyboard once placed in reset/dfu mode (button or press `KC_RESET`). This does not work for Teensy-based keyboards like the ErgoDox EZ.
 | 
				
			||||||
  * `keyboard=` and `keymap=` are compatible with this
 | 
					  * `keyboard=` and `keymap=` are compatible with this
 | 
				
			||||||
* `make all-keyboards` - builds all keymaps for all keyboards and outputs status of each (use in root)
 | 
					* `make all-keyboards` - builds all keymaps for all keyboards and outputs status of each (use in root)
 | 
				
			||||||
* `make all-keyboards-default` - builds all default keymaps for all keyboards and outputs status of each (use in root)
 | 
					* `make all-keyboards-default` - builds all default keymaps for all keyboards and outputs status of each (use in root)
 | 
				
			||||||
* `make all-keymaps [keyboard=<keyboard>]` - builds all of the keymaps for whatever keyboard folder you're in, or specified by `<keyboard>`
 | 
					* `make all-keymaps [keyboard=<keyboard>]` - builds all of the keymaps for whatever keyboard folder you're in, or specified by `<keyboard>`
 | 
				
			||||||
* `make all-keyboards-quick`, `make all-keyboards-default-quick` and `make all-keymaps-quick [keyboard=<keyboard>]` - like the normal "make-all-*" commands, but they skip the clean steps
 | 
					* `make all-keyboards-*`, `make all-keyboards-default-*` and `make all-keymaps-* [keyboard=<keyboard>]` - like the normal "make-all-*" commands, but the last string aftter the `-` (for example clean) is passed to the keyboard make command.
 | 
				
			||||||
 | 
					 | 
				
			||||||
Other, less useful functionality:
 | 
					Other, less useful functionality:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* `make COLOR=false` - turns off color output
 | 
					* `make COLOR=false` - turns off color output
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,6 +15,16 @@
 | 
				
			||||||
# Carlos Lamas
 | 
					# Carlos Lamas
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Enable vpath seraching for source files only
 | 
				
			||||||
 | 
					# Without this, output files, could be read from the wrong .build directories
 | 
				
			||||||
 | 
					VPATH_SRC := $(VPATH)
 | 
				
			||||||
 | 
					vpath %.c $(VPATH_SRC)
 | 
				
			||||||
 | 
					vpath %.h $(VPATH_SRC)
 | 
				
			||||||
 | 
					vpath %.cpp $(VPATH_SRC)
 | 
				
			||||||
 | 
					vpath %.hpp $(VPATH_SRC)
 | 
				
			||||||
 | 
					vpath %.S $(VPATH_SRC)
 | 
				
			||||||
 | 
					VPATH :=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Output format. (can be srec, ihex, binary)
 | 
					# Output format. (can be srec, ihex, binary)
 | 
				
			||||||
FORMAT = ihex
 | 
					FORMAT = ihex
 | 
				
			||||||
| 
						 | 
					@ -35,11 +45,6 @@ ifeq ($(COLOR),true)
 | 
				
			||||||
	BOLD=\033[1m
 | 
						BOLD=\033[1m
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ifdef quick
 | 
					 | 
				
			||||||
	QUICK = $(quick)
 | 
					 | 
				
			||||||
endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
QUICK ?= false
 | 
					 | 
				
			||||||
AUTOGEN ?= false
 | 
					AUTOGEN ?= false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ifneq ($(shell awk --version 2>/dev/null),)
 | 
					ifneq ($(shell awk --version 2>/dev/null),)
 | 
				
			||||||
| 
						 | 
					@ -71,7 +76,7 @@ BUILD_CMD = LOG=$$($(CMD) 2>&1) ; if [ $$? -gt 0 ]; then $(PRINT_ERROR); elif [
 | 
				
			||||||
#     Each directory must be seperated by a space.
 | 
					#     Each directory must be seperated by a space.
 | 
				
			||||||
#     Use forward slashes for directory separators.
 | 
					#     Use forward slashes for directory separators.
 | 
				
			||||||
#     For a directory that has spaces, enclose it in quotes.
 | 
					#     For a directory that has spaces, enclose it in quotes.
 | 
				
			||||||
EXTRAINCDIRS += $(subst :, ,$(VPATH))
 | 
					EXTRAINCDIRS += $(subst :, ,$(VPATH_SRC))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Compiler flag to set the C Standard level.
 | 
					# Compiler flag to set the C Standard level.
 | 
				
			||||||
| 
						 | 
					@ -268,22 +273,21 @@ LST = $(patsubst %.c,$(OBJDIR)/%.lst,$(patsubst %.cpp,$(OBJDIR)/%.lst,$(patsubst
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Compiler flags to generate dependency files.
 | 
					# Compiler flags to generate dependency files.
 | 
				
			||||||
#GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
 | 
					#GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
 | 
				
			||||||
GENDEPFLAGS = -MMD -MP -MF $(BUILD_DIR)/.dep/$(subst /,_,$(subst $(BUILD_DIR)/,,$@)).d
 | 
					GENDEPFLAGS = -MMD -MP -MF $(patsubst %.o,%.td,$@)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Combine all necessary flags and optional flags.
 | 
					# Combine all necessary flags and optional flags.
 | 
				
			||||||
# Add target processor to flags.
 | 
					# Add target processor to flags.
 | 
				
			||||||
# You can give extra flags at 'make' command line like: make EXTRAFLAGS=-DFOO=bar
 | 
					# You can give extra flags at 'make' command line like: make EXTRAFLAGS=-DFOO=bar
 | 
				
			||||||
ALL_CFLAGS = $(MCUFLAGS) $(CFLAGS) $(GENDEPFLAGS) $(EXTRAFLAGS)
 | 
					ALL_CFLAGS = $(MCUFLAGS) $(CFLAGS) $(EXTRAFLAGS)
 | 
				
			||||||
ALL_CPPFLAGS = $(MCUFLAGS) -x c++ $(CPPFLAGS) $(GENDEPFLAGS) $(EXTRAFLAGS)
 | 
					ALL_CPPFLAGS = $(MCUFLAGS) -x c++ $(CPPFLAGS) $(EXTRAFLAGS)
 | 
				
			||||||
ALL_ASFLAGS = $(MCUFLAGS) -x assembler-with-cpp $(ASFLAGS) $(EXTRAFLAGS)
 | 
					ALL_ASFLAGS = $(MCUFLAGS) -x assembler-with-cpp $(ASFLAGS) $(EXTRAFLAGS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					MOVE_DEP = mv -f $(patsubst %.o,%.td,$@) $(patsubst %.o,%.d,$@)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Default target.
 | 
					# Default target.
 | 
				
			||||||
all: build sizeafter
 | 
					all: build sizeafter
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Quick make that doesn't clean
 | 
					 | 
				
			||||||
quick: build sizeafter
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Change the build target to build a HEX file or a library.
 | 
					# Change the build target to build a HEX file or a library.
 | 
				
			||||||
build: elf hex
 | 
					build: elf hex
 | 
				
			||||||
#build: elf hex eep lss sym
 | 
					#build: elf hex eep lss sym
 | 
				
			||||||
| 
						 | 
					@ -373,35 +377,62 @@ BEGIN = gccversion check_submodule sizebefore
 | 
				
			||||||
# Link: create ELF output file from object files.
 | 
					# Link: create ELF output file from object files.
 | 
				
			||||||
.SECONDARY : $(BUILD_DIR)/$(TARGET).elf
 | 
					.SECONDARY : $(BUILD_DIR)/$(TARGET).elf
 | 
				
			||||||
.PRECIOUS : $(OBJ)
 | 
					.PRECIOUS : $(OBJ)
 | 
				
			||||||
%.elf: $(OBJ) | $(BEGIN)
 | 
					# Note the obj.txt depeendency is there to force linking if a source file is deleted
 | 
				
			||||||
 | 
					%.elf: $(OBJ) $(OBJDIR)/cflags.txt $(OBJDIR)/ldflags.txt $(OBJDIR)/obj.txt | $(BEGIN)
 | 
				
			||||||
	@$(SILENT) || printf "$(MSG_LINKING) $@" | $(AWK_CMD)
 | 
						@$(SILENT) || printf "$(MSG_LINKING) $@" | $(AWK_CMD)
 | 
				
			||||||
	$(eval CMD=$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS))
 | 
						$(eval CMD=$(CC) $(ALL_CFLAGS) $(filter-out %.txt,$^) --output $@ $(LDFLAGS))
 | 
				
			||||||
	@$(BUILD_CMD)
 | 
						@$(BUILD_CMD)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
define GEN_OBJRULE
 | 
					define GEN_OBJRULE
 | 
				
			||||||
# Compile: create object files from C source files.
 | 
					# Compile: create object files from C source files.
 | 
				
			||||||
$1/%.o : %.c | $(BEGIN)
 | 
					$1/%.o : %.c $1/%.d $1/cflags.txt $1/compiler.txt | $(BEGIN)
 | 
				
			||||||
	@mkdir -p $$(@D)
 | 
						@mkdir -p $$(@D)
 | 
				
			||||||
	@$$(SILENT) || printf "$$(MSG_COMPILING) $$<" | $$(AWK_CMD)
 | 
						@$$(SILENT) || printf "$$(MSG_COMPILING) $$<" | $$(AWK_CMD)
 | 
				
			||||||
	$$(eval CMD=$$(CC) -c $$(ALL_CFLAGS) $$< -o $$@)
 | 
						$$(eval CMD=$$(CC) -c $$(ALL_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
 | 
				
			||||||
	@$$(BUILD_CMD)
 | 
						@$$(BUILD_CMD)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Compile: create object files from C++ source files.
 | 
					# Compile: create object files from C++ source files.
 | 
				
			||||||
$1/%.o : %.cpp | $(BEGIN)
 | 
					$1/%.o : %.cpp $1/%.d $1/cppflags.txt $1/compiler.txt | $(BEGIN)
 | 
				
			||||||
	@mkdir -p $$(@D)
 | 
						@mkdir -p $$(@D)
 | 
				
			||||||
	@$$(SILENT) || printf "$$(MSG_COMPILING_CPP) $$<" | $$(AWK_CMD)
 | 
						@$$(SILENT) || printf "$$(MSG_COMPILING_CPP) $$<" | $$(AWK_CMD)
 | 
				
			||||||
	$$(eval CMD=$$(CC) -c $$(ALL_CPPFLAGS) $$< -o $$@)
 | 
						$$(eval CMD=$$(CC) -c $$(ALL_CPPFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
 | 
				
			||||||
	@$(BUILD_CMD)
 | 
						@$(BUILD_CMD)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Assemble: create object files from assembler source files.
 | 
					# Assemble: create object files from assembler source files.
 | 
				
			||||||
$1/%.o : %.S | $(BEGIN)
 | 
					$1/%.o : %.S $1/asflags.txt $1/compiler.txt | $(BEGIN)
 | 
				
			||||||
	@mkdir -p $$(@D)
 | 
						@mkdir -p $$(@D)
 | 
				
			||||||
	@$(SILENT) || printf "$$(MSG_ASSEMBLING) $$<" | $$(AWK_CMD)
 | 
						@$(SILENT) || printf "$$(MSG_ASSEMBLING) $$<" | $$(AWK_CMD)
 | 
				
			||||||
	$$(eval CMD=$$(CC) -c $$(ALL_ASFLAGS) $$< -o $$@)
 | 
						$$(eval CMD=$$(CC) -c $$(ALL_ASFLAGS) $$< -o $$@)
 | 
				
			||||||
	@$$(BUILD_CMD)
 | 
						@$$(BUILD_CMD)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					$1/force:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					$1/cflags.txt: $1/force
 | 
				
			||||||
 | 
						echo '$$(ALL_CFLAGS)' | cmp -s - $$@ || echo '$$(ALL_CFLAGS)' > $$@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					$1/cppflags.txt: $1/force
 | 
				
			||||||
 | 
						echo '$$(ALL_CPPFLAGS)' | cmp -s - $$@ || echo '$$(ALL_CPPFLAGS)' > $$@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					$1/asflags.txt: $1/force
 | 
				
			||||||
 | 
						echo '$$(ALL_ASFLAGS)' | cmp -s - $$@ || echo '$$(ALL_ASFLAGS)' > $$@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					$1/ldflags.txt: $1/force
 | 
				
			||||||
 | 
						echo '$$(LDFLAGS)' | cmp -s - $$@ || echo '$$(LDFLAGS)' > $$@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					$1/obj.txt: $1/force
 | 
				
			||||||
 | 
						echo '$$(OBJ)' | cmp -s - $$@ || echo '$$(OBJ)' > $$@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					$1/compiler.txt: $1/force
 | 
				
			||||||
 | 
						$$(CC) --version | cmp -s - $$@ || $$(CC) --version > $$@
 | 
				
			||||||
endef
 | 
					endef
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# We have to use static rules for the .d files for some reason
 | 
				
			||||||
 | 
					DEPS = $(patsubst %.o,%.d,$(OBJ))
 | 
				
			||||||
 | 
					# Keep the .d files
 | 
				
			||||||
 | 
					.PRECIOUS: $(DEPS)
 | 
				
			||||||
 | 
					# Empty rule to force recompilation if the .d file is missing
 | 
				
			||||||
 | 
					$(DEPS):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Since the object files could be in two different folders, generate
 | 
					# Since the object files could be in two different folders, generate
 | 
				
			||||||
# separate rules for them, rather than having too generic rules
 | 
					# separate rules for them, rather than having too generic rules
 | 
				
			||||||
$(eval $(call GEN_OBJRULE,$(OBJDIR)))
 | 
					$(eval $(call GEN_OBJRULE,$(OBJDIR)))
 | 
				
			||||||
| 
						 | 
					@ -425,6 +456,9 @@ $(eval $(call GEN_OBJRULE,$(KBOBJDIR)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Target: clean project.
 | 
					# Target: clean project.
 | 
				
			||||||
clean:
 | 
					clean:
 | 
				
			||||||
 | 
						$(REMOVE) -r $(OBJDIR) 2>/dev/null
 | 
				
			||||||
 | 
						$(REMOVE) -r $(KBOBJDIR) 2>/dev/null
 | 
				
			||||||
 | 
						$(REMOVE) $(BUILD_DIR)/$(TARGET).*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
show_path:
 | 
					show_path:
 | 
				
			||||||
	@echo VPATH=$(VPATH)
 | 
						@echo VPATH=$(VPATH)
 | 
				
			||||||
| 
						 | 
					@ -444,7 +478,6 @@ all-keyboards-defaults: all-keyboards-defaults-all
 | 
				
			||||||
 | 
					
 | 
				
			||||||
KEYBOARDS := $(SUBDIRS:$(TOP_DIR)/keyboards/%/=/keyboards/%)
 | 
					KEYBOARDS := $(SUBDIRS:$(TOP_DIR)/keyboards/%/=/keyboards/%)
 | 
				
			||||||
all-keyboards-all: $(addsuffix -all,$(KEYBOARDS))
 | 
					all-keyboards-all: $(addsuffix -all,$(KEYBOARDS))
 | 
				
			||||||
all-keyboards-quick: $(addsuffix -quick,$(KEYBOARDS))
 | 
					 | 
				
			||||||
all-keyboards-clean: $(addsuffix -clean,$(KEYBOARDS))
 | 
					all-keyboards-clean: $(addsuffix -clean,$(KEYBOARDS))
 | 
				
			||||||
all-keyboards: all-keyboards-all
 | 
					all-keyboards: all-keyboards-all
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -461,12 +494,10 @@ done
 | 
				
			||||||
endef
 | 
					endef
 | 
				
			||||||
 | 
					
 | 
				
			||||||
define make_keyboard_helper
 | 
					define make_keyboard_helper
 | 
				
			||||||
# Just remove the -quick, -all and so on from the first argument and pass it forward
 | 
					# Just remove the -all and so on from the first argument and pass it forward
 | 
				
			||||||
$(call make_keyboard,$(subst -$2,,$1),$2)
 | 
					$(call make_keyboard,$(subst -$2,,$1),$2)
 | 
				
			||||||
endef
 | 
					endef
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/keyboards/%-quick:
 | 
					 | 
				
			||||||
	$(call make_keyboard_helper,$@,quick)
 | 
					 | 
				
			||||||
/keyboards/%-all:
 | 
					/keyboards/%-all:
 | 
				
			||||||
	$(call make_keyboard_helper,$@,all)
 | 
						$(call make_keyboard_helper,$@,all)
 | 
				
			||||||
/keyboards/%-clean:
 | 
					/keyboards/%-clean:
 | 
				
			||||||
| 
						 | 
					@ -484,19 +515,6 @@ all-keymaps-%:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
all-keymaps: all-keymaps-all
 | 
					all-keymaps: all-keymaps-all
 | 
				
			||||||
 | 
					
 | 
				
			||||||
GOAL=$(MAKECMDGOALS)
 | 
					 | 
				
			||||||
ifeq ($(MAKECMDGOALS),)
 | 
					 | 
				
			||||||
GOAL = all
 | 
					 | 
				
			||||||
endif
 | 
					 | 
				
			||||||
CLEANING_GOALS=clean clean_list all
 | 
					 | 
				
			||||||
ifneq ($(findstring $(GOAL),$(CLEANING_GOALS)),)
 | 
					 | 
				
			||||||
$(shell $(REMOVE) -r $(BUILD_DIR) 2>/dev/null)
 | 
					 | 
				
			||||||
$(shell $(REMOVE) -r $(TOP_DIR)/$(BUILD_DIR))
 | 
					 | 
				
			||||||
$(shell $(REMOVE) -r $(KEYBOARD_PATH)/$(BUILD_DIR))
 | 
					 | 
				
			||||||
$(shell if $$SUBPROJECT; then $(REMOVE) -r $(SUBPROJECT_PATH)/$(BUILD_DIR); fi)
 | 
					 | 
				
			||||||
$(shell $(REMOVE) -r $(KEYMAP_PATH)/$(BUILD_DIR))
 | 
					 | 
				
			||||||
endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Create build directory
 | 
					# Create build directory
 | 
				
			||||||
$(shell mkdir $(BUILD_DIR) 2>/dev/null)
 | 
					$(shell mkdir $(BUILD_DIR) 2>/dev/null)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -505,11 +523,11 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
 | 
				
			||||||
$(shell mkdir $(KBOBJDIR) 2>/dev/null)
 | 
					$(shell mkdir $(KBOBJDIR) 2>/dev/null)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Include the dependency files.
 | 
					# Include the dependency files.
 | 
				
			||||||
-include $(shell mkdir $(BUILD_DIR)/.dep 2>/dev/null) $(wildcard $(BUILD_DIR)/.dep/*)
 | 
					-include $(patsubst %.o,%.d,$(OBJ))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Listing of phony targets.
 | 
					# Listing of phony targets.
 | 
				
			||||||
.PHONY : all quick finish sizebefore sizeafter gccversion \
 | 
					.PHONY : all finish sizebefore sizeafter gccversion \
 | 
				
			||||||
build elf hex eep lss sym coff extcoff check_submodule \
 | 
					build elf hex eep lss sym coff extcoff check_submodule \
 | 
				
			||||||
clean clean_list debug gdb-config show_path \
 | 
					clean clean_list debug gdb-config show_path \
 | 
				
			||||||
program teensy dfu flip dfu-ee flip-ee dfu-start \
 | 
					program teensy dfu flip dfu-ee flip-ee dfu-start \
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue