Update the work on ipfw tables, reduce diffs.
[ipfw.git] / ipfw / Makefile
1 #
2 # $Id$
3 #
4 # GNUMakefile to build the userland part of ipfw on Linux
5 #
6 # enable extra debugging information
7 # Do not set with = or := so we can inherit from the caller
8 $(warning Building userland ipfw for $(VER))
9 EXTRA_CFLAGS += -O1
10 EXTRA_CFLAGS += -Wall -Werror
11 EXTRA_CFLAGS += -include ../glue.h
12 EXTRA_CFLAGS += -I ./include
13
14 ifneq ($(VER),openwrt)
15 OSARCH := $(shell uname)
16 ifeq ($(OSARCH),Linux)
17     EXTRA_CFLAGS += -D__BSD_VISIBLE
18 else
19     HAVE_NAT := $(shell grep O_NAT /usr/include/netinet/ip_fw.h)
20     # EXTRA_CFLAGS += ...
21 endif
22 endif # !openwrt
23
24 CFLAGS += $(EXTRA_CFLAGS)
25 # Location of OS headers and libraries. After our stuff.
26 USRDIR?= /usr
27 CFLAGS += -I$(USRDIR)/include
28 LDFLAGS += -L$(USRDIR)/lib
29
30 OBJS = ipfw2.o dummynet.o main.o ipv6.o altq.o qsort_r.o
31 OBJS += expand_number.o humanize_number.o
32 ifneq ($(HAVE_NAT),)
33     OBJS += nat.o
34     EXTRA_CFLAGS += -DHAVE_NAT
35 endif
36 OBJS += glue.o
37
38 all: ipfw
39         echo "VER is $(VER)"
40
41 ipfw: $(OBJS)
42         $(CC) $(LDFLAGS) -o $@ $^
43
44 $(OBJS) : ipfw2.h ../glue.h include/netinet
45
46 include/netinet:
47         -@rm -rf include/netinet
48         -@mkdir -p include/netinet
49         -(cd include/netinet; \
50                 for i in ip_fw.h ip_dummynet.h tcp.h; do \
51                 ln -s ../../../dummynet/include/netinet/$$i; done; )
52
53 clean distclean:
54         -rm -f $(OBJS) ipfw
55         -rm -rf include/netinet/