speed up package prereq check (only run make on those directories that actually conta...
[openwrt/staging/dedeckeh.git] / openwrt / 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 $(TOPDIR)/.pkgdeps
12
13 PREREQ_PACKAGES:=$(patsubst %,%-prereq,$(package-prereq))
14 DOWNLOAD_PACKAGES:=$(patsubst %,%-download,$(package-y) $(package-m))
15 COMPILE_PACKAGES:=$(patsubst %,%-compile,$(package-y) $(package-m))
16 INSTALL_PACKAGES:=$(patsubst %,%-install,$(package-y))
17
18 $(STAMP_DIR) $(TARGET_DIR):
19 mkdir -p $@
20
21 %-prereq: $(STAMP_DIR) $(TARGET_DIR)
22 $(MAKE) -C $(patsubst %-prereq,%,$@) prereq
23
24 %-download: $(STAMP_DIR) $(TARGET_DIR)
25 $(MAKE) -C $(patsubst %-download,%,$@) download
26
27 %-prepare: $(STAMP_DIR) $(TARGET_DIR)
28 $(MAKE) -C $(patsubst %-prepare,%,$@) prepare
29
30 %-compile: $(STAMP_DIR) $(TARGET_DIR)
31 $(MAKE) -C $(patsubst %-compile,%,$@) compile
32
33 %-install: $(STAMP_DIR) $(TARGET_DIR)
34 $(MAKE) -C $(patsubst %-install,%,$@) install
35
36 %-clean: $(STAMP_DIR) $(TARGET_DIR)
37 $(MAKE) -C $(patsubst %-clean,%,$@) clean
38
39 ifeq ($(SDK),1)
40 GENDEP_OPTS := -s
41 endif
42
43 $(TOPDIR)/.pkgdeps: $(TOPDIR)/.pkginfo
44 @$(TOPDIR)/scripts/gen_deps.pl $(GENDEP_OPTS) < $< > $@ || rm -f $@
45
46 all: compile
47 clean: $(patsubst %,%-clean,$(package-) $(package-y) $(package-m))
48 prereq: $(PREREQ_PACKAGES)
49 download: $(DOWNLOAD_PACKAGES)
50 compile-targets: $(COMPILE_PACKAGES)
51 compile:
52 $(MAKE) compile-targets
53 install-targets: base-files-install $(INSTALL_PACKAGES)
54 install:
55 rm -rf $(BUILD_DIR)/root
56 $(MAKE) install-targets
57
58 index: $(PACKAGE_DIR)/Packages
59
60 $(PACKAGE_DIR)/Packages: $(PACKAGE_DIR)/*.ipk
61 (cd $(PACKAGE_DIR); $(STAGING_DIR)/usr/bin/ipkg-make-index . > Packages)
62
63
64 ifeq ($(MAKECMDGOALS),compile-targets)
65 MAKEFLAGS:=$(MAKEFLAGS) -j$(CONFIG_JLEVEL)
66 else
67 .NOTPARALLEL:
68 endif