]> The Tcpdump Group git mirrors - libpcap/blob - Makefile.in
From Paolo Abeni: support for a memory-mapped capture buffer.
[libpcap] / Makefile.in
1 # Copyright (c) 1993, 1994, 1995, 1996
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/libpcap/Makefile.in,v 1.110 2007-12-31 02:34:30 guy Exp $ (LBL)
21
22 #
23 # Various configurable paths (remember to edit Makefile.in, not Makefile)
24 #
25
26 # Top level hierarchy
27 prefix = @prefix@
28 exec_prefix = @exec_prefix@
29 datarootdir = @datarootdir@
30 # Pathname of directory to install the include files
31 includedir = @includedir@
32 # Pathname of directory to install the library
33 libdir = @libdir@
34 # Pathname of directory to install the man page
35 mandir = @mandir@
36
37 # VPATH
38 srcdir = @srcdir@
39 VPATH = @srcdir@
40
41 #
42 # You shouldn't need to edit anything below.
43 #
44
45 CC = @CC@
46 CCOPT = @V_CCOPT@
47 INCLS = -I. @V_INCLS@
48 DEFS = @DEFS@ @V_DEFS@
49 LIBS = @V_LIBS@
50 DAGLIBS = @DAGLIBS@
51 DYEXT = @DYEXT@
52 PROG=libpcap
53
54 # Standard CFLAGS
55 CFLAGS = $(CCOPT) $(INCLS) $(DEFS)
56
57 INSTALL = @INSTALL@
58 INSTALL_PROGRAM = @INSTALL_PROGRAM@
59 INSTALL_DATA = @INSTALL_DATA@
60 RANLIB = @RANLIB@
61
62 #
63 # Flex and bison allow you to specify the prefixes of the global symbols
64 # used by the generated parser. This allows programs to use lex/yacc
65 # and link against libpcap. If you don't have flex or bison, get them.
66 #
67 LEX = @V_LEX@
68 YACC = @V_YACC@
69
70 # Explicitly define compilation rule since SunOS 4's make doesn't like gcc.
71 # Also, gcc does not remove the .o before forking 'as', which can be a
72 # problem if you don't own the file but can write to the directory.
73 .c.o:
74 @rm -f $@
75 $(CC) $(CFLAGS) -c $(srcdir)/$*.c
76
77 PSRC = pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@
78 FSRC = fad-@V_FINDALLDEVS@.c
79 SSRC = @SSRC@
80 CSRC = pcap.c inet.c gencode.c optimize.c nametoaddr.c \
81 etherent.c savefile.c bpf_filter.c bpf_image.c bpf_dump.c
82 GENSRC = scanner.c grammar.c version.c
83 LIBOBJS = @LIBOBJS@
84
85 SRC = $(PSRC) $(FSRC) $(CSRC) $(SSRC) $(GENSRC)
86
87 # We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
88 # hack the extra indirection
89 OBJ = $(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) $(LIBOBJS)
90 HDR = pcap.h pcap-int.h pcap-namedb.h pcap-nit.h pcap-pf.h \
91 ethertype.h gencode.h gnuc.h
92 GENHDR = \
93 scanner.h tokdefs.h version.h
94
95 TAGHDR = \
96 pcap-bpf.h
97
98 TAGFILES = \
99 $(SRC) $(HDR) $(TAGHDR)
100
101 CLEANFILES = $(OBJ) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c
102
103 all: libpcap.a
104
105 libpcap.a: $(OBJ)
106 @rm -f $@
107 ar rc $@ $(OBJ) $(LIBS)
108 $(RANLIB) $@
109
110 shared: libpcap.$(DYEXT)
111
112 #
113 # XXX - this works with GNU ld, but won't necessarily work with native
114 # ld on, for example, various SVR4-flavored platforms, or Digital UNIX.
115 #
116 libpcap.so: $(OBJ)
117 @rm -f $@
118 $(CC) -shared -o $@.`cat VERSION` $(OBJ) $(DAGLIBS)
119
120 # the following rule succeeds, but the result is untested.
121 libpcap.dylib: $(OBJ)
122 rm -f libpcap*.dylib
123 $(CC) -dynamiclib -undefined error -o libpcap.`cat VERSION`.dylib $(OBJ) \
124 -install_name $(libdir)/libpcap.0.dylib -compatibility_version `cat VERSION` \
125 -current_version `cat VERSION`
126
127 scanner.c: $(srcdir)/scanner.l
128 @rm -f $@
129 ./runlex.sh $(LEX) -o$@ $<
130
131 scanner.o: scanner.c tokdefs.h
132 $(CC) $(CFLAGS) -c scanner.c
133
134 pcap.o: version.h
135
136 tokdefs.h: grammar.c
137 grammar.c: $(srcdir)/grammar.y
138 @rm -f grammar.c tokdefs.h
139 $(YACC) -d $<
140 mv y.tab.c grammar.c
141 mv y.tab.h tokdefs.h
142
143 grammar.o: grammar.c
144 @rm -f $@
145 $(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c
146
147 version.o: version.c
148 $(CC) $(CFLAGS) -c version.c
149
150 snprintf.o: $(srcdir)/missing/snprintf.c
151 $(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
152
153 version.c: $(srcdir)/VERSION
154 @rm -f $@
155 sed -e 's/.*/char pcap_version[] = "&";/' $(srcdir)/VERSION > $@
156
157 #
158 # NOTE: this really is supposed to be static; importing a string
159 # from a shared library does not work very well on many
160 # versions of UNIX (Solaris, Linux, and the BSDs, for example),
161 # so we make the version string static and return it from
162 # a function, which does work.
163 #
164 version.h: $(srcdir)/VERSION
165 @rm -f $@
166 sed -e 's/.*/static const char pcap_version_string[] = "libpcap version &";/' $(srcdir)/VERSION > $@
167
168 bpf_filter.c: $(srcdir)/bpf/net/bpf_filter.c
169 rm -f bpf_filter.c
170 ln -s $(srcdir)/bpf/net/bpf_filter.c bpf_filter.c
171
172 bpf_filter.o: bpf_filter.c
173 $(CC) $(CFLAGS) -c bpf_filter.c
174
175 #
176 # Test programs - not built by default, and not installed.
177 #
178 filtertest: filtertest.c libpcap.a
179 $(CC) $(CFLAGS) -I. -L. -o filtertest filtertest.c libpcap.a
180
181 findalldevstest: findalldevstest.c libpcap.a
182 $(CC) $(CFLAGS) -I. -L. -o findalldevstest findalldevstest.c libpcap.a
183
184 install: libpcap.a
185 [ -d $(DESTDIR)$(libdir) ] || \
186 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
187 $(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a
188 $(RANLIB) $(DESTDIR)$(libdir)/libpcap.a
189 [ -d $(DESTDIR)$(includedir) ] || \
190 (mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir))
191 [ -d $(DESTDIR)$(includedir)/pcap ] || \
192 (mkdir -p $(DESTDIR)$(includedir)/pcap; chmod 755 $(DESTDIR)$(includedir)/pcap)
193 $(INSTALL_DATA) $(srcdir)/pcap/pcap.h \
194 $(DESTDIR)$(includedir)/pcap/pcap.h
195 $(INSTALL_DATA) $(srcdir)/pcap/bpf.h \
196 $(DESTDIR)$(includedir)/pcap/bpf.h
197 $(INSTALL_DATA) $(srcdir)/pcap/namedb.h \
198 $(DESTDIR)$(includedir)/pcap/namedb.h
199 $(INSTALL_DATA) $(srcdir)/pcap/sll.h \
200 $(DESTDIR)$(includedir)/pcap/sll.h
201 $(INSTALL_DATA) $(srcdir)/pcap/usb.h \
202 $(DESTDIR)$(includedir)/pcap/usb.h
203 $(INSTALL_DATA) $(srcdir)/pcap.h $(DESTDIR)$(includedir)/pcap.h
204 $(INSTALL_DATA) $(srcdir)/pcap-bpf.h \
205 $(DESTDIR)$(includedir)/pcap-bpf.h
206 $(INSTALL_DATA) $(srcdir)/pcap-namedb.h \
207 $(DESTDIR)$(includedir)/pcap-namedb.h
208 [ -d $(DESTDIR)$(mandir)/man3 ] || \
209 (mkdir -p $(DESTDIR)$(mandir)/man3; chmod 755 $(DESTDIR)$(mandir)/man3)
210 $(INSTALL_DATA) $(srcdir)/pcap.3 \
211 $(DESTDIR)$(mandir)/man3/pcap.3
212
213 install-shared: install-shared-$(DYEXT)
214 install-shared-so: libpcap.so
215 $(INSTALL_PROGRAM) libpcap.so.`cat VERSION` $(DESTDIR)$(libdir)/libpcap.so.`cat VERSION`
216 install-shared-dylib: libpcap.dylib
217 $(INSTALL_PROGRAM) libpcap.`cat VERSION`.dylib $(DESTDIR)$(libdir)/libpcap.`cat VERSION`.dylib
218 VER=`cat VERSION`; cd $(DESTDIR)$(libdir) && ln -sf libpcap.$$VER.dylib libpcap.0.dylib; ln -sf libpcap.0.dylib libpcap.dylib
219
220 uninstall:
221 rm -f $(DESTDIR)$(libdir)/libpcap.a
222 rm -f $(DESTDIR)$(includedir)/pcap/pcap.h
223 rm -f $(DESTDIR)$(includedir)/pcap/bpf.h
224 rm -f $(DESTDIR)$(includedir)/pcap/namedb.h
225 rm -f $(DESTDIR)$(includedir)/pcap/sll.h
226 rm -f $(DESTDIR)$(includedir)/pcap/usb.h
227 -rmdir $(DESTDIR)$(includedir)/pcap
228 rm -f $(DESTDIR)$(includedir)/pcap.h
229 rm -f $(DESTDIR)$(includedir)/pcap-bpf.h
230 rm -f $(DESTDIR)$(includedir)/pcap-namedb.h
231 rm -f $(DESTDIR)$(mandir)/man3/pcap.3
232
233 clean:
234 rm -f $(CLEANFILES) libpcap*.dylib libpcap.so*
235
236 distclean: clean
237 rm -f Makefile config.cache config.log config.status \
238 config.h gnuc.h os-proto.h bpf_filter.c stamp-h stamp-h.in
239 rm -rf autom4te.cache
240
241 tags: $(TAGFILES)
242 ctags -wtd $(TAGFILES)
243
244 packaging/pcap.spec: packaging/pcap.spec.in VERSION
245 RPMVERSION=`cat VERSION | sed s/-.*//g`; \
246 sed -e s/@VERSION@/$$RPMVERSION/ -e s/@NAME@/libpcap-`cat VERSION`/ $< > $@
247
248 releasetar:
249 @cwd=`pwd` ; dir=`basename $$cwd` ; name=$(PROG)-`cat VERSION` ; \
250 list="" ; make distclean; cd ..; mkdir -p n; cd n; ln -s ../$$dir $$name; \
251 tar -c -z -f $$name.tar.gz $$name/. ;
252
253 depend: $(GENSRC) $(GENHDR) bpf_filter.c
254 ./mkdep -c $(CC) $(DEFS) $(INCLS) $(SRC)
255
256 Makefile: Makefile.in config.status
257 ./config.status
258 @echo your Makefile was out of date, now run $(MAKE) again
259 exit 1