ppc44x: fix build of crypto4xx_core.c
[openwrt/openwrt.git] / package / Makefile
1 #
2 # Copyright (C) 2006-2010 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 $(INCLUDE_DIR)/rootfs.mk
11
12 -include $(TMP_DIR)/.packagedeps
13 $(curdir)/builddirs:=$(sort $(package-) $(package-y) $(package-m))
14 $(curdir)/builddirs-install:=.
15 $(curdir)/builddirs-default:=. $(sort $(package-y) $(package-m))
16 $(curdir)/builddirs-prereq:=. $(sort $(prereq-y) $(prereq-m))
17 ifdef CHECK_ALL
18 $(curdir)/builddirs-check:=$($(curdir)/builddirs)
19 $(curdir)/builddirs-download:=$($(curdir)/builddirs)
20 endif
21 ifneq ($(IGNORE_ERRORS),)
22 package-y-filter := $(package-y)
23 package-m-filter := $(filter-out $(package-y),$(package-m))
24 package-n-filter := $(filter-out $(package-y) $(package-m),$(package-))
25 package-ignore-errors := $(filter n m y,$(IGNORE_ERRORS))
26 package-ignore-errors := $(if $(package-ignore-errors),$(package-ignore-errors),n m)
27 package-ignore-subdirs := $(sort $(foreach m,$(package-ignore-errors),$(package-$(m)-filter)))
28 $(curdir)/builddirs-ignore-download := $(package-ignore-subdirs)
29 $(curdir)/builddirs-ignore-compile := $(package-ignore-subdirs)
30 $(curdir)/builddirs-ignore-host-download := $(package-ignore-subdirs)
31 $(curdir)/builddirs-ignore-host-compile := $(package-ignore-subdirs)
32 endif
33
34 PACKAGE_INSTALL_FILES:= \
35 $(foreach pkg,$(sort $(package-y)), \
36 $(foreach variant, \
37 $(if $(strip $(package/$(pkg)/variants)), \
38 $(package/$(pkg)/variants), \
39 $(if $(package/$(pkg)/default-variant), \
40 $(package/$(pkg)/default-variant), \
41 default \
42 ) \
43 ), \
44 $(PKG_INFO_DIR)/$(lastword $(subst /,$(space),$(pkg))).$(variant).install \
45 ) \
46 )
47
48 $(curdir)/cleanup: $(TMP_DIR)/.build
49 rm -rf $(STAGING_DIR_ROOT)
50
51 $(curdir)/merge:
52 rm -rf $(PACKAGE_DIR_ALL)
53 mkdir -p $(PACKAGE_DIR_ALL)
54 -$(foreach pdir,$(PACKAGE_SUBDIRS),$(if $(wildcard $(pdir)/*.ipk),ln -s $(pdir)/*.ipk $(PACKAGE_DIR_ALL);))
55
56 $(curdir)/merge-index: $(curdir)/merge
57 (cd $(PACKAGE_DIR_ALL) && $(SCRIPT_DIR)/ipkg-make-index.sh . 2>&1 > Packages; )
58
59 $(curdir)/install: $(TMP_DIR)/.build $(curdir)/system/opkg/host/install $(curdir)/merge $(if $(CONFIG_TARGET_PER_DEVICE_ROOTFS),$(curdir)/merge-index)
60 - find $(STAGING_DIR_ROOT) -type d | $(XARGS) chmod 0755
61 rm -rf $(TARGET_DIR) $(TARGET_DIR_ORIG)
62 [ -d $(TARGET_DIR)/tmp ] || mkdir -p $(TARGET_DIR)/tmp
63 $(call opkg,$(TARGET_DIR)) install \
64 $(call opkg_package_files,$(shell cat $(PACKAGE_INSTALL_FILES) 2>/dev/null))
65 @for file in $(PACKAGE_INSTALL_FILES); do \
66 [ -s $$file.flags ] || continue; \
67 for flag in `cat $$file.flags`; do \
68 $(call opkg,$(TARGET_DIR)) flag $$flag `cat $$file`; \
69 done; \
70 done || true
71 @-$(MAKE) package/preconfig
72
73 $(CP) $(TARGET_DIR) $(TARGET_DIR_ORIG)
74
75 $(call prepare_rootfs,$(TARGET_DIR))
76
77 PASSOPT=""
78 PASSARG=""
79 ifndef CONFIG_OPKGSMIME_PASSPHRASE
80 ifneq ($(call qstrip,$(CONFIG_OPKGSMIME_PASSFILE)),)
81 PASSOPT="-passin"
82 PASSARG="file:$(call qstrip,$(CONFIG_OPKGSMIME_PASSFILE))"
83 endif
84 endif
85
86 $(curdir)/index: FORCE
87 @echo Generating package index...
88 @for d in $(PACKAGE_SUBDIRS); do ( \
89 mkdir -p $$d; \
90 cd $$d || continue; \
91 $(SCRIPT_DIR)/ipkg-make-index.sh . 2>&1 > Packages && \
92 gzip -9nc Packages > Packages.gz; \
93 ); done
94 ifdef CONFIG_SIGNED_PACKAGES
95 @echo Signing package index...
96 @for d in $(PACKAGE_SUBDIRS); do ( \
97 [ -d $$d ] && \
98 cd $$d || continue; \
99 $(STAGING_DIR_HOST)/bin/usign -S -m Packages -s $(BUILD_KEY); \
100 ); done
101 else
102 ifeq ($(call qstrip,$(CONFIG_OPKGSMIME_KEY)),)
103 @echo Signing key has not been configured
104 else
105 ifeq ($(call qstrip,$(CONFIG_OPKGSMIME_CERT)),)
106 @echo Certificate has not been configured
107 else
108 @echo Signing package index...
109 @for d in $(PACKAGE_SUBDIRS); do ( \
110 [ -d $$d ] && \
111 cd $$d || continue; \
112 openssl smime -binary -in Packages.gz \
113 -out Packages.sig -outform PEM -sign \
114 -signer $(CONFIG_OPKGSMIME_CERT) \
115 -inkey $(CONFIG_OPKGSMIME_KEY) \
116 $(PASSOPT) $(PASSARG); \
117 ); done
118 endif
119 endif
120 endif
121
122 $(curdir)/preconfig:
123
124 $(curdir)/flags-install:= -j1
125
126 $(eval $(call stampfile,$(curdir),package,prereq,.config))
127 $(eval $(call stampfile,$(curdir),package,cleanup,$(TMP_DIR)/.build))
128 $(eval $(call stampfile,$(curdir),package,compile,$(TMP_DIR)/.build))
129 $(eval $(call stampfile,$(curdir),package,install,$(TMP_DIR)/.build))
130 $(eval $(call stampfile,$(curdir),package,check,$(TMP_DIR)/.build))
131
132 $(eval $(call subdir,$(curdir)))