let ipkg fail when a package file to be installed is not found
[openwrt/staging/wigyori.git] / openwrt / package / rp-pppoe / ipkg / rules
1 #!/usr/bin/make -f
2
3 ifneq ($(strip ${IPKG_RULES_INC}),)
4 include $(IPKG_RULES_INC)
5 endif
6
7 ##
8
9 PKG_VERSION := $(shell cat ./ipkg/version)
10 CURRENT_DIR := $(shell pwd)
11 INSTALL_DIR ?= $(CURRENT_DIR)/ipkg-install
12
13 unexport INSTALL_DIR
14
15 I_PPPOE_SERVER := ipkg/pppoe-server
16 I_PPPOE_RELAY := ipkg/pppoe-relay
17 I_PPPOE_SNIFF := ipkg/pppoe-sniff
18 I_PPPOE_CLIENT := ipkg/pppoe-client
19
20 BUILD_DEPS = \
21
22 CONFIGURE_OPTS = \
23
24 ##
25
26 all: package
27
28
29 .stamp-configured: $(BUILD_DEPS)
30
31 cd src ; \
32 rm -rf config.cache ; \
33 $(TARGET_CONFIGURE_OPTS) \
34 ac_cv_func_setvbuf_reversed=no \
35 ac_cv_sizeof_unsigned_short=2 \
36 ac_cv_sizeof_unsigned_int=4 \
37 ac_cv_sizeof_unsigned_long=4 \
38 ac_cv_linux_kernel_pppoe=yes \
39 ac_cv_pack_bitfields_reversed=yes \
40 CFLAGS="$(TARGET_CFLAGS)" \
41 ./configure \
42 --target=$(GNU_TARGET_NAME) \
43 --host=$(GNU_TARGET_NAME) \
44 --build=$(GNU_HOST_NAME) \
45 --program-prefix="" \
46 --program-suffix="" \
47 --prefix=/usr \
48 --exec-prefix=/usr \
49 --bindir=/usr/bin \
50 --datadir=/usr/share \
51 --includedir=/usr/include \
52 --infodir=/usr/share/info \
53 --libdir=/usr/lib \
54 --libexecdir=/usr/lib \
55 --localstatedir=/var \
56 --mandir=/usr/share/man \
57 --sbindir=/usr/sbin \
58 --sysconfdir=/etc \
59 $(DISABLE_LARGEFILE) \
60 $(DISABLE_NLS) \
61 $(CONFIGURE_OPTS) \
62
63 touch .stamp-configured
64
65
66 .stamp-built: .stamp-configured
67
68 $(MAKE) -C src \
69 $(TARGET_CONFIGURE_OPTS) \
70
71 touch .stamp-built
72
73
74 $(INSTALL_DIR)/usr/sbin/pppoe: .stamp-built
75
76 mkdir -p $(INSTALL_DIR)
77
78 $(MAKE) -C src \
79 DESTDIR="$(INSTALL_DIR)" \
80 install
81
82
83 configure: .stamp-configured
84
85
86 build: .stamp-built
87
88
89 install: $(INSTALL_DIR)/usr/sbin/pppoe
90
91
92 package: $(INSTALL_DIR)/usr/sbin/pppoe
93
94 mkdir -p $(I_PPPOE_SERVER)/etc/ppp
95 cp -fpR $(INSTALL_DIR)/etc/ppp/pppoe-server-options $(I_PPPOE_SERVER)/etc/ppp/
96 mkdir -p $(I_PPPOE_SERVER)/usr/sbin
97 cp -fpR $(INSTALL_DIR)/usr/sbin/pppoe-server $(I_PPPOE_SERVER)/usr/sbin/
98 $(STRIP) $(I_PPPOE_SERVER)/usr/sbin/*
99
100 mkdir -p $(I_PPPOE_RELAY)/usr/sbin
101 cp -fpR $(INSTALL_DIR)/usr/sbin/pppoe-relay $(I_PPPOE_RELAY)/usr/sbin/
102 $(STRIP) $(I_PPPOE_RELAY)/usr/sbin/*
103
104 mkdir -p $(I_PPPOE_SNIFF)/usr/sbin
105 cp -fpR $(INSTALL_DIR)/usr/sbin/pppoe-sniff $(I_PPPOE_SNIFF)/usr/sbin/
106 $(STRIP) $(I_PPPOE_SNIFF)/usr/sbin/*
107
108 mkdir -p $(I_PPPOE_CLIENT)/etc
109 cp -fpR $(INSTALL_DIR)/etc/pppoe.conf $(I_PPPOE_CLIENT)/etc/
110 mkdir -p $(I_PPPOE_CLIENT)/usr/sbin
111 cp -fpR $(INSTALL_DIR)/usr/sbin/pppoe $(I_PPPOE_CLIENT)/usr/sbin/
112 $(STRIP) $(I_PPPOE_CLIENT)/usr/sbin/*
113 cp -fpR $(INSTALL_DIR)/usr/sbin/adsl-* $(I_PPPOE_CLIENT)/usr/sbin/
114
115 chmod 0755 ipkg/*/etc/
116 chmod 0755 ipkg/*/etc/default/
117 chmod 0644 ipkg/*/etc/default/*
118 chmod 0755 ipkg/*/etc/init.d/
119 chmod 0755 ipkg/*/etc/init.d/*
120
121 chmod 0755 ipkg/*/CONTROL/
122 chmod 0644 ipkg/*/CONTROL/control
123 -chmod 0644 ipkg/*/CONTROL/conffiles
124
125 perl -pi -e "s/^Arch.*:.*/Architecture: $(ARCH)/g" ipkg/*/CONTROL/control
126 ifneq ($(strip $(PKG_VERSION)),)
127 perl -pi -e "s/^Vers.*:.*/Version: $(PKG_VERSION)/g" ipkg/*/CONTROL/control
128 endif
129
130 $(IPKG_BUILD) $(I_PPPOE_SERVER) $(IPKG_TARGET_DIR)
131 $(IPKG_BUILD) $(I_PPPOE_RELAY) $(IPKG_TARGET_DIR)
132 $(IPKG_BUILD) $(I_PPPOE_SNIFF) $(IPKG_TARGET_DIR)
133 $(IPKG_BUILD) $(I_PPPOE_CLIENT) $(IPKG_TARGET_DIR)
134
135
136 clean:
137
138 -$(MAKE) -C src \
139 clean
140
141 rm -rf .stamp-* \
142 $(INSTALL_DIR)/etc/pppoe.conf \
143 $(INSTALL_DIR)/etc/ppp/pppoe-server-options \
144 $(INSTALL_DIR)/usr/doc/rp-pppoe* \
145 $(INSTALL_DIR)/usr/sbin/adsl-* \
146 $(INSTALL_DIR)/usr/sbin/pppoe* \
147 $(INSTALL_DIR)/usr/share/man/man5/pppoe.conf.5* \
148 $(INSTALL_DIR)/usr/share/man/man8/adsl-*.8* \
149 $(INSTALL_DIR)/usr/share/man/man8/pppoe*.8* \
150 $(I_PPPOE_SERVER)/etc/ppp \
151 $(I_PPPOE_SERVER)/usr \
152 $(I_PPPOE_RELAY)/usr \
153 $(I_PPPOE_SNIFF)/usr \
154 $(I_PPPOE_CLIENT)/etc/ppp* \
155 $(I_PPPOE_CLIENT)/usr \
156
157
158 control:
159
160 @cat $(I_PPPOE_SERVER)/CONTROL/control
161 @echo
162 @cat $(I_PPPOE_RELAY)/CONTROL/control
163 @echo
164 @cat $(I_PPPOE_SNIFF)/CONTROL/control
165 @echo
166 @cat $(I_PPPOE_CLIENT)/CONTROL/control
167 @echo
168
169
170 .PHONY: configure build install package clean control