summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile52
1 files changed, 18 insertions, 34 deletions
diff --git a/Makefile b/Makefile
index 99339192e1..22322fbf93 100644
--- a/Makefile
+++ b/Makefile
@@ -19,8 +19,13 @@ endif
# Otherwise the [OK], [ERROR] and [WARN] messages won't be displayed correctly
override SILENT := false
+ifeq ($(shell git rev-parse --is-inside-work-tree 2>/dev/null),)
+ export SKIP_GIT := yes
+ export NOT_REPO := yes
+endif
+
ifdef SKIP_VERSION
- SKIP_GIT := yes
+ export SKIP_GIT := yes
endif
ifndef SUB_IS_SILENT
@@ -43,17 +48,10 @@ ON_ERROR := error_occurred=1
BREAK_ON_ERRORS = no
-STARTING_MAKEFILE := $(firstword $(MAKEFILE_LIST))
-ROOT_MAKEFILE := $(lastword $(MAKEFILE_LIST))
-ROOT_DIR := $(dir $(ROOT_MAKEFILE))
+ROOT_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
ifeq ($(ROOT_DIR),)
ROOT_DIR := .
endif
-ABS_STARTING_MAKEFILE := $(abspath $(STARTING_MAKEFILE))
-ABS_ROOT_MAKEFILE := $(abspath $(ROOT_MAKEFILE))
-ABS_STARTING_DIR := $(dir $(ABS_STARTING_MAKEFILE))
-ABS_ROOT_DIR := $(dir $(ABS_ROOT_MAKEFILE))
-STARTING_DIR := $(subst $(ABS_ROOT_DIR),,$(ABS_STARTING_DIR))
include paths.mk
@@ -148,7 +146,7 @@ define PARSE_RULE
$$(eval $$(call PARSE_TEST))
# If the rule starts with the name of a known keyboard, then continue
# the parsing from PARSE_KEYBOARD
- else ifeq ($$(call TRY_TO_MATCH_RULE_FROM_LIST,$$(shell util/list_keyboards.sh | sort -u)),true)
+ else ifeq ($$(call TRY_TO_MATCH_RULE_FROM_LIST,$$(shell $(QMK_BIN) list-keyboards --no-resolve-defaults)),true)
KEYBOARD_RULE=$$(MATCHED_ITEM)
$$(eval $$(call PARSE_KEYBOARD,$$(MATCHED_ITEM)))
else
@@ -241,7 +239,7 @@ endef
# if we are going to compile all keyboards, match the rest of the rule
# for each of them
define PARSE_ALL_KEYBOARDS
- $$(eval $$(call PARSE_ALL_IN_LIST,PARSE_KEYBOARD,$(shell util/list_keyboards.sh | sort -u)))
+ $$(eval $$(call PARSE_ALL_IN_LIST,PARSE_KEYBOARD,$(shell $(QMK_BIN) list-keyboards --no-resolve-defaults)))
endef
# Prints a list of all known keymaps for the given keyboard
@@ -390,25 +388,15 @@ endef
# Catch everything and parse the command line ourselves.
.PHONY: %
%:
- # Check if we have the CMP tool installed
- cmp $(ROOT_DIR)/Makefile $(ROOT_DIR)/Makefile >/dev/null 2>&1; if [ $$? -gt 0 ]; then printf "$(MSG_NO_CMP)"; exit 1; fi;
# Ensure that $(QMK_BIN) works.
if ! $(QMK_BIN) hello 1> /dev/null 2>&1; then printf "$(MSG_PYTHON_MISSING)"; exit 1; fi
- # Check if the submodules are dirty, and display a warning if they are
+ifdef NOT_REPO
+ printf "$(MSG_NOT_REPO)"
+endif
ifndef SKIP_GIT
- if [ ! -e lib/chibios ]; then git submodule sync lib/chibios && git submodule update --depth 50 --init lib/chibios; fi
- if [ ! -e lib/chibios-contrib ]; then git submodule sync lib/chibios-contrib && git submodule update --depth 50 --init lib/chibios-contrib; fi
- if [ ! -e lib/lufa ]; then git submodule sync lib/lufa && git submodule update --depth 50 --init lib/lufa; fi
- if [ ! -e lib/vusb ]; then git submodule sync lib/vusb && git submodule update --depth 50 --init lib/vusb; fi
- if [ ! -e lib/printf ]; then git submodule sync lib/printf && git submodule update --depth 50 --init lib/printf; fi
- if [ ! -e lib/pico-sdk ]; then git submodule sync lib/pico-sdk && git submodule update --depth 50 --init lib/pico-sdk; fi
- git submodule status --recursive 2>/dev/null | \
- while IFS= read -r x; do \
- case "$$x" in \
- \ *) ;; \
- *) printf "$(MSG_SUBMODULE_DIRTY)";break;; \
- esac \
- done
+ $(QMK_BIN) git-submodule --sync
+ # Check if the submodules are dirty, and display a warning if they are
+ if ! $(QMK_BIN) git-submodule --check 1> /dev/null 2>&1; then printf "$(MSG_SUBMODULE_DIRTY)"; fi
endif
rm -f $(ERROR_FILE) > /dev/null 2>&1
$(eval $(call PARSE_RULE,$@))
@@ -429,22 +417,18 @@ lib/%:
.PHONY: git-submodule
git-submodule:
- [ -e lib/ugfx ] && rm -rf lib/ugfx || true
- [ -e lib/pico-sdk ] && rm -rf lib/pico-sdk || true
- [ -e lib/chibios-contrib/ext/mcux-sdk ] && rm -rf lib/chibios-contrib/ext/mcux-sdk || true
- git submodule sync --recursive
- git submodule update --init --recursive --progress
+ $(QMK_BIN) git-submodule
.PHONY: git-submodules
git-submodules: git-submodule
.PHONY: list-keyboards
list-keyboards:
- util/list_keyboards.sh | sort -u | tr '\n' ' '
+ $(QMK_BIN) list-keyboards --no-resolve-defaults | tr '\n' ' '
.PHONY: generate-keyboards-file
generate-keyboards-file:
- util/list_keyboards.sh | sort -u
+ $(QMK_BIN) list-keyboards --no-resolve-defaults
.PHONY: clean
clean: