eb9bbcde3bec0c3f7f405078f7f0decca17b4398
[openwrt/svn-archive/archive.git] / openwrt / package / dhcp-forwarder / 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_DHCP_FORWARDER := ipkg/dhcp-forwarder
16
17 BUILD_DEPS := \
18
19 CONFIGURE_OPTS = \
20
21 ##
22
23 all: package
24
25
26 .stamp-configured: $(BUILD_DEPS)
27
28 rm -rf config.cache
29 $(TARGET_CONFIGURE_OPTS) \
30 CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" \
31 LDFLAGS="-L$(STAGING_DIR)/usr/lib" \
32 ac_cv_func_malloc_0_nonnull="yes" \
33 ./configure \
34 --target=$(GNU_TARGET_NAME) \
35 --host=$(GNU_TARGET_NAME) \
36 --build=$(GNU_HOST_NAME) \
37 --program-prefix="" \
38 --program-suffix="" \
39 --prefix=/usr \
40 --exec-prefix=/usr \
41 --bindir=/usr/bin \
42 --datadir=/usr/share \
43 --includedir=/usr/include \
44 --infodir=/usr/share/info \
45 --libdir=/usr/lib \
46 --libexecdir=/usr/lib \
47 --localstatedir=/var \
48 --mandir=/usr/share/man \
49 --sbindir=/usr/sbin \
50 --sysconfdir=/etc \
51 $(DISABLE_LARGEFILE) \
52 $(DISABLE_NLS) \
53 $(CONFIGURE_OPTS) \
54
55 touch .stamp-configured
56
57
58 .stamp-built: .stamp-configured
59
60 $(MAKE) \
61 $(TARGET_CONFIGURE_OPTS) \
62 cfg_filename="/etc/dhcp-fwd.conf" \
63
64 touch .stamp-built
65
66
67 $(INSTALL_DIR)/usr/sbin/dhcp-fwd: .stamp-built
68
69 mkdir -p $(INSTALL_DIR)
70
71 $(MAKE) \
72 DESTDIR="$(INSTALL_DIR)" \
73 install
74
75
76 configure: .stamp-configured
77
78
79 build: .stamp-built
80
81
82 install: $(INSTALL_DIR)/usr/sbin/dhcp-fwd
83
84
85 package: $(INSTALL_DIR)/usr/sbin/dhcp-fwd
86
87 mkdir -p $(I_DHCP_FORWARDER)/etc
88 cp -fpR contrib/dhcp-fwd.conf $(I_DHCP_FORWARDER)/etc/
89
90 mkdir -p $(I_DHCP_FORWARDER)/usr/sbin
91 cp -fpR $(INSTALL_DIR)/usr/sbin/dhcp-fwd $(I_DHCP_FORWARDER)/usr/sbin/
92 $(STRIP) $(I_DHCP_FORWARDER)/usr/sbin/*
93
94 chmod 0755 $(I_DHCP_FORWARDER)/etc/
95 chmod 0600 $(I_DHCP_FORWARDER)/etc/dhcp-fwd.conf
96 chmod 0755 $(I_DHCP_FORWARDER)/etc/init.d/
97 chmod 0755 $(I_DHCP_FORWARDER)/etc/init.d/dhcp-fwd
98
99 chmod 0755 ipkg/*/CONTROL/
100 chmod 0644 ipkg/*/CONTROL/control
101 -chmod 0644 ipkg/*/CONTROL/conffiles
102
103 perl -pi -e "s/^Arch.*:.*/Architecture: $(ARCH)/g" ipkg/*/CONTROL/control
104 ifneq ($(strip $(PKG_VERSION)),)
105 perl -pi -e "s/^Vers.*:.*/Version: $(PKG_VERSION)/g" ipkg/*/CONTROL/control
106 endif
107
108 $(IPKG_BUILD) $(I_DHCP_FORWARDER) $(IPKG_TARGET_DIR)
109
110
111 clean:
112
113 -$(MAKE) \
114 DESTDIR="$(INSTALL_DIR)" \
115 uninstall clean
116
117 rm -rf .stamp-* \
118 $(I_DHCP_FORWARDER)/etc/dhcp-fwd.conf \
119 $(I_DHCP_FORWARDER)/usr \
120
121
122 control:
123
124 @cat $(I_DHCP_FORWARDER)/CONTROL/control
125 @echo
126
127
128 .PHONY: configure build install package clean control