On 20 November 2012 21:45, Roman Yeryomin <leroi.li...@gmail.com> wrote:

> When developing/debugging a package I would like to make
> change/compile/try cycle to be shorter.
> Of cause you can do something like:
> - edit/save the code
> - cd build_dir/target_something/package
> - make clean
> - rm -f .built*
> - cd -
> - make package/name/compile
>
> but this looks and feels much nicer and shorter:
> - edit/save the code
> - make package/name/cleansrc
> - make package/name/compile


Use $(STAMP_BUILT) variable. Cleans some trailing spaces.

diff --git a/include/package-defaults.mk b/include/package-defaults.mk
index 45a92cf..8adf784 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 $(STAMP_BUILT)*
+endef
diff --git a/include/package.mk b/include/package.mk
index c1fe088..37a4a9b 100644
--- a/include/package.mk
+++ b/include/package.mk
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2006-2008 OpenWrt.org
+# Copyright (C) 2006-2012 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -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:

@@ -260,7 +261,7 @@ prepare-package-install:

 $(PACKAGE_DIR):
     mkdir -p $@
-
+
 dumpinfo:
 download:
 prepare:
@@ -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-v2.patch
Description: Binary data

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to