Grab the lock before reading uid/gid related structure, this will
[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 # comment this on planetlab
11 #EXTRA_CFLAGS += -Wall -Werror
12 EXTRA_CFLAGS += -include ../glue.h
13 EXTRA_CFLAGS += -I ./include
14
15 ifneq ($(VER),openwrt)
16 OSARCH := $(shell uname)
17 ifeq ($(OSARCH),Linux)
18     EXTRA_CFLAGS += -D__BSD_VISIBLE
19 else
20     HAVE_NAT := $(shell grep O_NAT /usr/include/netinet/ip_fw.h)
21     # EXTRA_CFLAGS += ...
22 endif
23 endif # !openwrt
24
25 CFLAGS += $(EXTRA_CFLAGS)
26 # Location of OS headers and libraries. After our stuff.
27 USRDIR?= /usr
28 CFLAGS += -I$(USRDIR)/include
29 LDFLAGS += -L$(USRDIR)/lib
30
31 OBJS = ipfw2.o dummynet.o main.o ipv6.o altq.o qsort_r.o
32 OBJS += expand_number.o humanize_number.o
33 ifneq ($(HAVE_NAT),)
34     OBJS += nat.o
35     EXTRA_CFLAGS += -DHAVE_NAT
36 endif
37 OBJS += glue.o
38
39 all: ipfw
40         echo "VER is $(VER)"
41
42 ipfw: $(OBJS)
43         $(CC) $(LDFLAGS) -o $@ $^
44
45 $(OBJS) : ipfw2.h ../glue.h include/netinet
46
47 include/netinet:
48         -@rm -rf include/netinet
49         -@mkdir -p include/netinet
50         -(cd include/netinet; \
51                 for i in ip_fw.h ip_dummynet.h tcp.h; do \
52                 ln -s ../../../dummynet/include/netinet/$$i; done; )
53
54 clean distclean:
55         -rm -f $(OBJS) ipfw