summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorToni <jeder@mail1a.de>2016-08-13 09:24:24 +0200
committerToni <jeder@mail1a.de>2016-08-13 09:24:24 +0200
commite0aa2169055f554a3cb87208b1e73a6b2707405b (patch)
tree6c74a1f7284f385b99a231ef0c1c805fab1083e5 /Makefile
parentcafa528b88c097f02ae92a5b15b015f5653cefe7 (diff)
parent098951905d527c19043de75ef262ac9679ec452b (diff)
downloadqmk_firmware-e0aa2169055f554a3cb87208b1e73a6b2707405b.tar.gz
qmk_firmware-e0aa2169055f554a3cb87208b1e73a6b2707405b.zip
Merge remote-tracking branch 'origin/master' into iso_split_rshift
update from Upstream
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile30
1 files changed, 19 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 980ab26b22..053c8532af 100644
--- a/Makefile
+++ b/Makefile
@@ -5,8 +5,9 @@ endif
.DEFAULT_GOAL := all
space := $(subst ,, )
-starting_makefile := $(subst $(space),_SPACE_,$(abspath $(firstword $(MAKEFILE_LIST))))
-mkfile_path := $(subst $(space),_SPACE_,$(abspath $(lastword $(MAKEFILE_LIST))))
+ESCAPED_ABS_PATH = $(subst $(space),_SPACE_,$(abspath $1))
+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)))
ifneq (,$(findstring /keyboards/,$(starting_makefile)))
@@ -83,10 +84,8 @@ endif
ifneq ("$(wildcard $(KEYBOARD_PATH)/$(KEYBOARD).c)","")
KEYBOARD_FILE = keyboards/$(KEYBOARD)/$(KEYBOARD).c
- ifndef ARCH
- ifneq ("$(wildcard $(KEYBOARD_PATH)/Makefile)","")
- include $(KEYBOARD_PATH)/Makefile
- endif
+ ifneq ($(call ESCAPED_ABS_PATH,$(KEYBOARD_PATH)/Makefile),$(starting_makefile))
+ -include $(KEYBOARD_PATH)/Makefile
endif
else
$(error "$(KEYBOARD_PATH)/$(KEYBOARD).c" does not exist)
@@ -101,7 +100,9 @@ ifdef SUBPROJECT
ifneq ("$(wildcard $(SUBPROJECT_PATH)/$(SUBPROJECT).c)","")
OPT_DEFS += -DSUBPROJECT_$(SUBPROJECT)
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
$(error "$(SUBPROJECT_PATH)/$(SUBPROJECT).c" does not exist)
endif
@@ -119,14 +120,18 @@ endif
KEYMAP_PATH = $(KEYBOARD_PATH)/keymaps/$(KEYMAP)
ifneq ("$(wildcard $(KEYMAP_PATH)/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
ifeq ("$(wildcard $(SUBPROJECT_PATH)/keymaps/$(KEYMAP)/keymap.c)","")
$(error "$(KEYMAP_PATH)/keymap.c" does not exist)
else
KEYMAP_PATH = $(SUBPROJECT_PATH)/keymaps/$(KEYMAP)
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
@@ -135,7 +140,8 @@ ifdef SUBPROJECT
else
TARGET ?= $(KEYBOARD)_$(KEYMAP)
endif
-BUILD_DIR = .build
+
+BUILD_DIR = $(TOP_DIR)/.build
# Object files directory
# 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")
BUILD_DATE := $(shell date +"%Y-%m-%d-%H:%M:%S")
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) \ No newline at end of file