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