Makefile.in revision 127664
1169689Skan#  Copyright (c) 1993, 1994, 1995, 1996
2169689Skan# 	The Regents of the University of California.  All rights reserved.
3169689Skan#
4169689Skan#  Redistribution and use in source and binary forms, with or without
5169689Skan#  modification, are permitted provided that: (1) source code distributions
6169689Skan#  retain the above copyright notice and this paragraph in its entirety, (2)
7169689Skan#  distributions including binary code include the above copyright notice and
8169689Skan#  this paragraph in its entirety in the documentation or other materials
9169689Skan#  provided with the distribution, and (3) all advertising materials mentioning
10169689Skan#  features or use of this software display the following acknowledgement:
11169689Skan#  ``This product includes software developed by the University of California,
12169689Skan#  Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
13169689Skan#  the University nor the names of its contributors may be used to endorse
14169689Skan#  or promote products derived from this software without specific prior
15169689Skan#  written permission.
16169689Skan#  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
17169689Skan#  WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
18169689Skan#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19169689Skan#
20169689Skan# @(#) $Header: /tcpdump/master/libpcap/Makefile.in,v 1.96.2.1 2003/12/15 01:42:23 guy Exp $ (LBL)
21169689Skan
22169689Skan#
23169689Skan# Various configurable paths (remember to edit Makefile.in, not Makefile)
24169689Skan#
25169689Skan
26169689Skan# Top level hierarchy
27169689Skanprefix = @prefix@
28169689Skanexec_prefix = @exec_prefix@
29169689Skan# Pathname of directory to install the include files
30169689Skanincludedir = @includedir@
31169689Skan# Pathname of directory to install the library
32169689Skanlibdir =  @libdir@
33169689Skan# Pathname of directory to install the man page
34169689Skanmandir = @mandir@
35169689Skan
36# VPATH
37srcdir = @srcdir@
38VPATH = @srcdir@
39
40#
41# You shouldn't need to edit anything below.
42#
43
44CC = @CC@
45CCOPT = @V_CCOPT@
46INCLS = -I. @V_INCLS@
47DEFS = @DEFS@ @V_DEFS@
48LIBS = @V_LIBS@
49
50# Standard CFLAGS
51CFLAGS = $(CCOPT) $(INCLS) $(DEFS)
52
53INSTALL = @INSTALL@
54INSTALL_PROGRAM = @INSTALL_PROGRAM@
55INSTALL_DATA = @INSTALL_DATA@
56RANLIB = @RANLIB@
57
58#
59# Flex and bison allow you to specify the prefixes of the global symbols
60# used by the generated parser.  This allows programs to use lex/yacc
61# and link against libpcap.  If you don't have flex or bison, get them.
62#
63LEX = @V_LEX@
64YACC = @V_YACC@
65
66# Explicitly define compilation rule since SunOS 4's make doesn't like gcc.
67# Also, gcc does not remove the .o before forking 'as', which can be a
68# problem if you don't own the file but can write to the directory.
69.c.o:
70	@rm -f $@
71	$(CC) $(CFLAGS) -c $(srcdir)/$*.c
72
73PSRC =	pcap-@V_PCAP@.c
74FSRC =  fad-@V_FINDALLDEVS@.c
75SSRC =  @SSRC@
76CSRC =	pcap.c inet.c gencode.c optimize.c nametoaddr.c \
77	etherent.c savefile.c bpf_filter.c bpf_image.c bpf_dump.c
78GENSRC = scanner.c grammar.c version.c
79LIBOBJS = @LIBOBJS@
80
81SRC =	$(PSRC) $(FSRC) $(CSRC) $(SSRC) $(GENSRC)
82
83# We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
84# hack the extra indirection
85OBJ =	$(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) $(LIBOBJS)
86HDR =	pcap.h pcap-int.h pcap-namedb.h pcap-nit.h pcap-pf.h \
87	ethertype.h gencode.h gnuc.h
88GENHDR = \
89	tokdefs.h version.h
90
91TAGHDR = \
92	pcap-bpf.h
93
94TAGFILES = \
95	$(SRC) $(HDR) $(TAGHDR)
96
97CLEANFILES = $(OBJ) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c
98
99all: libpcap.a
100
101libpcap.a: $(OBJ)
102	@rm -f $@
103	ar rc $@ $(OBJ) $(LIBS)
104	$(RANLIB) $@
105
106scanner.c: $(srcdir)/scanner.l
107	@rm -f $@
108	$(LEX) -t $< > $$$$.$@; mv $$$$.$@ $@
109
110scanner.o: scanner.c tokdefs.h
111	$(CC) $(CFLAGS) -c scanner.c
112
113pcap.o: version.h
114
115tokdefs.h: grammar.c
116grammar.c: $(srcdir)/grammar.y
117	@rm -f grammar.c tokdefs.h
118	$(YACC) -d $<
119	mv y.tab.c grammar.c
120	mv y.tab.h tokdefs.h
121
122grammar.o: grammar.c
123	@rm -f $@
124	$(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c
125
126version.o: version.c
127	$(CC) $(CFLAGS) -c version.c
128
129snprintf.o: $(srcdir)/missing/snprintf.c
130	$(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
131
132version.c: $(srcdir)/VERSION
133	@rm -f $@
134	sed -e 's/.*/char pcap_version[] = "&";/' $(srcdir)/VERSION > $@
135
136#
137# NOTE: this really is supposed to be static; importing a string
138# from a shared library does not work very well on many
139# versions of UNIX (Solaris, Linux, and the BSDs, for example),
140# so we make the version string static and return it from
141# a function, which does work.
142#
143version.h: $(srcdir)/VERSION
144	@rm -f $@
145	sed -e 's/.*/static const char pcap_version_string[] = "libpcap version &";/' $(srcdir)/VERSION > $@
146
147bpf_filter.c: $(srcdir)/bpf/net/bpf_filter.c
148	rm -f bpf_filter.c
149	ln -s $(srcdir)/bpf/net/bpf_filter.c bpf_filter.c
150
151bpf_filter.o: bpf_filter.c
152	$(CC) $(CFLAGS) -c bpf_filter.c
153
154install:
155	[ -d $(DESTDIR)$(libdir) ] || \
156	    (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
157	$(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a
158	$(RANLIB) $(DESTDIR)$(libdir)/libpcap.a
159	[ -d $(DESTDIR)$(includedir) ] || \
160	    (mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir))
161	$(INSTALL_DATA) $(srcdir)/pcap.h $(DESTDIR)$(includedir)/pcap.h
162	$(INSTALL_DATA) $(srcdir)/pcap-bpf.h \
163	    $(DESTDIR)$(includedir)/pcap-bpf.h
164	$(INSTALL_DATA) $(srcdir)/pcap-namedb.h \
165	    $(DESTDIR)$(includedir)/pcap-namedb.h
166	[ -d $(DESTDIR)$(mandir)/man3 ] || \
167		(mkdir -p $(DESTDIR)$(mandir)/man3; chmod 755 $(DESTDIR)$(mandir)/man3)
168	$(INSTALL_DATA) $(srcdir)/pcap.3 \
169	    $(DESTDIR)$(mandir)/man3/pcap.3
170
171uninstall:
172	rm -f $(DESTDIR)$(libdir)/libpcap.a
173	rm -f $(DESTDIR)$(includedir)/pcap.h
174	rm -f $(DESTDIR)$(includedir)/pcap-bpf.h
175	rm -f $(DESTDIR)$(includedir)/pcap-namedb.h
176	rm -f $(DESTDIR)$(mandir)/man3/pcap.3
177
178clean:
179	rm -f $(CLEANFILES)
180
181distclean:
182	rm -f $(CLEANFILES) Makefile config.cache config.log config.status \
183	    config.h gnuc.h os-proto.h bpf_filter.c stamp-h stamp-h.in
184
185tags: $(TAGFILES)
186	ctags -wtd $(TAGFILES)
187
188tar:
189	@cwd=`pwd` ; dir=`basename $$cwd` ; name=libpcap-`cat VERSION` ; \
190	    list="" ; tar="tar chf" ; \
191	    for i in `cat FILES` ; do list="$$list $$name/$$i" ; done; \
192	    echo \
193	    "rm -f ../$$name; ln -s $$dir ../$$name" ; \
194	     rm -f ../$$name; ln -s $$dir ../$$name ; \
195	    echo \
196	    "(cd .. ; $$tar - [lots of files]) | compress > /tmp/$$name.tar.Z" ; \
197	     (cd .. ; $$tar - $$list) | compress > /tmp/$$name.tar.Z ; \
198	    echo \
199	    "rm -f ../$$name" ; \
200	     rm -f ../$$name
201
202depend:	$(GENSRC) $(GENHDR) bpf_filter.c
203	./mkdep -c $(CC) $(DEFS) $(INCLS) $(SRC)
204