4 # GNUMakefile to build the userland part of ipfw on Linux and Windows
6 # enable extra debugging information
7 # Do not set with = or := so we can inherit from the caller
8 XOSARCH := $(shell uname)
10 $(warning Building userland ipfw for $(VER) $(OSARCH))
17 EXTRA_CFLAGS += -include ../glue.h
18 EXTRA_CFLAGS += -I ./include_e -I ./include
21 ifneq ($(VER),openwrt)
22 ifeq ($(OSARCH),Linux)
23 EXTRA_CFLAGS += -D__BSD_VISIBLE
24 EXTRA_CFLAGS += -Werror
25 else # must be Cygwin ?
27 EXTRA_CFLAGS += -I/cygdrive/c/WinDDK/7600.16385.0/inc/ddk
29 EXTRA_CFLAGS += -pipe -Wall
31 # TCC points to the root of tcc tree
33 EXTRA_CFLAGS += -DTCC -I..
34 EXTRA_CFLAGS += -I$(TCC)/include/winapi -I$(TCC)/include
35 EXTRA_CFLAGS += -nostdinc
37 EDIRS += arpa net netinet sys
38 EFILES += err.h grp.h netdb.h pwd.h sysexits.h
41 EFILES += netinet/in.h netinet/in_systm.h netinet/ip.h
42 EFILES += netinet/ip_icmp.h
43 EFILES += sys/cdefs.h sys/wait.h
44 EFILES += sys/ioctl.h sys/socket.h
46 # EXTRA_CFLAGS += -D_WIN32 # see who defines it
47 EXTRA_CFLAGS += -Dsetsockopt=wnd_setsockopt
48 EXTRA_CFLAGS += -Dgetsockopt=wnd_getsockopt
49 EXTRA_CFLAGS += -DEMULATE_SYSCTL
51 EFILES += net/ethernet.h net/route.h
52 EFILES += netinet/ether.h netinet/icmp6.h
53 EFILES += sys/sysctl.h
58 CFLAGS += $(EXTRA_CFLAGS)
59 # Location of OS headers and libraries. After our stuff.
62 CFLAGS += -I$(USRDIR)/include
63 LDFLAGS += -L$(USRDIR)/lib
65 LDFLAGS += -L. -lws2_32
68 OBJS = ipfw2.o dummynet.o main.o ipv6.o qsort_r.o
69 OBJS += expand_number.o humanize_number.o glue.o
76 echo "Done build for $(OSARCH) VER $(VER)"
79 $(CC) $(LDFLAGS) -o $@ $^
81 $(OBJS) : ipfw2.h ../glue.h include_e
83 # support to create empty dirs and files in include_e/
84 # EDIRS is the list of directories, EFILES is the list of files.
86 EFILES += sys/sockio.h libutil.h
92 -@rm -rf $(M)/include_e opt_*
93 -@mkdir -p $(M)/include_e
94 -@(cd $(M)/include_e; mkdir -p $(EDIRS); touch $(EFILES) )
95 -@(cd $(M)/include_e/netinet; \
96 for i in ip_fw.h ip_dummynet.h tcp.h; do \
97 cp ../../../dummynet2/include/netinet/$$i .; done; )
100 -rm -f $(OBJS) $(TARGET)
101 -rm -rf include/netinet/ include_e