04b2912dc7478699417cf8ac5e6298e392867f78
[openwrt/svn-archive/archive.git] / package / Makefile
1 #
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10 include $(TOPDIR)/.config
11 include $(INCLUDE_DIR)/host.mk
12
13 all: compile
14
15 include $(TMP_DIR)/.packagedeps
16
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))
21
22 $(STAMP_DIR) $(TARGET_DIR):
23 mkdir -p $@
24
25 ifeq ($(QUIET),1)
26 %-compile %-install: FORCE
27 $(MAKE) -C $* $(patsubst $*-%,%,$@) || { $(call MESSAGE, "*** $* $(patsubst $*-%,%,$@) failed"); false; }
28
29 %-prepare %-prereq %-download %-clean: FORCE
30 else
31 %-prepare %-prereq %-download %-clean %-compile %-install: FORCE
32 endif
33 $(MAKE) -C $* $(patsubst $*-%,%,$@)
34
35 # .IGNORE: $(COMPILE_PACKAGES)
36
37 $(TMP_DIR)/.packagedeps: $(TMP_DIR)/.packageinfo
38 @$(TOPDIR)/scripts/metadata.pl package_mk < $< > $@ || rm -f $@
39
40 preconfig:
41 clean: $(patsubst %,%-clean,$(package-) $(package-y) $(package-m))
42 prereq: $(PREREQ_PACKAGES)
43 download: $(DOWNLOAD_PACKAGES)
44 compile: $(COMPILE_PACKAGES)
45
46 install-targets: $(INSTALL_PACKAGES)
47 install:
48 rm -rf $(BUILD_DIR)/root
49 $(MAKE) install-targets
50 $(MAKE) preconfig
51 @if [ -d $(TOPDIR)/files ]; then \
52 $(CP) $(TOPDIR)/files/. $(BUILD_DIR)/root; \
53 fi
54 @( \
55 cd $(BUILD_DIR)/root; \
56 for script in ./etc/init.d/*; do \
57 grep '#!/bin/sh /etc/rc.common' $$script >/dev/null || continue; \
58 IPKG_INSTROOT=$(BUILD_DIR)/root $(which bash) ./etc/rc.common $$script enable; \
59 done || true \
60 )
61 @-find $(BUILD_DIR)/root -name CVS | xargs -r rm -rf
62 @-find $(BUILD_DIR)/root -name .svn | xargs -r rm -rf
63 @-find $(BUILD_DIR)/root -name '.#*' | xargs -r rm -f
64
65 index: $(PACKAGE_DIR)/Packages
66
67 $(PACKAGE_DIR)/Packages: $(PACKAGE_DIR)/*.ipk
68 (cd $(PACKAGE_DIR); $(SCRIPT_DIR)/ipkg-make-index.sh . > Packages)
69
70 symlinks:
71 ../scripts/feeds.sh $(CONFIG_SOURCE_FEEDS)
72
73 ifeq ($(MAKECMDGOALS),compile)
74 MAKEFLAGS:=$(MAKEFLAGS) -j$(CONFIG_JLEVEL)
75 else
76 .NOTPARALLEL:
77 endif