Makefile.in revision 182007
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#
20172677Smlaier# @(#) $Header: /tcpdump/master/libpcap/Makefile.in,v 1.99.2.2 2007/07/24 02:35:15 mcr 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@
49172677SmlaierDAGLIBS = @DAGLIBS@
50146768SsamDYEXT = @DYEXT@
51172677SmlaierPROG=libpcap
5217683Spst
5317683Spst# Standard CFLAGS
5417683SpstCFLAGS = $(CCOPT) $(INCLS) $(DEFS)
5517683Spst
5617683SpstINSTALL = @INSTALL@
5775107SfennerINSTALL_PROGRAM = @INSTALL_PROGRAM@
5875107SfennerINSTALL_DATA = @INSTALL_DATA@
5975107SfennerRANLIB = @RANLIB@
6017683Spst
6117683Spst#
6217683Spst# Flex and bison allow you to specify the prefixes of the global symbols
6317683Spst# used by the generated parser.  This allows programs to use lex/yacc
6417683Spst# and link against libpcap.  If you don't have flex or bison, get them.
6517683Spst#
6617683SpstLEX = @V_LEX@
6717683SpstYACC = @V_YACC@
6817683Spst
6917683Spst# Explicitly define compilation rule since SunOS 4's make doesn't like gcc.
7017683Spst# Also, gcc does not remove the .o before forking 'as', which can be a
7117683Spst# problem if you don't own the file but can write to the directory.
7217683Spst.c.o:
7317683Spst	@rm -f $@
7426175Sfenner	$(CC) $(CFLAGS) -c $(srcdir)/$*.c
7517683Spst
7617683SpstPSRC =	pcap-@V_PCAP@.c
77127664SbmsFSRC =  fad-@V_FINDALLDEVS@.c
78127664SbmsSSRC =  @SSRC@
7917683SpstCSRC =	pcap.c inet.c gencode.c optimize.c nametoaddr.c \
8075107Sfenner	etherent.c savefile.c bpf_filter.c bpf_image.c bpf_dump.c
8139291SfennerGENSRC = scanner.c grammar.c version.c
8275107SfennerLIBOBJS = @LIBOBJS@
8317683Spst
84127664SbmsSRC =	$(PSRC) $(FSRC) $(CSRC) $(SSRC) $(GENSRC)
8517683Spst
8617683Spst# We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
8717683Spst# hack the extra indirection
88127664SbmsOBJ =	$(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) $(LIBOBJS)
8917683SpstHDR =	pcap.h pcap-int.h pcap-namedb.h pcap-nit.h pcap-pf.h \
9017683Spst	ethertype.h gencode.h gnuc.h
9117683SpstGENHDR = \
92127664Sbms	tokdefs.h version.h
9317683Spst
9417683SpstTAGHDR = \
95127664Sbms	pcap-bpf.h
9617683Spst
9717683SpstTAGFILES = \
9817683Spst	$(SRC) $(HDR) $(TAGHDR)
9917683Spst
10017683SpstCLEANFILES = $(OBJ) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c
10117683Spst
10239291Sfennerall: libpcap.a
10339291Sfenner
10417683Spstlibpcap.a: $(OBJ)
10526175Sfenner	@rm -f $@
106127664Sbms	ar rc $@ $(OBJ) $(LIBS)
10717683Spst	$(RANLIB) $@
10817683Spst
109146768Ssamshared: libpcap.$(DYEXT)
110146768Ssam
111146768Ssam#
112146768Ssam# XXX - this works with GNU ld, but won't necessarily work with native
113146768Ssam# ld on, for example, various SVR4-flavored platforms, or Digital UNIX.
114146768Ssam#
115146768Ssamlibpcap.so: $(OBJ)
116146768Ssam	@rm -f $@
117172677Smlaier	$(CC) -shared -o $@.`cat VERSION` $(OBJ) $(DAGLIBS)
118146768Ssam
119146768Ssam# the following rule succeeds, but the result is untested.
120146768Ssamlibpcap.dylib: $(OBJ)
121146768Ssam	rm -f libpcap*.dylib
122146768Ssam	$(CC) -dynamiclib -undefined error -o libpcap.`cat VERSION`.dylib $(OBJ) \
123146768Ssam		-install_name $(libdir)/libpcap.0.dylib -compatibility_version `cat VERSION` \
124146768Ssam		-current_version `cat VERSION`
125146768Ssam
126146768Ssam
12726175Sfennerscanner.c: $(srcdir)/scanner.l
12826175Sfenner	@rm -f $@
12926175Sfenner	$(LEX) -t $< > $$$$.$@; mv $$$$.$@ $@
13017683Spst
13117683Spstscanner.o: scanner.c tokdefs.h
13256889Sfenner	$(CC) $(CFLAGS) -c scanner.c
13356889Sfenner
134127664Sbmspcap.o: version.h
135127664Sbms
13617683Spsttokdefs.h: grammar.c
13726175Sfennergrammar.c: $(srcdir)/grammar.y
13826175Sfenner	@rm -f grammar.c tokdefs.h
13917683Spst	$(YACC) -d $<
14017683Spst	mv y.tab.c grammar.c
14117683Spst	mv y.tab.h tokdefs.h
14217683Spst
14317683Spstgrammar.o: grammar.c
14426175Sfenner	@rm -f $@
14526175Sfenner	$(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c
14617683Spst
14739291Sfennerversion.o: version.c
14856889Sfenner	$(CC) $(CFLAGS) -c version.c
14956889Sfenner
150127664Sbmssnprintf.o: $(srcdir)/missing/snprintf.c
151127664Sbms	$(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
15275107Sfenner
15339291Sfennerversion.c: $(srcdir)/VERSION
15439291Sfenner	@rm -f $@
15539291Sfenner	sed -e 's/.*/char pcap_version[] = "&";/' $(srcdir)/VERSION > $@
15639291Sfenner
157127664Sbms#
158127664Sbms# NOTE: this really is supposed to be static; importing a string
159127664Sbms# from a shared library does not work very well on many
160127664Sbms# versions of UNIX (Solaris, Linux, and the BSDs, for example),
161127664Sbms# so we make the version string static and return it from
162127664Sbms# a function, which does work.
163127664Sbms#
164127664Sbmsversion.h: $(srcdir)/VERSION
165127664Sbms	@rm -f $@
166127664Sbms	sed -e 's/.*/static const char pcap_version_string[] = "libpcap version &";/' $(srcdir)/VERSION > $@
167127664Sbms
16875107Sfennerbpf_filter.c: $(srcdir)/bpf/net/bpf_filter.c
16975107Sfenner	rm -f bpf_filter.c
17075107Sfenner	ln -s $(srcdir)/bpf/net/bpf_filter.c bpf_filter.c
17156889Sfenner
17275107Sfennerbpf_filter.o: bpf_filter.c
17375107Sfenner	$(CC) $(CFLAGS) -c bpf_filter.c
17417683Spst
175146768Ssaminstall: libpcap.a 
17675107Sfenner	[ -d $(DESTDIR)$(libdir) ] || \
17775107Sfenner	    (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
17875107Sfenner	$(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a
17975107Sfenner	$(RANLIB) $(DESTDIR)$(libdir)/libpcap.a
18075107Sfenner	[ -d $(DESTDIR)$(includedir) ] || \
18175107Sfenner	    (mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir))
18275107Sfenner	$(INSTALL_DATA) $(srcdir)/pcap.h $(DESTDIR)$(includedir)/pcap.h
183127664Sbms	$(INSTALL_DATA) $(srcdir)/pcap-bpf.h \
184127664Sbms	    $(DESTDIR)$(includedir)/pcap-bpf.h
18575107Sfenner	$(INSTALL_DATA) $(srcdir)/pcap-namedb.h \
18675107Sfenner	    $(DESTDIR)$(includedir)/pcap-namedb.h
18775107Sfenner	[ -d $(DESTDIR)$(mandir)/man3 ] || \
18875107Sfenner		(mkdir -p $(DESTDIR)$(mandir)/man3; chmod 755 $(DESTDIR)$(mandir)/man3)
18975107Sfenner	$(INSTALL_DATA) $(srcdir)/pcap.3 \
19075107Sfenner	    $(DESTDIR)$(mandir)/man3/pcap.3
19117683Spst
192146768Ssaminstall-shared: install-shared-$(DYEXT)
193146768Ssaminstall-shared-so: libpcap.so
194146768Ssam	$(INSTALL_PROGRAM) libpcap.so.`cat VERSION` $(DESTDIR)$(libdir)/libpcap.so.`cat VERSION`
195146768Ssaminstall-shared-dylib: libpcap.dylib
196146768Ssam	$(INSTALL_PROGRAM) libpcap.`cat VERSION`.dylib $(DESTDIR)$(libdir)/libpcap.`cat VERSION`.dylib
197146768Ssam	VER=`cat VERSION`; cd $(DESTDIR)$(libdir) && ln -sf libpcap.$$VER.dylib libpcap.0.dylib;  ln -sf libpcap.0.dylib libpcap.dylib
198146768Ssam
19975107Sfenneruninstall:
20075107Sfenner	rm -f $(DESTDIR)$(libdir)/libpcap.a
20175107Sfenner	rm -f $(DESTDIR)$(includedir)/pcap.h
202127664Sbms	rm -f $(DESTDIR)$(includedir)/pcap-bpf.h
20375107Sfenner	rm -f $(DESTDIR)$(includedir)/pcap-namedb.h
20475107Sfenner	rm -f $(DESTDIR)$(mandir)/man3/pcap.3
20517683Spst
20617683Spstclean:
207146768Ssam	rm -f $(CLEANFILES) libpcap*.dylib libpcap.so*
20817683Spst
209146768Ssamdistclean: clean
210146768Ssam	rm -f Makefile config.cache config.log config.status \
211127664Sbms	    config.h gnuc.h os-proto.h bpf_filter.c stamp-h stamp-h.in
212146768Ssam	rm -rf autom4te.cache
21317683Spst
21417683Spsttags: $(TAGFILES)
21517683Spst	ctags -wtd $(TAGFILES)
21617683Spst
217146768Ssampackaging/pcap.spec: packaging/pcap.spec.in VERSION
218146768Ssam	RPMVERSION=`cat VERSION | sed s/-.*//g`; \
219146768Ssam		sed -e s/@VERSION@/$$RPMVERSION/ -e s/@NAME@/libpcap-`cat VERSION`/ $<   > $@
220146768Ssam
221172677Smlaierreleasetar:
222172677Smlaier	@cwd=`pwd` ; dir=`basename $$cwd` ; name=$(PROG)-`cat VERSION` ; \
223172677Smlaier	   list="" ; make distclean; cd ..; mkdir -p n; cd n; ln -s ../$$dir $$name; \
224172677Smlaier	   tar -c -z -f $$name.tar.gz $$name/. ;
22517683Spst
226127664Sbmsdepend:	$(GENSRC) $(GENHDR) bpf_filter.c
22717683Spst	./mkdep -c $(CC) $(DEFS) $(INCLS) $(SRC)
228146768Ssam
229146768SsamMakefile: Makefile.in config.status
230146768Ssam	./config.status
231146768Ssam	@echo your Makefile was out of date, now run $(MAKE) again
232146768Ssam	exit 1
233