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