From: Mahavir Jain Date: Tue, 10 Apr 2018 03:20:59 +0000 (+0530) Subject: make: remove build system dependency on `git` using some hooks X-Git-Tag: v3.1-beta1~244^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=344e757a6a1faaadae863a3b52c84c8b6091a70d;p=esp-idf make: remove build system dependency on `git` using some hooks Currently for checking IDF version and submodules existence, build system uses `git` commands. But, it could be possible use-case where `git` is not installed (assuming IDF is flattened in source format) on system and build happens without any warnings. Signed-off-by: Mahavir Jain --- diff --git a/make/project.mk b/make/project.mk index 36cfce7205..ff7aa6ed44 100644 --- a/make/project.mk +++ b/make/project.mk @@ -227,7 +227,12 @@ endif @echo $(ESPTOOLPY_WRITE_FLASH) $(ESPTOOL_ALL_FLASH_ARGS) +# If we have `version.txt` then prefer that for extracting IDF version +ifeq ("$(wildcard ${IDF_PATH}/version.txt)","") IDF_VER := $(shell cd ${IDF_PATH} && git describe --always --tags --dirty) +else +IDF_VER := `cat ${IDF_PATH}/version.txt` +endif # Set default LDFLAGS EXTRA_LDFLAGS ?= @@ -485,6 +490,8 @@ clean: app-clean bootloader-clean config-clean # # This only works for components inside IDF_PATH check-submodules: +# Check if .gitmodules exists, otherwise skip submodule check, assuming flattened structure +ifneq ("$(wildcard ${IDF_PATH}/.gitmodules)","") # Dump the git status for the whole working copy once, then grep it for each submodule. This saves a lot of time on Windows. GIT_STATUS := $(shell cd ${IDF_PATH} && git status --porcelain --ignore-submodules=dirty) @@ -509,6 +516,7 @@ endef # filter/subst in expression ensures all submodule paths begin with $(IDF_PATH), and then strips that prefix # so the argument is suitable for use with 'git submodule' commands $(foreach submodule,$(subst $(IDF_PATH)/,,$(filter $(IDF_PATH)/%,$(COMPONENT_SUBMODULES))),$(eval $(call GenerateSubmoduleCheckTarget,$(submodule)))) +endif # End check for .gitmodules existence # PHONY target to list components in the build and their paths