mac80211: update to wireless-testing 2010-07-26 + pending patches - adds a change...
[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 $(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)/opkghost: $(TMP_DIR)/.build
24 @-$(MAKE) package/opkg/host/install
25
26 $(curdir)/install:=$(curdir)/install-cleanup
27
28 $(curdir)/cleanup: $(TMP_DIR)/.build
29 - find $(STAGING_DIR_ROOT) -type d | $(XARGS) chmod 0755
30 rm -rf $(TARGET_DIR) $(STAGING_DIR_ROOT)
31
32 ifdef CONFIG_USE_MKLIBS
33 define mklibs
34 rm -rf $(TMP_DIR)/mklibs-progs $(TMP_DIR)/mklibs-out
35 # first find all programs and add them to the mklibs list
36 find $(STAGING_DIR_ROOT) -type f -perm +100 -exec \
37 file -r -N -F '' {} + | \
38 awk ' /executable.*dynamically/ { print $$1 }' > $(TMP_DIR)/mklibs-progs
39 # find all loadable objects that are not regular libraries and add them to the list as well
40 find $(STAGING_DIR_ROOT) -type f -name \*.so\* -exec \
41 file -r -N -F '' {} + | \
42 awk ' /shared object/ { print $$1 }' >> $(TMP_DIR)/mklibs-progs
43 mkdir -p $(TMP_DIR)/mklibs-out
44 $(STAGING_DIR_HOST)/bin/mklibs.py -D \
45 -d $(TMP_DIR)/mklibs-out \
46 --sysroot $(STAGING_DIR_ROOT) \
47 -L /lib \
48 -L /usr/lib \
49 -L /usr/lib/ebtables \
50 --ldlib $(patsubst $(STAGING_DIR_ROOT)/%,/%,$(firstword $(wildcard \
51 $(foreach name,ld-uClibc.so.* ld-linux.so.* ld-*.so, \
52 $(STAGING_DIR_ROOT)/lib/$(name) \
53 )))) \
54 --target $(REAL_GNU_TARGET_NAME) \
55 `cat $(TMP_DIR)/mklibs-progs` 2>&1
56 $(RSTRIP) $(TMP_DIR)/mklibs-out
57 for lib in `ls $(TMP_DIR)/mklibs-out/*.so.* 2>/dev/null`; do \
58 LIB="$${lib##*/}"; \
59 DEST="`ls "$(TARGET_DIR)/lib/$$LIB" "$(TARGET_DIR)/usr/lib/$$LIB" 2>/dev/null`"; \
60 [ -n "$$DEST" ] || continue; \
61 echo "Copying stripped library $$lib to $$DEST"; \
62 cp "$$lib" "$$DEST" || exit 1; \
63 done
64 endef
65 endif
66
67 $(curdir)/rootfs-prepare: $(TMP_DIR)/.build
68 @-$(MAKE) package/preconfig
69 @if [ -d $(TOPDIR)/files ]; then \
70 $(CP) $(TOPDIR)/files/. $(TARGET_DIR); \
71 fi
72 @mkdir -p $(TARGET_DIR)/etc/rc.d
73 @( \
74 cd $(TARGET_DIR); \
75 for script in ./etc/init.d/*; do \
76 grep '#!/bin/sh /etc/rc.common' $$script >/dev/null || continue; \
77 IPKG_INSTROOT=$(TARGET_DIR) $$(which bash) ./etc/rc.common $$script enable; \
78 done || true \
79 )
80 @-find $(TARGET_DIR) -name CVS | $(XARGS) rm -rf
81 @-find $(TARGET_DIR) -name .svn | $(XARGS) rm -rf
82 @-find $(TARGET_DIR) -name '.#*' | $(XARGS) rm -f
83 $(if $(CONFIG_CLEAN_IPKG),rm -rf $(TARGET_DIR)/usr/lib/opkg)
84 $(call mklibs)
85
86 $(curdir)/index: FORCE
87 @(cd $(PACKAGE_DIR); $(SCRIPT_DIR)/ipkg-make-index.sh . > Packages && \
88 gzip -9c Packages > Packages.gz \
89 )
90
91 $(curdir)/flags-install:= -j1
92
93 $(eval $(call stampfile,$(curdir),package,prereq,.config))
94 $(eval $(call stampfile,$(curdir),package,cleanup))
95 $(eval $(call stampfile,$(curdir),package,compile))
96 $(eval $(call stampfile,$(curdir),package,opkghost))
97 $(eval $(call stampfile,$(curdir),package,install,$(STAGING_DIR)/stamp/.package_opkghost))
98 $(eval $(call stampfile,$(curdir),package,rootfs-prepare))
99
100 $(eval $(call subdir,$(curdir)))
This page took 0.051701 seconds and 5 git commands to generate.