1 # Copyright (c) 1993, 1994, 1995, 1996
2 # The Regents of the University of California. All rights reserved.
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
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.
20 # @(#) $Header: /tcpdump/master/libpcap/Makefile.in,v 1.108.2.10 2008-04-09 21:41:53 guy Exp $ (LBL)
23 # Various configurable paths (remember to edit Makefile.in, not Makefile)
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
34 # Pathname of directory to install the man page
42 # You shouldn't need to edit anything below.
48 DEFS
= @DEFS@ @V_DEFS@
55 CFLAGS
= $(CCOPT
) $(INCLS
) $(DEFS
)
58 INSTALL_PROGRAM
= @INSTALL_PROGRAM@
59 INSTALL_DATA
= @INSTALL_DATA@
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.
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.
75 $(CC
) $(CFLAGS
) -c
$(srcdir)/$*.c
77 PSRC
= pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@
78 FSRC
= fad-@V_FINDALLDEVS@.c
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
85 SRC
= $(PSRC
) $(FSRC
) $(CSRC
) $(SSRC
) $(GENSRC
)
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
93 scanner.h tokdefs.h version.h
99 $(SRC
) $(HDR
) $(TAGHDR
)
101 CLEANFILES
= $(OBJ
) libpcap.a
$(GENSRC
) $(GENHDR
) lex.yy.c
103 MAN3PCAP
= pcap
.3pcap \
104 pcap_breakloop
.3pcap \
105 pcap_can_set_rfmon
.3pcap \
109 pcap_datalink
.3pcap \
110 pcap_datalink_name_to_val
.3pcap \
111 pcap_datalink_val_to_name
.3pcap \
113 pcap_dump_close
.3pcap \
114 pcap_dump_file
.3pcap \
115 pcap_dump_flush
.3pcap \
116 pcap_dump_ftell
.3pcap \
117 pcap_dump_open
.3pcap \
120 pcap_findalldevs
.3pcap \
121 pcap_freealldevs
.3pcap \
122 pcap_freecode
.3pcap \
123 pcap_get_selectable_fd
.3pcap \
126 pcap_is_swapped
.3pcap \
127 pcap_lib_version
.3pcap \
128 pcap_list_datalinks
.3pcap \
129 pcap_lookupdev
.3pcap \
130 pcap_lookupnet
.3pcap \
132 pcap_major_version
.3pcap \
134 pcap_open_dead
.3pcap \
135 pcap_open_live
.3pcap \
136 pcap_open_offline
.3pcap \
137 pcap_set_buffer_size
.3pcap \
138 pcap_set_datalink
.3pcap \
139 pcap_set_promisc
.3pcap \
140 pcap_set_rfmon
.3pcap \
141 pcap_set_snaplen
.3pcap \
142 pcap_set_timeout
.3pcap \
143 pcap_setdirection
.3pcap \
144 pcap_setfilter
.3pcap \
145 pcap_setnonblock
.3pcap \
146 pcap_snapshot
.3pcap \
148 pcap_statustostr
.3pcap \
151 MAN4
= pcap-filter
.4 \
158 $(AR
) rc
$@
$(OBJ
) $(LIBS
)
161 shared
: libpcap.
$(DYEXT
)
164 # XXX - this works with GNU ld, but won't necessarily work with native
165 # ld on, for example, various SVR4-flavored platforms, or Digital UNIX.
169 $(CC
) -shared
-o
$@.
`cat VERSION` $(OBJ
) $(DAGLIBS
)
171 # the following rule succeeds, but the result is untested.
172 libpcap.dylib
: $(OBJ
)
174 $(CC
) -dynamiclib
-undefined error
-o libpcap.
`cat VERSION`.dylib
$(OBJ
) \
175 -install_name
$(libdir)/libpcap
.0.dylib
-compatibility_version
`cat VERSION` \
176 -current_version
`cat VERSION`
178 scanner.c
: $(srcdir)/scanner.l
180 .
/runlex.sh
$(LEX
) -o
$@
$<
182 scanner.o
: scanner.c tokdefs.h
183 $(CC
) $(CFLAGS
) -c scanner.c
188 grammar.c
: $(srcdir)/grammar.y
189 @
rm -f grammar.c tokdefs.h
196 $(CC
) $(CFLAGS
) -Dyylval
=pcap_lval
-c grammar.c
199 $(CC
) $(CFLAGS
) -c version.c
201 snprintf.o
: $(srcdir)/missing
/snprintf.c
202 $(CC
) $(CFLAGS
) -o
$@
-c
$(srcdir)/missing
/snprintf.c
204 version.c
: $(srcdir)/VERSION
206 sed
-e
's/.*/char pcap_version[] = "&";/' $(srcdir)/VERSION
> $@
209 # NOTE: this really is supposed to be static; importing a string
210 # from a shared library does not work very well on many
211 # versions of UNIX (Solaris, Linux, and the BSDs, for example),
212 # so we make the version string static and return it from
213 # a function, which does work.
215 version.h
: $(srcdir)/VERSION
217 sed
-e
's/.*/static const char pcap_version_string[] = "libpcap version &";/' $(srcdir)/VERSION
> $@
219 bpf_filter.c
: $(srcdir)/bpf
/net
/bpf_filter.c
221 ln
-s
$(srcdir)/bpf
/net
/bpf_filter.c bpf_filter.c
223 bpf_filter.o
: bpf_filter.c
224 $(CC
) $(CFLAGS
) -c bpf_filter.c
227 # Test programs - not built by default, and not installed.
229 filtertest
: filtertest.c libpcap.a
230 $(CC
) $(CFLAGS
) -I.
-L.
-o filtertest filtertest.c libpcap.a
232 findalldevstest
: findalldevstest.c libpcap.a
233 $(CC
) $(CFLAGS
) -I.
-L.
-o findalldevstest findalldevstest.c libpcap.a
236 [ -d
$(DESTDIR
)$(libdir) ] || \
237 (mkdir
-p
$(DESTDIR
)$(libdir); chmod
755 $(DESTDIR
)$(libdir))
238 $(INSTALL_DATA
) libpcap.a
$(DESTDIR
)$(libdir)/libpcap.a
239 $(RANLIB
) $(DESTDIR
)$(libdir)/libpcap.a
240 [ -d
$(DESTDIR
)$(includedir) ] || \
241 (mkdir
-p
$(DESTDIR
)$(includedir); chmod
755 $(DESTDIR
)$(includedir))
242 [ -d
$(DESTDIR
)$(includedir)/pcap
] || \
243 (mkdir
-p
$(DESTDIR
)$(includedir)/pcap
; chmod
755 $(DESTDIR
)$(includedir)/pcap
)
244 [ -d
$(DESTDIR
)$(mandir)/man3
] || \
245 (mkdir
-p
$(DESTDIR
)$(mandir)/man3
; chmod
755 $(DESTDIR
)$(mandir)/man3
)
246 [ -d
$(DESTDIR
)$(mandir)/man4
] || \
247 (mkdir
-p
$(DESTDIR
)$(mandir)/man4
; chmod
755 $(DESTDIR
)$(mandir)/man4
)
248 $(INSTALL_DATA
) $(srcdir)/pcap
/pcap.h \
249 $(DESTDIR
)$(includedir)/pcap
/pcap.h
250 $(INSTALL_DATA
) $(srcdir)/pcap
/bpf.h \
251 $(DESTDIR
)$(includedir)/pcap
/bpf.h
252 $(INSTALL_DATA
) $(srcdir)/pcap
/namedb.h \
253 $(DESTDIR
)$(includedir)/pcap
/namedb.h
254 $(INSTALL_DATA
) $(srcdir)/pcap
/sll.h \
255 $(DESTDIR
)$(includedir)/pcap
/sll.h
256 $(INSTALL_DATA
) $(srcdir)/pcap
/usb.h \
257 $(DESTDIR
)$(includedir)/pcap
/usb.h
258 $(INSTALL_DATA
) $(srcdir)/pcap.h
$(DESTDIR
)$(includedir)/pcap.h
259 $(INSTALL_DATA
) $(srcdir)/pcap-bpf.h \
260 $(DESTDIR
)$(includedir)/pcap-bpf.h
261 $(INSTALL_DATA
) $(srcdir)/pcap-namedb.h \
262 $(DESTDIR
)$(includedir)/pcap-namedb.h
263 for i in
$(MAN3PCAP
); do \
264 $(INSTALL_DATA
) $(srcdir)/$$i \
265 $(DESTDIR
)$(mandir)/man3
/$$i; done
266 ln
$(DESTDIR
)$(mandir)/man3
/pcap_datalink_val_to_name
.3pcap \
267 $(DESTDIR
)$(mandir)/man3
/pcap_datalink_val_to_description
.3pcap
268 ln
$(DESTDIR
)$(mandir)/man3
/pcap_dump_open
.3pcap \
269 $(DESTDIR
)$(mandir)/man3
/pcap_dump_fopen
.3pcap
270 ln
$(DESTDIR
)$(mandir)/man3
/pcap_geterr
.3pcap \
271 $(DESTDIR
)$(mandir)/man3
/pcap_perror
.3pcap
272 ln
$(DESTDIR
)$(mandir)/man3
/pcap_inject
.3pcap \
273 $(DESTDIR
)$(mandir)/man3
/pcap_sendpacket
.3pcap
274 ln
$(DESTDIR
)$(mandir)/man3
/pcap_loop
.3pcap \
275 $(DESTDIR
)$(mandir)/man3
/pcap_dispatch
.3pcap
276 ln
$(DESTDIR
)$(mandir)/man3
/pcap_major_version
.3pcap \
277 $(DESTDIR
)$(mandir)/man3
/pcap_minor_version
.3pcap
278 ln
$(DESTDIR
)$(mandir)/man3
/pcap_next_ex
.3pcap \
279 $(DESTDIR
)$(mandir)/man3
/pcap_next
.3pcap
280 ln
$(DESTDIR
)$(mandir)/man3
/pcap_open_offline
.3pcap \
281 $(DESTDIR
)$(mandir)/man3
/pcap_fopen_offline
.3pcap
282 ln
$(DESTDIR
)$(mandir)/man3
/pcap_setnonblock
.3pcap \
283 $(DESTDIR
)$(mandir)/man3
/pcap_getnonblock
.3pcap
284 for i in
$(MAN4
); do \
285 $(INSTALL_DATA
) $(srcdir)/$$i \
286 $(DESTDIR
)$(mandir)/man4
/$$i; done
288 install-shared
: install-shared-
$(DYEXT
)
289 install-shared-so
: libpcap.so
290 $(INSTALL_PROGRAM
) libpcap.so.
`cat VERSION` $(DESTDIR
)$(libdir)/libpcap.so.
`cat VERSION`
291 install-shared-dylib
: libpcap.dylib
292 $(INSTALL_PROGRAM
) libpcap.
`cat VERSION`.dylib
$(DESTDIR
)$(libdir)/libpcap.
`cat VERSION`.dylib
293 VER
=`cat VERSION`; cd
$(DESTDIR
)$(libdir) && ln
-sf libpcap.
$$VER.dylib libpcap
.0.dylib
; ln
-sf libpcap
.0.dylib libpcap.dylib
296 rm -f
$(DESTDIR
)$(libdir)/libpcap.a
297 rm -f
$(DESTDIR
)$(includedir)/pcap
/pcap.h
298 rm -f
$(DESTDIR
)$(includedir)/pcap
/bpf.h
299 rm -f
$(DESTDIR
)$(includedir)/pcap
/namedb.h
300 rm -f
$(DESTDIR
)$(includedir)/pcap
/sll.h
301 rm -f
$(DESTDIR
)$(includedir)/pcap
/usb.h
302 -rmdir
$(DESTDIR
)$(includedir)/pcap
303 rm -f
$(DESTDIR
)$(includedir)/pcap.h
304 rm -f
$(DESTDIR
)$(includedir)/pcap-bpf.h
305 rm -f
$(DESTDIR
)$(includedir)/pcap-namedb.h
306 for i in
$(MAN3PCAP
); do \
307 rm -f
$(DESTDIR
)$(mandir)/man3
/$$i; done
308 rm -f
$(DESTDIR
)$(mandir)/man3
/pcap_datalink_val_to_description
.3pcap
309 rm -f
$(DESTDIR
)$(mandir)/man3
/pcap_dump_fopen
.3pcap
310 rm -f
$(DESTDIR
)$(mandir)/man3
/pcap_perror
.3pcap
311 rm -f
$(DESTDIR
)$(mandir)/man3
/pcap_sendpacket
.3pcap
312 rm -f
$(DESTDIR
)$(mandir)/man3
/pcap_dispatch
.3pcap
313 rm -f
$(DESTDIR
)$(mandir)/man3
/pcap_minor_version
.3pcap
314 rm -f
$(DESTDIR
)$(mandir)/man3
/pcap_next
.3pcap
315 rm -f
$(DESTDIR
)$(mandir)/man3
/pcap_fopen_offline
.3pcap
316 rm -f
$(DESTDIR
)$(mandir)/man3
/pcap_getnonblock
.3pcap
317 for i in
$(MAN4
); do \
318 rm -f
$(DESTDIR
)$(mandir)/man4
/$$i; done
321 rm -f
$(CLEANFILES
) libpcap
*.dylib libpcap.so
*
324 rm -f Makefile config.cache config.log config.status \
325 config.h gnuc.h os-proto.h bpf_filter.c stamp-h stamp-h.in
326 rm -rf autom4te.cache
329 ctags
-wtd
$(TAGFILES
)
331 packaging
/pcap.spec
: packaging
/pcap.spec.in VERSION
332 RPMVERSION
=`cat VERSION | sed s/-.*//g`; \
333 sed
-e s
/@VERSION@
/$$RPMVERSION/ -e s
/@NAME@
/libpcap-
`cat VERSION`/ $< > $@
336 @cwd
=`pwd` ; dir=`basename $$cwd` ; name
=$(PROG
)-`cat VERSION` ; \
337 list
="" ; make
distclean; cd ..
; mkdir
-p n
; cd n
; ln
-s ..
/$$dir $$name; \
338 tar -c
-z
-f
$$name.
tar.gz
$$name/.
;
340 depend
: $(GENSRC
) $(GENHDR
) bpf_filter.c
341 .
/mkdep
-c
$(CC
) $(DEFS
) $(INCLS
) $(SRC
)
343 Makefile
: Makefile.in config.status
345 @echo your Makefile was out of date
, now run
$(MAKE
) again