add winpcap 4.0.2 from url http://www.winpcap.org/
[natblaster.git] / Makefile
blob2d86226629706ddbad418e0fbf918a80f0c7c678
1 CC = gcc
2 INCLUDES = -I./src/share -I./src/peer -I./src/helper
3 PEER_LIBS = -L/usr/local/lib -lpcap -lnet
4 SHARE_LIBS = -lpthread
5 CFLAGS = -Wall -Werror -O3 -fno-strict-aliasing
6 LIBNET_FLAGS = -D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD -DHAVE_NET_ETHERNET_H
8 SHARE_OBJS = ./src/share/nethelp.o ./src/share/netio.o ./src/share/list.o ./src/share/util.o
10 PEER_EXE = peer
11 PEER_MAIN = ./src/stubs/peer.c
12 PEER_OBJS = ./src/peer/directconn.o ./src/peer/sniff.o ./src/peer/peercon.o \
13 ./src/peer/peerfsm.o ./src/peer/spoof.o ./src/peer/natblaster_peer.o
14 PEER_SO=libnatblaster_peer.so
16 HELPER_EXE = helper
17 HELPER_MAIN = ./src/stubs/helper.c
18 HELPER_OBJS = ./src/helper/helpercon.o ./src/helper/connlist.o \
19 ./src/helper/helperfsm.o ./src/helper/natblaster_helper.o
20 HELPER_SO=libnatblaster_helper.so
22 DOC = doxygen
23 DOC_DIR = doc
25 PRINT = enscript
26 PRINT_FILE = ps/natblasterv2_src.ps
28 FILES=./src/helper/*.[ch] ./src/peer/*.[ch] ./src/share/*.[ch] \
29 ./src/stubs/*.[ch]
31 .PHONY: all both html print clean help
33 all: both
35 %.o: %.c
36 $(CC) -c -o $(@) $(CFLAGS) $(INCLUDES) $(LIBNET_FLAGS) $(@:.o=.c)
38 both: $(PEER_EXE) $(HELPER_EXE)
40 $(PEER_EXE): $(PEER_SO)
41 $(CC) $(PEER_MAIN) -o $@ -L. -lnatblaster_peer -Wl,-rpath,$(shell pwd) $(INCLUDES) $(PEER_LIBS) $(SHARE_LIBS)
43 $(HELPER_EXE): $(HELPER_SO)
44 $(CC) $(HELPER_MAIN) -o $@ -L. -lnatblaster_helper -Wl,-rpath,$(shell pwd) $(INCLUDES) $(SHARE_LIBS)
46 $(PEER_SO): $(PEER_OBJS) $(SHARE_OBJS)
47 $(CC) -shared -fPIC -o $@ $^
49 $(HELPER_SO): $(HELPER_OBJS) $(SHARE_OBJS)
50 $(CC) -shared -fPIC -o $@ $^
52 html:
53 $(DOC) $(DOC_DIR)/doxygen.cfg
55 print:
56 $(PRINT) -2r -p $(PRINT_FILE) $(FILES)
57 @echo "The errorcodes.h file was included in the output,\
58 this makes the output longer than really necessary. Please\
59 manually create the postscript file if you do not want the\
60 errorcodes file included."
61 # '********************************************************'
62 # '* This will create a postscript file with all the code *'
63 # '* if you have enscript installed on your computer. *'
64 # '********************************************************'
66 clean:
67 rm -f $(PEER_OBJS) $(HELPER_OBJS) $(SHARE_OBJS)
68 rm -f $(PEER_EXE) $(HELPER_EXE)
69 rm -f $(PEER_SO) $(HELPER_SO)
70 rm -f $(PRINT_FILE)
71 rm -rf $(DOC_DIR)/html $(DOC_DIR)/latex $(DOC_DIR)/rtf
72 rm -rf $(DOC_DIR)/man $(DOC_DIR)/xml
74 help:
75 @echo "make all: compile peer and helper"
76 @echo "make both: same as make all"
77 @echo "make peer: compile the peer (requires libnet/libpcap)"
78 @echo "make helper: compile the helper (no libnet/libpcap required)"
79 @echo "make html: make the doxygen documentation (doxygen required)"
80 @echo "make print: make a postsript file with all the code (enscript required)"
81 @echo "make clean: clean up everything"