Skip to content

Commit

Permalink
Build warning when not valid work-tree (#19475)
Browse files Browse the repository at this point in the history
  • Loading branch information
zvecr authored Jan 2, 2023
1 parent b297531 commit 4b2fd42
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -394,8 +399,11 @@ endef
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
# Check if the submodules are dirty, and display a warning if they are
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
Expand Down
2 changes: 2 additions & 0 deletions builddefs/message.mk
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ MSG_ASSEMBLING = Assembling:
MSG_CLEANING = Cleaning project:
MSG_CREATING_LIBRARY = Creating library:
MSG_GENERATING = Generating:
MSG_NOT_REPO = $(WARN_COLOR)WARNING:$(NO_COLOR) Target folder is not a git repo, you probably downloaded a zip file instead of cloning.\n\
Please consider following $(BOLD)https://docs.qmk.fm/\#/newbs_getting_started$(NO_COLOR).\n\n
MSG_SUBMODULE_DIRTY = $(WARN_COLOR)WARNING:$(NO_COLOR) Some git submodules are out of date or modified.\n\
Please consider running $(BOLD)qmk git-submodule$(NO_COLOR).\n\n
MSG_NO_CMP = $(ERROR_COLOR)Error:$(NO_COLOR)$(BOLD) cmp command not found, please install diffutils\n$(NO_COLOR)
Expand Down

0 comments on commit 4b2fd42

Please sign in to comment.