revert package compile breakage introduced in [6936]
[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 %-prereq %-download %-clean: FORCE
30 else
31 %-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
62 index: $(PACKAGE_DIR)/Packages
63
64 $(PACKAGE_DIR)/Packages: $(PACKAGE_DIR)/*.ipk
65 (cd $(PACKAGE_DIR); $(SCRIPT_DIR)/ipkg-make-index.sh . > Packages)
66
67 symlinks:
68 ../scripts/feeds.sh $(CONFIG_SOURCE_FEEDS)
69
70 ifeq ($(MAKECMDGOALS),compile)
71 MAKEFLAGS:=$(MAKEFLAGS) -j$(CONFIG_JLEVEL)
72 else
73 .NOTPARALLEL:
74 endif