replace lots of manual install commands with INSTALL_* variables
[openwrt/svn-archive/archive.git] / net / click / Makefile
1 # Copyright (C) 2006 OpenWrt.org
2 #
3 # This is free software, licensed under the GNU General Public License v2.
4 # See /LICENSE for more information.
5 #
6 # $Id$
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=click
11 PKG_VERSION:=cvs.2006.03.02
12 PKG_RELEASE:=1
13 PKG_MD5SUM:=7aed4ba94926010d76febb797b288e98
14
15 ROOFNET_VERSION:=0.0.1
16
17 PKG_SOURCE_URL:=http://pdos.csail.mit.edu/~jbicket/click_snapshots/
18 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
19 PKG_CAT:=zcat
20
21 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
22 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
23
24 include $(INCLUDE_DIR)/package.mk
25
26 define Package/click
27 SECTION:=net
28 CATEGORY:=Network
29 MENU:=1
30 TITLE:=The Click Modular Router
31 DESCRIPTION:=The Click Modular Router
32 URL:=http://pdos.csail.mit.edu/click/
33 endef
34
35 define Package/roofnet
36 SECTION:=net
37 CATEGORY:=Network
38 DEPENDS:=click
39 TITLE:=roofnet mesh networking scripts
40 DESCRIPTION:=roofnet mesh networking scripts
41 URL:=http://pdos.csail.mit.edu/roofnet/
42 endef
43
44 BUILDOPTS = \
45 BUILD_CXX="g++ -I $(PKG_BUILD_DIR)/include-host" \
46 BUILD_DL_LIBS="-ldl"
47
48 define Build/Configure
49 (cd $(PKG_BUILD_DIR); \
50 rm -rf config.{cache,status} ; \
51 CONFIG_SITE= \
52 ./configure; \
53 rm -rf include-host; \
54 $(CP) include include-host; \
55 rm -rf config.{cache,status} ; \
56 $(TARGET_CONFIGURE_OPTS) \
57 CXXFLAGS="-static -O2 -MD" \
58 CFLAGS="-static -MD" \
59 CPPFLAGS="-I$(STAGING_DIR)/usr/include" \
60 LDFLAGS="-L$(STAGING_DIR)/usr/lib" \
61 $(BUILDOPTS) \
62 ./configure \
63 --prefix=/usr \
64 --target=$(GNU_TARGET_NAME) \
65 --host=$(GNU_TARGET_NAME) \
66 --build=$(GNU_HOST_NAME) \
67 --enable-wifi \
68 --disable-linuxmodule \
69 --enable-tools=mixed \
70 --disable-dynamic-linking \
71 )
72 endef
73
74
75 define Build/Compile
76 rm -rf $(PKG_INSTALL_DIR)
77 mkdir -p $(PKG_INSTALL_DIR)
78 $(CONF_OPTS) \
79 $(MAKE) -C $(PKG_BUILD_DIR) \
80 $(BUILDOPTS) \
81 tools elementmap.xml
82 (cd $(PKG_BUILD_DIR)/userlevel; \
83 ../tools/click-mkmindriver/click-mkmindriver -p roofnet -C .. \
84 -f $(PKG_BUILD_DIR)/conf/wifi/sample.click \
85 -A --all -E IPNameInfo -E FromHost -E ToHost -E Discard; \
86 $(MAKE) -f Makefile.roofnet; \
87 )
88 endef
89
90 define Package/click/install
91 $(INSTALL_DIR) $(1)/usr/bin
92 $(CP) $(PKG_BUILD_DIR)/userlevel/roofnetclick $(1)/usr/bin/click
93 $(CP) $(PKG_BUILD_DIR)/tools/click-align/click-align $(1)/usr/bin/click-align
94 endef
95
96 define Package/roofnet/install
97 $(INSTALL_DIR) $(1)/usr/bin
98 $(CP) $(PKG_BUILD_DIR)/conf/wifi/gen_config_roofnet.sh $(1)/usr/bin
99 $(CP) $(PKG_BUILD_DIR)/conf/wifi/srcr.click $(1)/usr/bin
100 $(CP) $(PKG_BUILD_DIR)/conf/wifi/read_handler $(1)/usr/bin
101 $(CP) $(PKG_BUILD_DIR)/conf/wifi/write_handler $(1)/usr/bin
102 mkdir -p $(1)/etc/init.d
103 $(INSTALL_BIN) ./files/roofnet.init $(1)/etc/init.d/roofnet
104 endef
105
106 $(eval $(call BuildPackage,click))
107 $(eval $(call BuildPackage,roofnet))