# Makefile to build the package in openwrt.
-# goes into package/ipfw3/Makefile
+# goes into package/network/utils/ipfw3/Makefile
#
# Edit IPFW_DIR to point to the directory with the sources for ipfw
include $(INCLUDE_DIR)/package.mk
#Stuff depending on kernel version
-ifeq ($(KERNEL),2.6)
+$(warning -------- -kernel version $(KERNEL) -------)
-VERS:=2.6
-IPFW_MOD:=ipfw_mod.ko
-IPFW_SRC_DIR:=M
+ifeq ($(KERNEL),2.4)
+ VERS:=openwrt
+ CFLAGS_WRT:=-DSYSCTL_NODE -DEMULATE_SYSCTL
+ IPFW_MOD:=ipfw_mod.o
+ IPFW_SRC_DIR:=SUBDIRS
else
-
-VERS:=openwrt
-CFLAGS_WRT:=-DSYSCTL_NODE -DEMULATE_SYSCTL
-IPFW_MOD:=ipfw_mod.o
-IPFW_SRC_DIR:=SUBDIRS
-
+ VERS:=2.6
+ IPFW_MOD:=ipfw_mod.ko
+ IPFW_SRC_DIR:=M
endif
# Description for the package.
endef
define Build/Compile
+ # compile the userland part for openwrt
+ $(MAKE) -C $(PKG_BUILD_DIR)/ipfw \
+ $(TARGET_CONFIGURE_OPTS) \
+ CFLAGS="$(TARGET_CFLAGS) $(CFLAGS_WRT) -I./include_e -I./include -include ../glue.h -DNO_ALTQ -D__BSD_VISIBLE" \
+ VER=$(VERS) all
# compile the kernel part for openwrt
$(MAKE) -C "$(LINUX_DIR)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
$(IPFW_SRC_DIR)="$(PKG_BUILD_DIR)/kipfw" \
IPFW3_ROOT="$(PKG_BUILD_DIR)" \
_VER=$(VERS) modules
- # compile the userland part for openwrt
- $(MAKE) -C $(PKG_BUILD_DIR)/ipfw \
- $(TARGET_CONFIGURE_OPTS) \
- CFLAGS="$(TARGET_CFLAGS) $(CFLAGS_WRT) -I./include_e -I./include -include ../glue.h -DNO_ALTQ -D__BSD_VISIBLE" \
- _VER=$(VERS) all
+endef
+
+define Build/Compile_new
+ $(call Build/Compile/Default)
+ $(call Build/Compile/Default,modules)
endef
define Package/ipfw3-userland
# lets default for 2.6 for planetlab builds
VER ?= 2.6
+$(warning ########## linux dir is $(LINUX_DIR) ###########)
#--- General values for all types of build ---
# obj-m is the target module
obj-m := ipfw_mod.o
$(warning ------ arch $(OSARCH) goals $(MAKECMDGOALS) -----------)
ifeq ($(OSARCH),Windows) #--- { Windows block
-ifeq ($(VER),win64)
+ ifeq ($(VER),win64)
$(warning ---- building for 64-bit windows ---)
win_arch= -DAMD64=1
-else
+ else
win_arch= -Di386=1
-endif
+ endif
M ?= $(shell pwd)
WIN_SRCS += md_win.c
WIN_SRCS += miniport.c protocol.c passthru.c debug.c
OUR_PREPROC += -D__BSD_VISIBLE -DIPFIREWALL_DEFAULT_TO_ACCEPT
OUR_PREPROC += -D__LITTLE_ENDIAN -DSYSCTL_NODE -DEMULATE_SYSCTL
-ifeq ($(TCC),) # Microsoft C compiler
+ ifeq ($(TCC),) # Microsoft C compiler
CC = $(DDK)/bin/x86/x86/cl.exe
LD = $(DDK)/bin/x86/x86/link.exe
# #complier options
LIBS += $(DDK)/lib/wxp/i386/wmilib.lib
LIBS += $(DDK)/lib/wxp/i386/ndis.lib
LIBS += $(DDK)/lib/wxp/i386/sehupd.lib
-else # use tcc. not working yet for the kernel module.
+ else # use tcc. not working yet for the kernel module.
# TCC points to the root of tcc tree
CC=$(TCC)/bin/wintcc
EXTRA_CFLAGS += -DTCC -I..
CFLAGS += -include winmissing.h -include missing.h -include ../glue.h
CFLAGS += -I../../inc/api -I../../inc/ddk -I../../inc/crt
CFLAGS += -DRC_INVOKED
-endif # use tcc
+ endif # use tcc
#empty include directory to be built
M ?= $(shell pwd)
grep LINUX_VERSION_CODE $(KERNELPATH)/include/$${G}/linux/version.h | \
awk '{printf "%03x%02x", $$3/256, $$3%256} ')
- # awk '{printf "%d %03x%02d", $$3, $$3/256, $$3%256} ')
- # $(warning version $(LINUX_VERSION_CODE))
- $(warning ------------- linux 2.6 and newer $(LIN_VER) ------------)
+ $(warning ------------- linux version $(LIN_VER) (hex) ------------)
# We have three sections: OpenWrt, Linux 2.4 and Linux 2.6
ifeq ($(LIN_VER),openwrt) #--- { The Makefile section for openwrt ---
- $(error ------ build on openwrt ---------- )
+ # this was used on openwrt, but not anymore
+ $(error ------ build on openwrt ---------- )
# We do not include a dependency on include_e as it is called
# by Makefile.openwrt in Build/Prepare
M=.
# This is the Makefile section for Linux 2.6.x including planetlab
-ifeq ($(IPFW_PLANETLAB),1)
- $(warning "---- Building for PlanetLab")
- ipfw-cflags += -DIPFW_PLANETLAB # PlanetLab compilation
-endif
-# $(warning "---- Building Version 2.6 $(VER) in $(KERNELPATH)")
+ ifeq ($(IPFW_PLANETLAB),1)
+ $(warning "---- Building for PlanetLab")
+ ipfw-cflags += -DIPFW_PLANETLAB # PlanetLab compilation
+ endif
+
WARN := -O1 -Wall -Werror -DDEBUG_SPINLOCK -DDEBUG_MUTEXES
# The main target
endif
# Required by kernel < 2.6.23, ccflags-y is used on newer version
- ifeq ($(shell if [ "$(LIN_VER)" \< "20617" ] ; then echo "true"; fi),true)
+ ifeq ($(shell [ "$(LIN_VER)" \< "20617" ] && echo "true"),true)
EXTRA_CFLAGS += $(ccflags-y)
endif
#--- openwrt ?
ifeq ($(_VER),openwrt)
+ $(warning ----------------------- compiling for openwrt -----)
M=.
obj-y := $(IPFW_SRCS:%.c=%.o)
O_TARGET := $(obj-m)