]> The Tcpdump Group git mirrors - libpcap/blob - Makefile.in
Turn close_op into cleanup_op; the routine that handles it can also be
[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.108.2.10 2008-04-09 21:41:53 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 MAN3PCAP = pcap.3pcap \
104 pcap_breakloop.3pcap \
105 pcap_can_set_rfmon.3pcap \
106 pcap_close.3pcap \
107 pcap_compile.3pcap \
108 pcap_create.3pcap \
109 pcap_datalink.3pcap \
110 pcap_datalink_name_to_val.3pcap \
111 pcap_datalink_val_to_name.3pcap \
112 pcap_dump.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 \
118 pcap_file.3pcap \
119 pcap_fileno.3pcap \
120 pcap_findalldevs.3pcap \
121 pcap_freealldevs.3pcap \
122 pcap_freecode.3pcap \
123 pcap_get_selectable_fd.3pcap \
124 pcap_geterr.3pcap \
125 pcap_inject.3pcap \
126 pcap_is_swapped.3pcap \
127 pcap_lib_version.3pcap \
128 pcap_list_datalinks.3pcap \
129 pcap_lookupdev.3pcap \
130 pcap_lookupnet.3pcap \
131 pcap_loop.3pcap \
132 pcap_major_version.3pcap \
133 pcap_next_ex.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 \
147 pcap_stats.3pcap \
148 pcap_statustostr.3pcap \
149 pcap_strerror.3pcap
150
151 MAN4 = pcap-filter.4 \
152 pcap-linktype.4
153
154 all: libpcap.a
155
156 libpcap.a: $(OBJ)
157 @rm -f $@
158 $(AR) rc $@ $(OBJ) $(LIBS)
159 $(RANLIB) $@
160
161 shared: libpcap.$(DYEXT)
162
163 #
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.
166 #
167 libpcap.so: $(OBJ)
168 @rm -f $@
169 $(CC) -shared -o $@.`cat VERSION` $(OBJ) $(DAGLIBS)
170
171 # the following rule succeeds, but the result is untested.
172 libpcap.dylib: $(OBJ)
173 rm -f libpcap*.dylib
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`
177
178 scanner.c: $(srcdir)/scanner.l
179 @rm -f $@
180 ./runlex.sh $(LEX) -o$@ $<
181
182 scanner.o: scanner.c tokdefs.h
183 $(CC) $(CFLAGS) -c scanner.c
184
185 pcap.o: version.h
186
187 tokdefs.h: grammar.c
188 grammar.c: $(srcdir)/grammar.y
189 @rm -f grammar.c tokdefs.h
190 $(YACC) -d $<
191 mv y.tab.c grammar.c
192 mv y.tab.h tokdefs.h
193
194 grammar.o: grammar.c
195 @rm -f $@
196 $(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c
197
198 version.o: version.c
199 $(CC) $(CFLAGS) -c version.c
200
201 snprintf.o: $(srcdir)/missing/snprintf.c
202 $(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
203
204 version.c: $(srcdir)/VERSION
205 @rm -f $@
206 sed -e 's/.*/char pcap_version[] = "&";/' $(srcdir)/VERSION > $@
207
208 #
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.
214 #
215 version.h: $(srcdir)/VERSION
216 @rm -f $@
217 sed -e 's/.*/static const char pcap_version_string[] = "libpcap version &";/' $(srcdir)/VERSION > $@
218
219 bpf_filter.c: $(srcdir)/bpf/net/bpf_filter.c
220 rm -f bpf_filter.c
221 ln -s $(srcdir)/bpf/net/bpf_filter.c bpf_filter.c
222
223 bpf_filter.o: bpf_filter.c
224 $(CC) $(CFLAGS) -c bpf_filter.c
225
226 #
227 # Test programs - not built by default, and not installed.
228 #
229 filtertest: filtertest.c libpcap.a
230 $(CC) $(CFLAGS) -I. -L. -o filtertest filtertest.c libpcap.a
231
232 findalldevstest: findalldevstest.c libpcap.a
233 $(CC) $(CFLAGS) -I. -L. -o findalldevstest findalldevstest.c libpcap.a
234
235 install: 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
287
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
294
295 uninstall:
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
319
320 clean:
321 rm -f $(CLEANFILES) libpcap*.dylib libpcap.so*
322
323 distclean: clean
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
327
328 tags: $(TAGFILES)
329 ctags -wtd $(TAGFILES)
330
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`/ $< > $@
334
335 releasetar:
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/. ;
339
340 depend: $(GENSRC) $(GENHDR) bpf_filter.c
341 ./mkdep -c $(CC) $(DEFS) $(INCLS) $(SRC)
342
343 Makefile: Makefile.in config.status
344 ./config.status
345 @echo your Makefile was out of date, now run $(MAKE) again
346 exit 1