Update the work on ipfw tables, reduce diffs.
[ipfw.git] / Makefile.openwrt
1 # Makefile to build the package in openwrt.
2 # goes into package/ipfw2/Makefile
3 #
4 # Edit IPFW_DIR to point to the directory with the sources for ipfw
5
6 IPFW_DIR := $(TOPDIR)/../ipfw_mod
7
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/kernel.mk
10
11 PKG_NAME:=kmod-ipfw2
12 PKG_RELEASE:=1
13
14 # MV is undefined
15 MV ?= mv
16
17 include $(INCLUDE_DIR)/package.mk
18
19 # Description for the package.
20 # The names KernelPackage/ipfw2 must match the arguments to the
21 # call $(eval $(call KernelPackage,ipfw2)) used to build it
22
23
24 define KernelPackage/ipfw2
25  SUBMENU:=Other modules
26  TITLE:= IPFW and dummynet
27  # FILES is what makes up the module, both kernel and userland
28  # It must be in the KernelPackage section
29  FILES := $(PKG_BUILD_DIR)/dummynet/ipfw_mod.o $(PKG_BUILD_DIR)/ipfw/ipfw
30  # AUTOLOAD:=$(call AutoLoad,80,ipfw_mod)
31 endef
32
33 define KernelPackage/ipfw2/description
34  This package contains the ipfw and dummynet module
35 endef
36
37 # Standard entries for the openwrt builds: Build/Prepare and Build/Compile
38 # Remember that commands must start with a tab
39
40 # 'prepare' instructions for both kernel and userland
41 # We copy the entire subtree, then build include_e/ which
42 # contains empty headers used by the kernel sources.
43 define Build/Prepare
44   # $(warning Preparing ipfw sources)
45         mkdir -p $(PKG_BUILD_DIR)
46         $(CP) -Rp $(IPFW_DIR)/* $(PKG_BUILD_DIR)/
47         (cd $(PKG_BUILD_DIR)/dummynet && $(MAKE) include_e )
48 endef
49
50 define Build/Compile
51         # compile the kernel part for openwrt
52         $(MAKE) -C "$(LINUX_DIR)" \
53                 CROSS_COMPILE="$(TARGET_CROSS)" \
54                 ARCH="$(LINUX_KARCH)" \
55                 SUBDIRS="$(PKG_BUILD_DIR)/dummynet" \
56                 VER=openwrt modules
57         # compile the userland part for openwrt
58         $(MAKE) -C $(PKG_BUILD_DIR)/ipfw \
59                 $(TARGET_CONFIGURE_OPTS) \
60                 CFLAGS="$(TARGET_CFLAGS) -I./include -include ../glue.h" \
61                 VER=openwrt all
62 endef
63
64 define Package/ipfw2-userland
65   SECTION:=utils
66   CATEGORY:=Utilities
67   TITLE := /sbin/ipfw
68   DESCRIPTION := This is the control program for ipfw and dummynet
69 endef
70
71 define Package/ipfw2-userland/install
72         $(INSTALL_DIR) $(1) /sbin
73 endef
74
75 # XXX not entirely clear why the install entry for userland works,
76 # given that /sbin/ipfw is in KernelPackage/ipfw2
77
78 $(eval $(call Package,ipfw2-userland))
79 $(eval $(call KernelPackage,ipfw2))