151942de343ae098e4fa56a8b53573f5c12230cc
[openwrt/staging/chunkeey.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 $(TMP_DIR)/.pkgdeps
12 include $(INCLUDE_DIR)/host.mk
13
14 PREREQ_PACKAGES:=$(patsubst %,%-prereq,$(prereq-y) $(prereq-m))
15 DOWNLOAD_PACKAGES:=$(patsubst %,%-download,$(package-y) $(package-m))
16 COMPILE_PACKAGES:=$(patsubst %,%-compile,$(package-y) $(package-m))
17 INSTALL_PACKAGES:=$(patsubst %,%-install,$(package-y))
18
19 $(STAMP_DIR) $(TARGET_DIR):
20 mkdir -p $@
21
22 %-prereq: $(STAMP_DIR) $(TARGET_DIR)
23 $(MAKE) -C $(patsubst %-prereq,%,$@) prereq
24
25 $(eval $(call default_subtargets,$(TARGET_DIR)))
26
27 ifeq ($(SDK),1)
28 GENDEP_OPTS := -s
29 endif
30
31 $(TMP_DIR)/.pkgdeps: $(TMP_DIR)/.pkginfo
32 @$(TOPDIR)/scripts/gen_deps.pl $(GENDEP_OPTS) < $< > $@ || rm -f $@
33
34 all: compile
35 clean: $(patsubst %,%-clean,$(package-) $(package-y) $(package-m))
36 prereq: $(PREREQ_PACKAGES)
37 download: $(DOWNLOAD_PACKAGES)
38 compile: $(COMPILE_PACKAGES)
39
40 install-targets: $(INSTALL_PACKAGES)
41 install:
42 rm -rf $(BUILD_DIR)/root
43 $(MAKE) install-targets
44 @if [ -d $(TOPDIR)/files ]; then \
45 $(CP) $(TOPDIR)/files/. $(BUILD_DIR)/root; \
46 fi
47 @( \
48 cd $(BUILD_DIR)/root; \
49 for script in ./etc/init.d/*; do \
50 grep '#!/bin/sh /etc/rc.common' $$script >/dev/null || continue; \
51 IPKG_INSTROOT=$(BUILD_DIR)/root $(which bash) ./etc/rc.common $$script enable; \
52 done; \
53 )
54
55 index: $(PACKAGE_DIR)/Packages
56
57 $(PACKAGE_DIR)/Packages: $(PACKAGE_DIR)/*.ipk
58 (cd $(PACKAGE_DIR); $(SCRIPT_DIR)/ipkg-make-index.sh . > Packages)
59
60 symlinks:
61 ../scripts/feeds.sh $(CONFIG_SOURCE_FEEDS)
62
63 ifeq ($(MAKECMDGOALS),compile)
64 MAKEFLAGS:=$(MAKEFLAGS) -j$(CONFIG_JLEVEL)
65 else
66 .NOTPARALLEL:
67 endif