]> granicus.if.org Git - esp-idf/commitdiff
make: remove build system dependency on `git` using some hooks
authorMahavir Jain <mahavir@espressif.com>
Tue, 10 Apr 2018 03:20:59 +0000 (08:50 +0530)
committerMahavir Jain <mahavir@espressif.com>
Fri, 13 Apr 2018 11:43:44 +0000 (17:13 +0530)
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 <mahavir@espressif.com>
make/project.mk

index 36cfce7205617083646c3e1e2b8a21f7e71932c3..ff7aa6ed4489d0c55e1b00dbbb451553e946e1cd 100644 (file)
@@ -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