Initialize a Git repository in the SDK and use git reset / git clean
to rollback any SDK changes with "make clean" or "make dirclean".
This approach is more robust than nuking entire directory trees because
some parts of them might have been shipped with the original archive.
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@43904
3c298f89-4303-0410-b956-
a3cf2f4a3e73
kernel_nconfig: prepare_kernel_conf
$(_SINGLE)$(NO_TRACE_MAKE) -C target/linux nconfig
kernel_nconfig: prepare_kernel_conf
$(_SINGLE)$(NO_TRACE_MAKE) -C target/linux nconfig
-tmp/.prereq-build: include/prereq-build.mk
+tmp/.prereq-build: $(if $(SDK),.git/config) include/prereq-build.mk
mkdir -p tmp
rm -f tmp/.host.mk
@$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \
mkdir -p tmp
rm -f tmp/.host.mk
@$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \
+# Initialize SDK snapshot
+.git/config:
+ @( \
+ echo -n "Initializing SDK ... "; \
+ git init -q .; \
+ find . -mindepth 1 -maxdepth 1 -not -name feeds | xargs git add; \
+ git commit -q -m "Initial state"; \
+ echo "ok."; \
+ )
+
include $(TOPDIR)/include/host.mk
ifneq ($(OPENWRT_BUILD),1)
include $(TOPDIR)/include/host.mk
ifneq ($(OPENWRT_BUILD),1)
$(package/stamp-compile): $(BUILD_DIR)/.prepared
$(BUILD_DIR)/.prepared: Makefile
@mkdir -p $$(dirname $@)
$(package/stamp-compile): $(BUILD_DIR)/.prepared
$(BUILD_DIR)/.prepared: Makefile
@mkdir -p $$(dirname $@)
- rm -rf $(BUILD_DIR) $(BIN_DIR)
+ git clean -f -d $(STAGING_DIR); true
+ git clean -f -d $(BUILD_DIR); true
+ git clean -f -d $(BIN_DIR); true
+ git reset --hard HEAD
+ git clean -f -d
+ rm -rf feeds/
# check prerequisites before starting to build
prereq: $(package/stamp-prereq) ;
# check prerequisites before starting to build
prereq: $(package/stamp-prereq) ;