Allow to call clean target from source makefile with
package/<name>/cleansrc.
Useful when developing a package on-site.

Signed-off-by: Roman Yeryomin <[email protected]>

diff --git a/include/package-defaults.mk b/include/package-defaults.mk
index 45a92cf..a2af1e5 100644
--- a/include/package-defaults.mk
+++ b/include/package-defaults.mk
@@ -151,3 +151,8 @@ endef
 define Build/DistCheck/Default
        $(call Build/Compile/Default, DESTDIR="$(PKG_BUILD_DIR)/tmp"
CC="$(TARGET_CC)" distcheck)
 endef
+
+define Build/Cleansrc/Default
+       $(call Build/Compile/Default,clean)
+       rm -f $(PKG_BUILD_DIR)/.built*
+endef
diff --git a/include/package.mk b/include/package.mk
index c1fe088..0e8487b 100644
--- a/include/package.mk
+++ b/include/package.mk
@@ -249,6 +249,7 @@ Build/Compile=$(call Build/Compile/Default,)
 Build/Install=$(if $(PKG_INSTALL),$(call Build/Install/Default,))
 Build/Dist=$(call Build/Dist/Default,)
 Build/DistCheck=$(call Build/DistCheck/Default,)
+Build/Cleansrc=$(call Build/Cleansrc/Default,)

 .NOTPARALLEL:

@@ -284,6 +285,9 @@ clean: clean-staging FORCE

 dist:
        $(Build/Dist)
-
+
 distcheck:
        $(Build/DistCheck)
+
+cleansrc:
+       $(Build/Cleansrc)
diff --git a/include/subdir.mk b/include/subdir.mk
index a2adff2..246c8a3 100644
--- a/include/subdir.mk
+++ b/include/subdir.mk
@@ -9,7 +9,7 @@ ifeq ($(MAKECMDGOALS),prereq)
   SUBTARGETS:=prereq
   PREREQ_ONLY:=1
 else
-  SUBTARGETS:=clean download prepare compile install update refresh prereq
dist distcheck configure
+  SUBTARGETS:=clean download prepare compile install update refresh prereq
dist distcheck configure cleansrc
 endif

 subtarget-default = $(filter-out ., \

Attachment: allow-to-call-clean-target-from-source-makefile.patch
Description: Binary data

_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to