add package/download target
[openwrt.org/openwrt.git] / package / Makefile
blob:a/package/Makefile -> blob:b/package/Makefile
--- a/package/Makefile
+++ b/package/Makefile
@@ -3,11 +3,15 @@
 include $(TOPDIR)/.config
 include $(TOPDIR)/.pkgdeps
 
+SOURCE_PACKAGES:=$(patsubst %,%-source,$(package-y) $(package-m))
 COMPILE_PACKAGES:=$(patsubst %,%-compile,$(package-y) $(package-m))
 INSTALL_PACKAGES:=$(patsubst %,%-install,$(package-y))
 
 $(STAMP_DIR) $(TARGET_DIR):
 	mkdir -p $@
+
+%-source: $(STAMP_DIR) $(TARGET_DIR)
+	$(MAKE) -C $(patsubst %-source,%,$@) source MAKEFLAGS="$(BUILD_MAKEFLAGS)"
 
 %-prepare: $(STAMP_DIR) $(TARGET_DIR)
 	$(MAKE) -C $(patsubst %-prepare,%,$@) prepare MAKEFLAGS="$(BUILD_MAKEFLAGS)"
@@ -29,6 +33,7 @@
 
 all: compile
 clean: $(patsubst %,%-clean,$(package-) $(package-y) $(package-m))
+download: $(SOURCE_PACKAGES)
 compile-targets: $(COMPILE_PACKAGES)
 compile:
 	$(MAKE) -j$(CONFIG_JLEVEL) compile-targets

comments