2 # Copyright (C) 2006 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
9 include $(TOPDIR)/rules.mk
10 include $(TOPDIR)/.config
11 include $(INCLUDE_DIR)/host.mk
15 include $(TMP_DIR)/.packagedeps
17 PREREQ_PACKAGES:=$(patsubst %,%-prereq,$(prereq-y) $(prereq-m))
18 DOWNLOAD_PACKAGES:=$(patsubst %,%-download,$(package-y) $(package-m))
19 COMPILE_PACKAGES:=$(patsubst %,%-compile,$(package-y) $(package-m))
20 INSTALL_PACKAGES:=$(patsubst %,%-install,$(package-y))
22 $(STAMP_DIR) $(TARGET_DIR):
26 %-compile %-install: FORCE
27 $(MAKE) -C $* $(patsubst $*-%,%,$@) || { $(call MESSAGE, "*** $* $(patsubst $*-%,%,$@) failed"); false; }
29 %-prepare %-prereq %-download %-clean: FORCE
31 %-prepare %-prereq %-download %-clean %-compile %-install: FORCE
33 $(MAKE) -C $* $(patsubst $*-%,%,$@)
36 -$(MAKE) -C $* $(patsubst $*-%,%,$@)
39 -$(MAKE) -C $* clean refresh QUILT=1
42 # .IGNORE: $(COMPILE_PACKAGES)
44 $(TMP_DIR)/.packagedeps: $(TMP_DIR)/.packageinfo
45 @$(TOPDIR)/scripts/metadata.pl package_mk < $< > $@ || rm -f $@
48 clean: $(patsubst %,%-clean,$(package-) $(package-y) $(package-m))
49 prereq: $(PREREQ_PACKAGES)
50 download: $(DOWNLOAD_PACKAGES)
51 compile: $(COMPILE_PACKAGES)
52 refresh: $(patsubst %,%-autorefresh,$(package-y) $(package-m) $(package-))
54 install-targets: $(INSTALL_PACKAGES)
56 rm -rf $(BUILD_DIR)/root
57 $(MAKE) install-targets
59 @if [ -d $(TOPDIR)/files ]; then \
60 $(CP) $(TOPDIR)/files/. $(BUILD_DIR)/root; \
62 @mkdir -p $(BUILD_DIR)/root/etc/rc.d
64 cd $(BUILD_DIR)/root; \
65 for script in ./etc/init.d/*; do \
66 grep '#!/bin/sh /etc/rc.common' $$script >/dev/null || continue; \
67 IPKG_INSTROOT=$(BUILD_DIR)/root $(which bash) ./etc/rc.common $$script enable; \
70 @-find $(BUILD_DIR)/root -name CVS | $(XARGS) rm -rf
71 @-find $(BUILD_DIR)/root -name .svn | $(XARGS) rm -rf
72 @-find $(BUILD_DIR)/root -name '.#*' | $(XARGS) rm -f
74 index: $(PACKAGE_DIR)/Packages
76 $(PACKAGE_DIR)/Packages: $(PACKAGE_DIR)/*.ipk
77 (cd $(PACKAGE_DIR); $(SCRIPT_DIR)/ipkg-make-index.sh . > Packages)
80 ../scripts/feeds.sh $(CONFIG_SOURCE_FEEDS)
82 ifeq ($(MAKECMDGOALS),compile)
83 MAKEFLAGS:=$(MAKEFLAGS) -j$(CONFIG_JLEVEL)