e9bed9b6cc174d6c8a1aea94ccc30c975a259127
[openwrt-10.03/.git] / package / Makefile
1 #
2 # Copyright (C) 2006-2008 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 curdir:=package
10
11 -include $(TMP_DIR)/.packagedeps
12 $(curdir)/builddirs:=$(sort $(package-) $(package-y) $(package-m))
13 ifeq ($(SDK),1)
14   $(curdir)/builddirs-install:=.
15 else
16   $(curdir)/builddirs-default:=. $(sort $(package-y) $(package-m))
17   $(curdir)/builddirs-prereq:=. $(sort $(prereq-y) $(prereq-m))
18   $(curdir)/builddirs-install:=. $(sort $(package-y))
19 endif
20 ifneq ($(IGNORE_ERRORS),)
21   $(curdir)/builddirs-ignore-compile:= $(if $(filter m y, $(IGNORE_ERRORS)),$(foreach m,$(IGNORE_ERRORS),$(package-$(m))),$(package-m))
22 endif
23
24 $(curdir)/install:=$(curdir)/install-cleanup
25
26 $(curdir)/cleanup: $(TMP_DIR)/.build
27         rm -rf $(TARGET_DIR)
28
29 $(curdir)/rootfs-prepare: $(TMP_DIR)/.build
30         @-$(MAKE) package/preconfig
31         @if [ -d $(TOPDIR)/files ]; then \
32                 $(CP) $(TOPDIR)/files/. $(TARGET_DIR); \
33         fi
34         @mkdir -p $(TARGET_DIR)/etc/rc.d
35         @( \
36                 cd $(TARGET_DIR); \
37                 for script in ./etc/init.d/*; do \
38                         grep '#!/bin/sh /etc/rc.common' $$script >/dev/null || continue; \
39                         IPKG_INSTROOT=$(TARGET_DIR) $$(which bash) ./etc/rc.common $$script enable; \
40                 done || true \
41         )
42         @-find $(TARGET_DIR) -name CVS   | $(XARGS) rm -rf
43         @-find $(TARGET_DIR) -name .svn  | $(XARGS) rm -rf
44         @-find $(TARGET_DIR) -name '.#*' | $(XARGS) rm -f
45         $(if $(CONFIG_CLEAN_IPKG),rm -rf $(TARGET_DIR)/usr/lib/ipkg)
46
47 $(curdir)/index: FORCE
48         @(cd $(PACKAGE_DIR); $(SCRIPT_DIR)/ipkg-make-index.sh . > Packages && \
49                 gzip -9c Packages > Packages.gz \
50         )
51
52 $(curdir)/flags-install:= -j1
53
54 $(eval $(call stampfile,$(curdir),package,prereq,.config))
55 $(eval $(call stampfile,$(curdir),package,cleanup,$(TMP_DIR)/.build))
56 $(eval $(call stampfile,$(curdir),package,compile,$(TMP_DIR)/.build))
57 $(eval $(call stampfile,$(curdir),package,install,$(TMP_DIR)/.build))
58 $(eval $(call stampfile,$(curdir),package,rootfs-prepare,$(TMP_DIR)/.build))
59
60 $(eval $(call subdir,$(curdir)))