Makefile.in revision 146768
117683Spst#  Copyright (c) 1993, 1994, 1995, 1996
217683Spst# 	The Regents of the University of California.  All rights reserved.
317683Spst#
417683Spst#  Redistribution and use in source and binary forms, with or without
517683Spst#  modification, are permitted provided that: (1) source code distributions
617683Spst#  retain the above copyright notice and this paragraph in its entirety, (2)
717683Spst#  distributions including binary code include the above copyright notice and
817683Spst#  this paragraph in its entirety in the documentation or other materials
917683Spst#  provided with the distribution, and (3) all advertising materials mentioning
1017683Spst#  features or use of this software display the following acknowledgement:
1117683Spst#  ``This product includes software developed by the University of California,
1217683Spst#  Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
1317683Spst#  the University nor the names of its contributors may be used to endorse
1417683Spst#  or promote products derived from this software without specific prior
1517683Spst#  written permission.
1617683Spst#  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
1717683Spst#  WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
1817683Spst#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1917683Spst#
20146768Ssam# @(#) $Header: /tcpdump/master/libpcap/Makefile.in,v 1.99 2003/12/15 01:35:03 guy Exp $ (LBL)
2117683Spst
2217683Spst#
2317683Spst# Various configurable paths (remember to edit Makefile.in, not Makefile)
2417683Spst#
2517683Spst
2617683Spst# Top level hierarchy
2717683Spstprefix = @prefix@
2817683Spstexec_prefix = @exec_prefix@
2917683Spst# Pathname of directory to install the include files
3075107Sfennerincludedir = @includedir@
3117683Spst# Pathname of directory to install the library
3275107Sfennerlibdir =  @libdir@
3317683Spst# Pathname of directory to install the man page
3475107Sfennermandir = @mandir@
3517683Spst
3626175Sfenner# VPATH
3726175Sfennersrcdir = @srcdir@
3826175SfennerVPATH = @srcdir@
3926175Sfenner
4017683Spst#
4117683Spst# You shouldn't need to edit anything below.
4217683Spst#
4317683Spst
4417683SpstCC = @CC@
4517683SpstCCOPT = @V_CCOPT@
4617683SpstINCLS = -I. @V_INCLS@
47127664SbmsDEFS = @DEFS@ @V_DEFS@
48127664SbmsLIBS = @V_LIBS@
49146768SsamDYEXT = @DYEXT@
5017683Spst
5117683Spst# Standard CFLAGS
5217683SpstCFLAGS = $(CCOPT) $(INCLS) $(DEFS)
5317683Spst
5417683SpstINSTALL = @INSTALL@
5575107SfennerINSTALL_PROGRAM = @INSTALL_PROGRAM@
5675107SfennerINSTALL_DATA = @INSTALL_DATA@
5775107SfennerRANLIB = @RANLIB@
5817683Spst
5917683Spst#
6017683Spst# Flex and bison allow you to specify the prefixes of the global symbols
6117683Spst# used by the generated parser.  This allows programs to use lex/yacc
6217683Spst# and link against libpcap.  If you don't have flex or bison, get them.
6317683Spst#
6417683SpstLEX = @V_LEX@
6517683SpstYACC = @V_YACC@
6617683Spst
6717683Spst# Explicitly define compilation rule since SunOS 4's make doesn't like gcc.
6817683Spst# Also, gcc does not remove the .o before forking 'as', which can be a
6917683Spst# problem if you don't own the file but can write to the directory.
7017683Spst.c.o:
7117683Spst	@rm -f $@
7226175Sfenner	$(CC) $(CFLAGS) -c $(srcdir)/$*.c
7317683Spst
7417683SpstPSRC =	pcap-@V_PCAP@.c
75127664SbmsFSRC =  fad-@V_FINDALLDEVS@.c
76127664SbmsSSRC =  @SSRC@
7717683SpstCSRC =	pcap.c inet.c gencode.c optimize.c nametoaddr.c \
7875107Sfenner	etherent.c savefile.c bpf_filter.c bpf_image.c bpf_dump.c
7939291SfennerGENSRC = scanner.c grammar.c version.c
8075107SfennerLIBOBJS = @LIBOBJS@
8117683Spst
82127664SbmsSRC =	$(PSRC) $(FSRC) $(CSRC) $(SSRC) $(GENSRC)
8317683Spst
8417683Spst# We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
8517683Spst# hack the extra indirection
86127664SbmsOBJ =	$(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) $(LIBOBJS)
8717683SpstHDR =	pcap.h pcap-int.h pcap-namedb.h pcap-nit.h pcap-pf.h \
8817683Spst	ethertype.h gencode.h gnuc.h
8917683SpstGENHDR = \
90127664Sbms	tokdefs.h version.h
9117683Spst
9217683SpstTAGHDR = \
93127664Sbms	pcap-bpf.h
9417683Spst
9517683SpstTAGFILES = \
9617683Spst	$(SRC) $(HDR) $(TAGHDR)
9717683Spst
9817683SpstCLEANFILES = $(OBJ) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c
9917683Spst
10039291Sfennerall: libpcap.a
10139291Sfenner
10217683Spstlibpcap.a: $(OBJ)
10326175Sfenner	@rm -f $@
104127664Sbms	ar rc $@ $(OBJ) $(LIBS)
10517683Spst	$(RANLIB) $@
10617683Spst
107146768Ssamshared: libpcap.$(DYEXT)
108146768Ssam
109146768Ssam#
110146768Ssam# XXX - this works with GNU ld, but won't necessarily work with native
111146768Ssam# ld on, for example, various SVR4-flavored platforms, or Digital UNIX.
112146768Ssam#
113146768Ssamlibpcap.so: $(OBJ)
114146768Ssam	@rm -f $@
115146768Ssam	ld -shared -o $@.`cat VERSION` $(OBJ)
116146768Ssam
117146768Ssam# the following rule succeeds, but the result is untested.
118146768Ssamlibpcap.dylib: $(OBJ)
119146768Ssam	rm -f libpcap*.dylib
120146768Ssam	$(CC) -dynamiclib -undefined error -o libpcap.`cat VERSION`.dylib $(OBJ) \
121146768Ssam		-install_name $(libdir)/libpcap.0.dylib -compatibility_version `cat VERSION` \
122146768Ssam		-current_version `cat VERSION`
123146768Ssam
124146768Ssam
12526175Sfennerscanner.c: $(srcdir)/scanner.l
12626175Sfenner	@rm -f $@
12726175Sfenner	$(LEX) -t $< > $$$$.$@; mv $$$$.$@ $@
12817683Spst
12917683Spstscanner.o: scanner.c tokdefs.h
13056889Sfenner	$(CC) $(CFLAGS) -c scanner.c
13156889Sfenner
132127664Sbmspcap.o: version.h
133127664Sbms
13417683Spsttokdefs.h: grammar.c
13526175Sfennergrammar.c: $(srcdir)/grammar.y
13626175Sfenner	@rm -f grammar.c tokdefs.h
13717683Spst	$(YACC) -d $<
13817683Spst	mv y.tab.c grammar.c
13917683Spst	mv y.tab.h tokdefs.h
14017683Spst
14117683Spstgrammar.o: grammar.c
14226175Sfenner	@rm -f $@
14326175Sfenner	$(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c
14417683Spst
14539291Sfennerversion.o: version.c
14656889Sfenner	$(CC) $(CFLAGS) -c version.c
14756889Sfenner
148127664Sbmssnprintf.o: $(srcdir)/missing/snprintf.c
149127664Sbms	$(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
15075107Sfenner
15139291Sfennerversion.c: $(srcdir)/VERSION
15239291Sfenner	@rm -f $@
15339291Sfenner	sed -e 's/.*/char pcap_version[] = "&";/' $(srcdir)/VERSION > $@
15439291Sfenner
155127664Sbms#
156127664Sbms# NOTE: this really is supposed to be static; importing a string
157127664Sbms# from a shared library does not work very well on many
158127664Sbms# versions of UNIX (Solaris, Linux, and the BSDs, for example),
159127664Sbms# so we make the version string static and return it from
160127664Sbms# a function, which does work.
161127664Sbms#
162127664Sbmsversion.h: $(srcdir)/VERSION
163127664Sbms	@rm -f $@
164127664Sbms	sed -e 's/.*/static const char pcap_version_string[] = "libpcap version &";/' $(srcdir)/VERSION > $@
165127664Sbms
16675107Sfennerbpf_filter.c: $(srcdir)/bpf/net/bpf_filter.c
16775107Sfenner	rm -f bpf_filter.c
16875107Sfenner	ln -s $(srcdir)/bpf/net/bpf_filter.c bpf_filter.c
16956889Sfenner
17075107Sfennerbpf_filter.o: bpf_filter.c
17175107Sfenner	$(CC) $(CFLAGS) -c bpf_filter.c
17217683Spst
173146768Ssaminstall: libpcap.a 
17475107Sfenner	[ -d $(DESTDIR)$(libdir) ] || \
17575107Sfenner	    (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
17675107Sfenner	$(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a
17775107Sfenner	$(RANLIB) $(DESTDIR)$(libdir)/libpcap.a
17875107Sfenner	[ -d $(DESTDIR)$(includedir) ] || \
17975107Sfenner	    (mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir))
18075107Sfenner	$(INSTALL_DATA) $(srcdir)/pcap.h $(DESTDIR)$(includedir)/pcap.h
181127664Sbms	$(INSTALL_DATA) $(srcdir)/pcap-bpf.h \
182127664Sbms	    $(DESTDIR)$(includedir)/pcap-bpf.h
18375107Sfenner	$(INSTALL_DATA) $(srcdir)/pcap-namedb.h \
18475107Sfenner	    $(DESTDIR)$(includedir)/pcap-namedb.h
18575107Sfenner	[ -d $(DESTDIR)$(mandir)/man3 ] || \
18675107Sfenner		(mkdir -p $(DESTDIR)$(mandir)/man3; chmod 755 $(DESTDIR)$(mandir)/man3)
18775107Sfenner	$(INSTALL_DATA) $(srcdir)/pcap.3 \
18875107Sfenner	    $(DESTDIR)$(mandir)/man3/pcap.3
18917683Spst
190146768Ssaminstall-shared: install-shared-$(DYEXT)
191146768Ssaminstall-shared-so: libpcap.so
192146768Ssam	$(INSTALL_PROGRAM) libpcap.so.`cat VERSION` $(DESTDIR)$(libdir)/libpcap.so.`cat VERSION`
193146768Ssaminstall-shared-dylib: libpcap.dylib
194146768Ssam	$(INSTALL_PROGRAM) libpcap.`cat VERSION`.dylib $(DESTDIR)$(libdir)/libpcap.`cat VERSION`.dylib
195146768Ssam	VER=`cat VERSION`; cd $(DESTDIR)$(libdir) && ln -sf libpcap.$$VER.dylib libpcap.0.dylib;  ln -sf libpcap.0.dylib libpcap.dylib
196146768Ssam
19775107Sfenneruninstall:
19875107Sfenner	rm -f $(DESTDIR)$(libdir)/libpcap.a
19975107Sfenner	rm -f $(DESTDIR)$(includedir)/pcap.h
200127664Sbms	rm -f $(DESTDIR)$(includedir)/pcap-bpf.h
20175107Sfenner	rm -f $(DESTDIR)$(includedir)/pcap-namedb.h
20275107Sfenner	rm -f $(DESTDIR)$(mandir)/man3/pcap.3
20317683Spst
20417683Spstclean:
205146768Ssam	rm -f $(CLEANFILES) libpcap*.dylib libpcap.so*
20617683Spst
207146768Ssamdistclean: clean
208146768Ssam	rm -f Makefile config.cache config.log config.status \
209127664Sbms	    config.h gnuc.h os-proto.h bpf_filter.c stamp-h stamp-h.in
210146768Ssam	rm -rf autom4te.cache
21117683Spst
21217683Spsttags: $(TAGFILES)
21317683Spst	ctags -wtd $(TAGFILES)
21417683Spst
215146768Ssampackaging/pcap.spec: packaging/pcap.spec.in VERSION
216146768Ssam	RPMVERSION=`cat VERSION | sed s/-.*//g`; \
217146768Ssam		sed -e s/@VERSION@/$$RPMVERSION/ -e s/@NAME@/libpcap-`cat VERSION`/ $<   > $@
218146768Ssam
219146768Ssamtar: Makefile packaging/pcap.spec
22017683Spst	@cwd=`pwd` ; dir=`basename $$cwd` ; name=libpcap-`cat VERSION` ; \
22175107Sfenner	    list="" ; tar="tar chf" ; \
22217683Spst	    for i in `cat FILES` ; do list="$$list $$name/$$i" ; done; \
22317683Spst	    echo \
22417683Spst	    "rm -f ../$$name; ln -s $$dir ../$$name" ; \
22517683Spst	     rm -f ../$$name; ln -s $$dir ../$$name ; \
22617683Spst	    echo \
227146768Ssam	    "(cd .. ; $$tar - [lots of files]) | gzip -c > /tmp/$$name.tar.gz" ; \
228146768Ssam	     (cd .. ; $$tar - $$list) | gzip -c > /tmp/$$name.tar.gz ; \
22917683Spst	    echo \
23017683Spst	    "rm -f ../$$name" ; \
23117683Spst	     rm -f ../$$name
23217683Spst
233127664Sbmsdepend:	$(GENSRC) $(GENHDR) bpf_filter.c
23417683Spst	./mkdep -c $(CC) $(DEFS) $(INCLS) $(SRC)
235146768Ssam
236146768SsamMakefile: Makefile.in config.status
237146768Ssam	./config.status
238146768Ssam	@echo your Makefile was out of date, now run $(MAKE) again
239146768Ssam	exit 1
240