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.110 2007-12-31 02:34:30 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
107 ar rc
$@
$(OBJ
) $(LIBS
)
110 shared
: libpcap.
$(DYEXT
)
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.
118 $(CC
) -shared
-o
$@.
`cat VERSION` $(OBJ
) $(DAGLIBS
)
120 # the following rule succeeds, but the result is untested.
121 libpcap.dylib
: $(OBJ
)
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`
127 scanner.c
: $(srcdir)/scanner.l
129 .
/runlex.sh
$(LEX
) -o
$@
$<
131 scanner.o
: scanner.c tokdefs.h
132 $(CC
) $(CFLAGS
) -c scanner.c
137 grammar.c
: $(srcdir)/grammar.y
138 @
rm -f grammar.c tokdefs.h
145 $(CC
) $(CFLAGS
) -Dyylval
=pcap_lval
-c grammar.c
148 $(CC
) $(CFLAGS
) -c version.c
150 snprintf.o
: $(srcdir)/missing
/snprintf.c
151 $(CC
) $(CFLAGS
) -o
$@
-c
$(srcdir)/missing
/snprintf.c
153 version.c
: $(srcdir)/VERSION
155 sed
-e
's/.*/char pcap_version[] = "&";/' $(srcdir)/VERSION
> $@
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.
164 version.h
: $(srcdir)/VERSION
166 sed
-e
's/.*/static const char pcap_version_string[] = "libpcap version &";/' $(srcdir)/VERSION
> $@
168 bpf_filter.c
: $(srcdir)/bpf
/net
/bpf_filter.c
170 ln
-s
$(srcdir)/bpf
/net
/bpf_filter.c bpf_filter.c
172 bpf_filter.o
: bpf_filter.c
173 $(CC
) $(CFLAGS
) -c bpf_filter.c
176 # Test programs - not built by default, and not installed.
178 filtertest
: filtertest.c libpcap.a
179 $(CC
) $(CFLAGS
) -I.
-L.
-o filtertest filtertest.c libpcap.a
181 findalldevstest
: findalldevstest.c libpcap.a
182 $(CC
) $(CFLAGS
) -I.
-L.
-o findalldevstest findalldevstest.c 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
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
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
234 rm -f
$(CLEANFILES
) libpcap
*.dylib libpcap.so
*
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
242 ctags
-wtd
$(TAGFILES
)
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`/ $< > $@
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/.
;
253 depend
: $(GENSRC
) $(GENHDR
) bpf_filter.c
254 .
/mkdep
-c
$(CC
) $(DEFS
) $(INCLS
) $(SRC
)
256 Makefile
: Makefile.in config.status
258 @echo your Makefile was out of date
, now run
$(MAKE
) again