speed up package/install
[openwrt.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)/.pkgdeps
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 %-prereq: $(STAMP_DIR) $(TARGET_DIR)
26 $(MAKE) -C $(patsubst %-prereq,%,$@) prereq
27
28 %-download: FORCE
29 $(MAKE) -C $(patsubst %-download,%,$@) download
30
31 %-prepare: $(TARGET_DIR) FORCE
32 $(MAKE) -C $(patsubst %-prepare,%,$@) prepare
33
34 %-compile: %-prepare
35 $(MAKE) -C $(patsubst %-compile,%,$@) compile
36
37 %-install:
38 $(MAKE) -C $(patsubst %-install,%,$@) install
39
40 %-clean: FORCE
41 $(MAKE) -C $(patsubst %-clean,%,$@) clean
42
43 ifeq ($(SDK),1)
44 GENDEP_OPTS := -s
45 endif
46
47 $(TMP_DIR)/.pkgdeps: $(TMP_DIR)/.pkginfo
48 @$(TOPDIR)/scripts/metadata.pl package_mk $(GENDEP_OPTS) < $< > $@ || rm -f $@
49
50 preconfig:
51 clean: $(patsubst %,%-clean,$(package-) $(package-y) $(package-m))
52 prereq: $(PREREQ_PACKAGES)
53 download: $(DOWNLOAD_PACKAGES)
54 compile: $(COMPILE_PACKAGES)
55
56 install-targets: $(INSTALL_PACKAGES)
57 install:
58 rm -rf $(BUILD_DIR)/root
59 $(MAKE) install-targets
60 $(MAKE) preconfig
61 @if [ -d $(TOPDIR)/files ]; then \
62 $(CP) $(TOPDIR)/files/. $(BUILD_DIR)/root; \
63 fi
64 @( \
65 cd $(BUILD_DIR)/root; \
66 for script in ./etc/init.d/*; do \
67 grep '#!/bin/sh /etc/rc.common' $$script >/dev/null || continue; \
68 IPKG_INSTROOT=$(BUILD_DIR)/root $(which bash) ./etc/rc.common $$script enable; \
69 done || true \
70 )
71
72 index: $(PACKAGE_DIR)/Packages
73
74 $(PACKAGE_DIR)/Packages: $(PACKAGE_DIR)/*.ipk
75 (cd $(PACKAGE_DIR); $(SCRIPT_DIR)/ipkg-make-index.sh . > Packages)
76
77 symlinks:
78 ../scripts/feeds.sh $(CONFIG_SOURCE_FEEDS)
79
80 ifeq ($(MAKECMDGOALS),compile)
81 MAKEFLAGS:=$(MAKEFLAGS) -j$(CONFIG_JLEVEL)
82 else
83 .NOTPARALLEL:
84 endif
This page took 0.050776 seconds and 5 git commands to generate.