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