1#  Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
2# 	The Regents of the University of California.  All rights reserved.
3#
4#  Redistribution and use in source and binary forms, with or without
5#  modification, are permitted provided that: (1) source code distributions
6#  retain the above copyright notice and this paragraph in its entirety, (2)
7#  distributions including binary code include the above copyright notice and
8#  this paragraph in its entirety in the documentation or other materials
9#  provided with the distribution, and (3) all advertising materials mentioning
10#  features or use of this software display the following acknowledgement:
11#  ``This product includes software developed by the University of California,
12#  Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
13#  the University nor the names of its contributors may be used to endorse
14#  or promote products derived from this software without specific prior
15#  written permission.
16#  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
17#  WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
18#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19#
20# @(#) $Header: /tcpdump/master/tcpdump/Makefile.in,v 1.293.2.3 2005/09/20 06:05:36 guy Exp $ (LBL)
21
22#
23# Various configurable paths (remember to edit Makefile.in, not Makefile)
24#
25
26# Top level hierarchy
27prefix = /usr/local
28exec_prefix = ${prefix}
29# Pathname of directory to install the binary
30sbindir = ${exec_prefix}/sbin
31# Pathname of directory to install the man page
32mandir = ${prefix}/man
33
34# VPATH
35srcdir = .
36
37
38#
39# You shouldn't need to edit anything below here.
40#
41
42CC = gcc
43PROG = tcpdump
44CCOPT = -O2
45INCLS = -I.  -I$(srcdir)/missing
46DEFS = -DHAVE_CONFIG_H  -I$(srcdir)/missing  -D_U_="__attribute__((unused))"
47
48# Standard CFLAGS
49CFLAGS = $(CCOPT) $(DEFS) $(INCLS)
50
51# Standard LDFLAGS
52LDFLAGS = 
53
54# Standard LIBS
55LIBS = -lpcap -lsocket 
56
57INSTALL = /bin/install -c
58INSTALL_PROGRAM = ${INSTALL}
59INSTALL_DATA = ${INSTALL} -m 644
60
61# Explicitly define compilation rule since SunOS 4's make doesn't like gcc.
62# Also, gcc does not remove the .o before forking 'as', which can be a
63# problem if you don't own the file but can write to the directory.
64.c.o:
65	@rm -f $@
66	$(CC) $(CFLAGS) -c $(srcdir)/$*.c
67
68CSRC =	addrtoname.c cpack.c gmpls.c oui.c gmt2local.c ipproto.c \
69        nlpid.c l2vpn.c machdep.c parsenfsfh.c \
70	print-802_11.c print-ap1394.c print-ah.c print-arcnet.c \
71	print-aodv.c print-arp.c print-ascii.c print-atalk.c print-atm.c \
72	print-beep.c print-bfd.c print-bgp.c print-bootp.c print-cdp.c \
73	print-chdlc.c print-cip.c print-cnfp.c print-dccp.c print-decnet.c \
74	print-domain.c print-dvmrp.c print-enc.c print-egp.c \
75	print-eap.c print-eigrp.c\
76	print-esp.c print-ether.c print-fddi.c print-fr.c \
77	print-gre.c print-hsrp.c print-icmp.c print-igmp.c \
78	print-igrp.c print-ip.c print-ipcomp.c print-ipfc.c \
79	print-ipx.c print-isakmp.c print-isoclns.c print-juniper.c print-krb.c \
80	print-l2tp.c print-lane.c print-ldp.c print-llc.c \
81        print-lmp.c print-lspping.c \
82	print-lwres.c print-mobile.c print-mpls.c print-msdp.c \
83	print-nfs.c print-ntp.c print-null.c print-ospf.c \
84	print-pflog.c print-pgm.c print-pim.c print-ppp.c print-pppoe.c \
85	print-pptp.c print-radius.c print-raw.c print-rip.c \
86	print-rsvp.c print-rx.c print-sctp.c print-sip.c print-sl.c print-sll.c \
87	print-slow.c print-snmp.c print-stp.c print-sunatm.c print-sunrpc.c \
88	print-symantec.c print-syslog.c print-tcp.c print-telnet.c print-tftp.c \
89	print-timed.c print-token.c print-udp.c print-vjc.c print-vrrp.c \
90	print-wb.c print-zephyr.c setsignal.c tcpdump.c util.c
91
92LOCALSRC = print-smb.c smbutil.c 
93GENSRC = version.c
94LIBOBJS =  strsep$U.o datalinks$U.o dlnames$U.o pcap_dump_ftell$U.o inet_ntop$U.o inet_pton$U.o inet_aton$U.o bpf_dump$U.o
95
96SRC =	$(CSRC) $(GENSRC) $(LOCALSRC)
97
98# We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
99# hack the extra indirection
100OBJ =	$(CSRC:.c=.o) $(GENSRC:.c=.o) $(LOCALSRC:.c=.o) $(LIBOBJS)
101HDR =   addrtoname.h appletalk.h bootp.h cpack.h dccp.h decnet.h \
102	ethertype.h extract.h fddi.h gmt2local.h igrp.h interface.h \
103	ipx.h llc.h machdep.h mib.h nfsfh.h nfsv2.h ntp.h ospf.h \
104	setsignal.h \
105	gnuc.h ipsec_doi.h isakmp.h l2tp.h nameser.h \
106	netbios.h oakley.h ospf6.h pf.h ppp.h route6d.h
107
108TAGHDR = \
109	/usr/include/arpa/tftp.h \
110	/usr/include/net/if_arp.h \
111	/usr/include/net/slip.h \
112	/usr/include/netinet/if_ether.h \
113	/usr/include/netinet/in.h \
114	/usr/include/netinet/ip_icmp.h \
115	/usr/include/netinet/tcp.h \
116	/usr/include/netinet/udp.h \
117	/usr/include/protocols/routed.h
118
119TAGFILES = $(SRC) $(HDR) $(TAGHDR)
120
121CLEANFILES = $(PROG) $(OBJ) $(GENSRC)
122
123all: $(PROG)
124
125$(PROG): $(OBJ) 
126	@rm -f $@
127	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
128
129datalinks.o: $(srcdir)/missing/datalinks.c
130	$(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/datalinks.c
131dlnames.o: $(srcdir)/missing/dlnames.c
132	$(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/dlnames.c
133getnameinfo.o: $(srcdir)/missing/getnameinfo.c
134	$(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/getnameinfo.c
135getaddrinfo.o: $(srcdir)/missing/getaddrinfo.c
136	$(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/getaddrinfo.c
137inet_pton.o: $(srcdir)/missing/inet_pton.c
138	$(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/inet_pton.c
139inet_ntop.o: $(srcdir)/missing/inet_ntop.c
140	$(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/inet_ntop.c
141inet_aton.o: $(srcdir)/missing/inet_aton.c
142	$(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/inet_aton.c
143snprintf.o: $(srcdir)/missing/snprintf.c
144	$(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
145strlcat.o: $(srcdir)/missing/strlcat.c
146	$(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/strlcat.c
147strlcpy.o: $(srcdir)/missing/strlcpy.c
148	$(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/strlcpy.c
149strsep.o: $(srcdir)/missing/strsep.c
150	$(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/strsep.c
151
152version.o: version.c
153	$(CC) $(CFLAGS) -c version.c
154
155version.c: $(srcdir)/VERSION
156	@rm -f $@
157	sed -e 's/.*/char version[] = "&";/' $(srcdir)/VERSION > $@
158
159install:
160	[ -d $(DESTDIR)$(sbindir) ] || \
161	    (mkdir -p $(DESTDIR)$(sbindir); chmod 755 $(DESTDIR)$(sbindir))
162	$(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG)
163	[ -d $(DESTDIR)$(mandir)/man1 ] || \
164	    (mkdir -p $(DESTDIR)$(mandir)/man1; chmod 755 $(DESTDIR)$(mandir)/man1)
165	$(INSTALL_DATA) $(srcdir)/$(PROG).1 $(DESTDIR)$(mandir)/man1/$(PROG).1
166
167uninstall:
168	rm -f $(DESTDIR)$(sbindir)/$(PROG)
169	rm -f $(DESTDIR)$(mandir)/man1/$(PROG).1
170
171lint: $(GENSRC)
172	lint -hbxn $(SRC) | \
173	    grep -v 'struct/union .* never defined' | \
174	    grep -v 'possible pointer alignment problem'
175
176clean:
177	rm -f $(CLEANFILES)
178
179distclean:
180	rm -f $(CLEANFILES) Makefile config.cache config.log config.status \
181	    config.h gnuc.h os-proto.h stamp-h stamp-h.in
182
183tags: $(TAGFILES)
184	ctags -wtd $(TAGFILES)
185
186tar:
187	@cwd=`pwd` ; dir=`basename $$cwd` ; name=$(PROG)-`cat VERSION` ; \
188	    list="" ; tar="tar chf" ; \
189	    for i in `cat FILES` ; do list="$$list $$name/$$i" ; done; \
190	    echo \
191	    "rm -f ../$$name; ln -s $$dir ../$$name" ; \
192	     rm -f ../$$name; ln -s $$dir ../$$name ; \
193	    echo \
194	    "(cd .. ; $$tar - [lots of files]) | compress > /tmp/$$name.tar.Z" ; \
195	     (cd .. ; $$tar - $$list) | compress > /tmp/$$name.tar.Z ; \
196	    echo \
197	    "rm -f ../$$name" ; \
198	     rm -f ../$$name
199
200depend: $(GENSRC)
201	${srcdir}/mkdep -c $(CC) $(DEFS) $(INCLS) $(SRC)
202