Add updated support for buffalo routers (#1874)
[librecmc/librecmc.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 %-refresh %-update:
36         -$(MAKE) -C $* $(patsubst $*-%,%,$@)
37         
38 %-autorefresh:
39         -$(MAKE) -C $* clean refresh QUILT=1
40
41
42 # .IGNORE: $(COMPILE_PACKAGES) 
43
44 $(TMP_DIR)/.packagedeps: $(TMP_DIR)/.packageinfo
45         @$(TOPDIR)/scripts/metadata.pl package_mk < $< > $@ || rm -f $@
46
47 preconfig:
48 clean: $(patsubst %,%-clean,$(package-) $(package-y) $(package-m))
49 prereq: $(PREREQ_PACKAGES)
50 download: $(DOWNLOAD_PACKAGES)
51 compile: $(COMPILE_PACKAGES)
52 refresh: $(patsubst %,%-autorefresh,$(package-y) $(package-m) $(package-))
53
54 install-targets: $(INSTALL_PACKAGES)
55 install:
56         rm -rf $(BUILD_DIR)/root
57         $(MAKE) install-targets
58         $(MAKE) preconfig
59         @if [ -d $(TOPDIR)/files ]; then \
60                 $(CP) $(TOPDIR)/files/. $(BUILD_DIR)/root; \
61         fi
62         @mkdir -p $(BUILD_DIR)/root/etc/rc.d
63         @( \
64                 cd $(BUILD_DIR)/root; \
65                 for script in ./etc/init.d/*; do \
66                         grep '#!/bin/sh /etc/rc.common' $$script >/dev/null || continue; \
67                         IPKG_INSTROOT=$(BUILD_DIR)/root $(which bash) ./etc/rc.common $$script enable; \
68                 done || true \
69         )
70         @-find $(BUILD_DIR)/root -name CVS   | $(XARGS) rm -rf
71         @-find $(BUILD_DIR)/root -name .svn  | $(XARGS) rm -rf
72         @-find $(BUILD_DIR)/root -name '.#*' | $(XARGS) rm -f
73
74 index: $(PACKAGE_DIR)/Packages
75
76 $(PACKAGE_DIR)/Packages: $(PACKAGE_DIR)/*.ipk
77         (cd $(PACKAGE_DIR); $(SCRIPT_DIR)/ipkg-make-index.sh . > Packages)
78
79 symlinks:
80         ../scripts/feeds.sh $(CONFIG_SOURCE_FEEDS) 
81
82 ifeq ($(MAKECMDGOALS),compile)
83 MAKEFLAGS:=$(MAKEFLAGS) -j$(CONFIG_JLEVEL)
84 else
85 .NOTPARALLEL:
86 endif