]> The Tcpdump Group git mirrors - libpcap/blob - Makefile.in
Add a script to change the permissions of /dev/bpf*, and a launchd plist
[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.124 2008-05-28 02:14:10 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 = \
91 acconfig.h \
92 arcnet.h \
93 atmuni31.h \
94 ethertype.h \
95 gencode.h \
96 ieee80211.h \
97 llc.h \
98 nlpid.h \
99 pcap/bluetooth.h \
100 pcap/bpf.h \
101 pcap/namedb.h \
102 pcap/pcap.h \
103 pcap/sll.h \
104 pcap/usb.h \
105 pcap.h \
106 pcap-int.h \
107 pcap-namedb.h \
108 pcap-stdinc.h \
109 ppp.h \
110 sunatmpos.h
111
112 GENHDR = \
113 scanner.h tokdefs.h version.h
114
115 TAGHDR = \
116 pcap-bpf.h
117
118 TAGFILES = \
119 $(SRC) $(HDR) $(TAGHDR)
120
121 CLEANFILES = $(OBJ) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c
122
123 MAN3PCAP = pcap.3pcap \
124 pcap_activate.3pcap \
125 pcap_breakloop.3pcap \
126 pcap_can_set_rfmon.3pcap \
127 pcap_close.3pcap \
128 pcap_compile.3pcap \
129 pcap_create.3pcap \
130 pcap_datalink.3pcap \
131 pcap_datalink_name_to_val.3pcap \
132 pcap_datalink_val_to_name.3pcap \
133 pcap_dump.3pcap \
134 pcap_dump_close.3pcap \
135 pcap_dump_file.3pcap \
136 pcap_dump_flush.3pcap \
137 pcap_dump_ftell.3pcap \
138 pcap_dump_open.3pcap \
139 pcap_file.3pcap \
140 pcap_fileno.3pcap \
141 pcap_findalldevs.3pcap \
142 pcap_freealldevs.3pcap \
143 pcap_freecode.3pcap \
144 pcap_free_datalinks.3pcap \
145 pcap_get_selectable_fd.3pcap \
146 pcap_geterr.3pcap \
147 pcap_inject.3pcap \
148 pcap_is_swapped.3pcap \
149 pcap_lib_version.3pcap \
150 pcap_list_datalinks.3pcap \
151 pcap_lookupdev.3pcap \
152 pcap_lookupnet.3pcap \
153 pcap_loop.3pcap \
154 pcap_major_version.3pcap \
155 pcap_next_ex.3pcap \
156 pcap_offline_filter.3pcap \
157 pcap_open_dead.3pcap \
158 pcap_open_live.3pcap \
159 pcap_open_offline.3pcap \
160 pcap_set_buffer_size.3pcap \
161 pcap_set_datalink.3pcap \
162 pcap_set_promisc.3pcap \
163 pcap_set_rfmon.3pcap \
164 pcap_set_snaplen.3pcap \
165 pcap_set_timeout.3pcap \
166 pcap_setdirection.3pcap \
167 pcap_setfilter.3pcap \
168 pcap_setnonblock.3pcap \
169 pcap_snapshot.3pcap \
170 pcap_stats.3pcap \
171 pcap_statustostr.3pcap \
172 pcap_strerror.3pcap
173
174 MAN4 = pcap-filter.4 \
175 pcap-linktype.4
176
177 EXTRA_DIST = \
178 CHANGES \
179 ChmodBPF/ChmodBPF \
180 ChmodBPF/StartupParameters.plist \
181 CREDITS \
182 INSTALL.txt \
183 LICENSE \
184 Makefile.in \
185 README \
186 README.aix \
187 README.dag \
188 README.hpux \
189 README.linux \
190 README.macosx \
191 README.septel \
192 README.sita \
193 README.tru64 \
194 README.Win32 \
195 SUNOS4/nit_if.o.sparc \
196 SUNOS4/nit_if.o.sun3 \
197 SUNOS4/nit_if.o.sun4c.4.0.3c \
198 TODO \
199 VERSION \
200 aclocal.m4 \
201 bpf/net/bpf_filter.c \
202 chmod_bpf \
203 config.guess \
204 config.h.in \
205 config.sub \
206 configure \
207 configure.in \
208 dlpisubs.c \
209 dlpisubs.h \
210 fad-getad.c \
211 fad-gifc.c \
212 fad-glifc.c \
213 fad-null.c \
214 fad-sita.c \
215 fad-win32.c \
216 filtertest.c \
217 findalldevstest.c \
218 grammar.y \
219 install-sh \
220 lbl/os-aix4.h \
221 lbl/os-hpux11.h \
222 lbl/os-osf4.h \
223 lbl/os-osf5.h \
224 lbl/os-solaris2.h \
225 lbl/os-sunos4.h \
226 lbl/os-ultrix4.h \
227 missing/snprintf.c \
228 mkdep \
229 msdos/bin2c.c \
230 msdos/common.dj \
231 msdos/makefile \
232 msdos/makefile.dj \
233 msdos/makefile.wc \
234 msdos/ndis2.c \
235 msdos/ndis2.h \
236 msdos/ndis_0.asm \
237 msdos/pkt_rx0.asm \
238 msdos/pkt_rx1.s \
239 msdos/pktdrvr.c \
240 msdos/pktdrvr.h \
241 msdos/readme.dos \
242 net/bpf_filter.c \
243 org.tcpdump.chmod_bpf.plist \
244 packaging/pcap.spec \
245 packaging/pcap.spec.in \
246 pcap-bpf.c \
247 pcap-bpf.h \
248 pcap-bt-linux.c \
249 pcap-bt-linux.h \
250 pcap-dag.c \
251 pcap-dag.h \
252 pcap-dlpi.c \
253 pcap-dos.c \
254 pcap-dos.h \
255 pcap-enet.c \
256 pcap-int.h \
257 pcap-libdlpi.c \
258 pcap-linux.c \
259 pcap-namedb.h \
260 pcap-nit.c \
261 pcap-null.c \
262 pcap-pf.c \
263 pcap-septel.c \
264 pcap-septel.h \
265 pcap-sita.h \
266 pcap-sita.c \
267 pcap-sita.html \
268 pcap-snit.c \
269 pcap-snoop.c \
270 pcap-usb-linux.c \
271 pcap-usb-linux.h \
272 pcap-win32.c \
273 runlex.sh \
274 scanner.l \
275 Win32/Include/Gnuc.h \
276 Win32/Include/addrinfo.h \
277 Win32/Include/bittypes.h \
278 Win32/Include/cdecl_ext.h \
279 Win32/Include/inetprivate.h \
280 Win32/Include/ip6_misc.h \
281 Win32/Include/sockstorage.h \
282 Win32/Include/arpa/nameser.h \
283 Win32/Include/net/if.h \
284 Win32/Include/net/netdb.h \
285 Win32/Include/net/paths.h \
286 Win32/Prj/libpcap.dsp \
287 Win32/Prj/libpcap.dsw \
288 Win32/Src/ffs.c \
289 Win32/Src/gai_strerror.c \
290 Win32/Src/getaddrinfo.c \
291 Win32/Src/getnetbynm.c \
292 Win32/Src/getnetent.c \
293 Win32/Src/getopt.c \
294 Win32/Src/getservent.c \
295 Win32/Src/inet_aton.c \
296 Win32/Src/inet_net.c \
297 Win32/Src/inet_pton.c
298
299 all: libpcap.a
300
301 libpcap.a: $(OBJ)
302 @rm -f $@
303 $(AR) rc $@ $(OBJ) $(LIBS)
304 $(RANLIB) $@
305
306 shared: libpcap.$(DYEXT)
307
308 #
309 # XXX - this works with GNU ld, but won't necessarily work with native
310 # ld on, for example, various SVR4-flavored platforms, or Digital UNIX.
311 #
312 libpcap.so: $(OBJ)
313 @rm -f $@
314 $(CC) -shared -o $@.`cat VERSION` $(OBJ) $(DAGLIBS)
315
316 # the following rule succeeds, but the result is untested.
317 libpcap.dylib: $(OBJ)
318 rm -f libpcap*.dylib
319 $(CC) -dynamiclib -undefined error -o libpcap.`cat VERSION`.dylib $(OBJ) \
320 -install_name $(libdir)/libpcap.0.dylib -compatibility_version `cat VERSION` \
321 -current_version `cat VERSION`
322
323 scanner.c: $(srcdir)/scanner.l
324 @rm -f $@
325 ./runlex.sh $(LEX) -o$@ $<
326
327 scanner.o: scanner.c tokdefs.h
328 $(CC) $(CFLAGS) -c scanner.c
329
330 pcap.o: version.h
331
332 tokdefs.h: grammar.c
333 grammar.c: $(srcdir)/grammar.y
334 @rm -f grammar.c tokdefs.h
335 $(YACC) -d $<
336 mv y.tab.c grammar.c
337 mv y.tab.h tokdefs.h
338
339 grammar.o: grammar.c
340 @rm -f $@
341 $(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c
342
343 version.o: version.c
344 $(CC) $(CFLAGS) -c version.c
345
346 snprintf.o: $(srcdir)/missing/snprintf.c
347 $(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
348
349 version.c: $(srcdir)/VERSION
350 @rm -f $@
351 sed -e 's/.*/char pcap_version[] = "&";/' $(srcdir)/VERSION > $@
352
353 #
354 # NOTE: this really is supposed to be static; importing a string
355 # from a shared library does not work very well on many
356 # versions of UNIX (Solaris, Linux, and the BSDs, for example),
357 # so we make the version string static and return it from
358 # a function, which does work.
359 #
360 version.h: $(srcdir)/VERSION
361 @rm -f $@
362 sed -e 's/.*/static const char pcap_version_string[] = "libpcap version &";/' $(srcdir)/VERSION > $@
363
364 bpf_filter.c: $(srcdir)/bpf/net/bpf_filter.c
365 rm -f bpf_filter.c
366 ln -s $(srcdir)/bpf/net/bpf_filter.c bpf_filter.c
367
368 bpf_filter.o: bpf_filter.c
369 $(CC) $(CFLAGS) -c bpf_filter.c
370
371 #
372 # Test programs - not built by default, and not installed.
373 #
374 filtertest: filtertest.c libpcap.a
375 $(CC) $(CFLAGS) -I. -L. -o filtertest filtertest.c libpcap.a
376
377 findalldevstest: findalldevstest.c libpcap.a
378 $(CC) $(CFLAGS) -I. -L. -o findalldevstest findalldevstest.c libpcap.a
379
380 install: libpcap.a
381 [ -d $(DESTDIR)$(libdir) ] || \
382 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
383 $(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a
384 $(RANLIB) $(DESTDIR)$(libdir)/libpcap.a
385 [ -d $(DESTDIR)$(includedir) ] || \
386 (mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir))
387 [ -d $(DESTDIR)$(includedir)/pcap ] || \
388 (mkdir -p $(DESTDIR)$(includedir)/pcap; chmod 755 $(DESTDIR)$(includedir)/pcap)
389 [ -d $(DESTDIR)$(mandir)/man3 ] || \
390 (mkdir -p $(DESTDIR)$(mandir)/man3; chmod 755 $(DESTDIR)$(mandir)/man3)
391 [ -d $(DESTDIR)$(mandir)/man4 ] || \
392 (mkdir -p $(DESTDIR)$(mandir)/man4; chmod 755 $(DESTDIR)$(mandir)/man4)
393 $(INSTALL_DATA) $(srcdir)/pcap/pcap.h \
394 $(DESTDIR)$(includedir)/pcap/pcap.h
395 $(INSTALL_DATA) $(srcdir)/pcap/bpf.h \
396 $(DESTDIR)$(includedir)/pcap/bpf.h
397 $(INSTALL_DATA) $(srcdir)/pcap/namedb.h \
398 $(DESTDIR)$(includedir)/pcap/namedb.h
399 $(INSTALL_DATA) $(srcdir)/pcap/sll.h \
400 $(DESTDIR)$(includedir)/pcap/sll.h
401 $(INSTALL_DATA) $(srcdir)/pcap/usb.h \
402 $(DESTDIR)$(includedir)/pcap/usb.h
403 $(INSTALL_DATA) $(srcdir)/pcap.h $(DESTDIR)$(includedir)/pcap.h
404 $(INSTALL_DATA) $(srcdir)/pcap-bpf.h \
405 $(DESTDIR)$(includedir)/pcap-bpf.h
406 $(INSTALL_DATA) $(srcdir)/pcap-namedb.h \
407 $(DESTDIR)$(includedir)/pcap-namedb.h
408 for i in $(MAN3PCAP); do \
409 $(INSTALL_DATA) $(srcdir)/$$i \
410 $(DESTDIR)$(mandir)/man3/$$i; done
411 ln $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_name.3pcap \
412 $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_description.3pcap
413 ln $(DESTDIR)$(mandir)/man3/pcap_dump_open.3pcap \
414 $(DESTDIR)$(mandir)/man3/pcap_dump_fopen.3pcap
415 ln $(DESTDIR)$(mandir)/man3/pcap_geterr.3pcap \
416 $(DESTDIR)$(mandir)/man3/pcap_perror.3pcap
417 ln $(DESTDIR)$(mandir)/man3/pcap_inject.3pcap \
418 $(DESTDIR)$(mandir)/man3/pcap_sendpacket.3pcap
419 ln $(DESTDIR)$(mandir)/man3/pcap_loop.3pcap \
420 $(DESTDIR)$(mandir)/man3/pcap_dispatch.3pcap
421 ln $(DESTDIR)$(mandir)/man3/pcap_major_version.3pcap \
422 $(DESTDIR)$(mandir)/man3/pcap_minor_version.3pcap
423 ln $(DESTDIR)$(mandir)/man3/pcap_next_ex.3pcap \
424 $(DESTDIR)$(mandir)/man3/pcap_next.3pcap
425 ln $(DESTDIR)$(mandir)/man3/pcap_open_offline.3pcap \
426 $(DESTDIR)$(mandir)/man3/pcap_fopen_offline.3pcap
427 ln $(DESTDIR)$(mandir)/man3/pcap_setnonblock.3pcap \
428 $(DESTDIR)$(mandir)/man3/pcap_getnonblock.3pcap
429 for i in $(MAN4); do \
430 $(INSTALL_DATA) $(srcdir)/$$i \
431 $(DESTDIR)$(mandir)/man4/$$i; done
432
433 install-shared: install-shared-$(DYEXT)
434 install-shared-so: libpcap.so
435 $(INSTALL_PROGRAM) libpcap.so.`cat VERSION` $(DESTDIR)$(libdir)/libpcap.so.`cat VERSION`
436 install-shared-dylib: libpcap.dylib
437 $(INSTALL_PROGRAM) libpcap.`cat VERSION`.dylib $(DESTDIR)$(libdir)/libpcap.`cat VERSION`.dylib
438 VER=`cat VERSION`; cd $(DESTDIR)$(libdir) && ln -sf libpcap.$$VER.dylib libpcap.0.dylib; ln -sf libpcap.0.dylib libpcap.dylib
439
440 uninstall:
441 rm -f $(DESTDIR)$(libdir)/libpcap.a
442 rm -f $(DESTDIR)$(includedir)/pcap/pcap.h
443 rm -f $(DESTDIR)$(includedir)/pcap/bpf.h
444 rm -f $(DESTDIR)$(includedir)/pcap/namedb.h
445 rm -f $(DESTDIR)$(includedir)/pcap/sll.h
446 rm -f $(DESTDIR)$(includedir)/pcap/usb.h
447 -rmdir $(DESTDIR)$(includedir)/pcap
448 rm -f $(DESTDIR)$(includedir)/pcap.h
449 rm -f $(DESTDIR)$(includedir)/pcap-bpf.h
450 rm -f $(DESTDIR)$(includedir)/pcap-namedb.h
451 for i in $(MAN3PCAP); do \
452 rm -f $(DESTDIR)$(mandir)/man3/$$i; done
453 rm -f $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_description.3pcap
454 rm -f $(DESTDIR)$(mandir)/man3/pcap_dump_fopen.3pcap
455 rm -f $(DESTDIR)$(mandir)/man3/pcap_perror.3pcap
456 rm -f $(DESTDIR)$(mandir)/man3/pcap_sendpacket.3pcap
457 rm -f $(DESTDIR)$(mandir)/man3/pcap_dispatch.3pcap
458 rm -f $(DESTDIR)$(mandir)/man3/pcap_minor_version.3pcap
459 rm -f $(DESTDIR)$(mandir)/man3/pcap_next.3pcap
460 rm -f $(DESTDIR)$(mandir)/man3/pcap_fopen_offline.3pcap
461 rm -f $(DESTDIR)$(mandir)/man3/pcap_getnonblock.3pcap
462 for i in $(MAN4); do \
463 rm -f $(DESTDIR)$(mandir)/man4/$$i; done
464
465 clean:
466 rm -f $(CLEANFILES) libpcap*.dylib libpcap.so*
467
468 distclean: clean
469 rm -f Makefile config.cache config.log config.status \
470 config.h gnuc.h os-proto.h bpf_filter.c stamp-h stamp-h.in
471 rm -rf autom4te.cache
472
473 tags: $(TAGFILES)
474 ctags -wtd $(TAGFILES)
475
476 packaging/pcap.spec: packaging/pcap.spec.in VERSION
477 RPMVERSION=`cat VERSION | sed s/-.*//g`; \
478 sed -e s/@VERSION@/$$RPMVERSION/ -e s/@NAME@/libpcap-`cat VERSION`/ $< > $@
479
480 releasetar:
481 @cwd=`pwd` ; dir=`basename $$cwd` ; name=$(PROG)-`cat VERSION` ; \
482 mkdir $$name; \
483 tar cf - $(CSRC) $(HDR) $(MAN3PCAP) $(MAN4) $(EXTRA_DIST) | (cd $$name; tar xf -); \
484 tar -c -z -f $$name.tar.gz $$name; \
485 rm -rf $$name
486
487 depend: $(GENSRC) $(GENHDR) bpf_filter.c
488 ./mkdep -c $(CC) $(DEFS) $(INCLS) $(SRC)
489
490 Makefile: Makefile.in config.status
491 ./config.status
492 @echo your Makefile was out of date, now run $(MAKE) again
493 exit 1