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.99 2003/12/15 01:35:03 guy Exp $ (LBL)
23 # Various configurable paths (remember to edit Makefile.in, not Makefile)
28 exec_prefix = @
exec_prefix@
29 # Pathname of directory to install the include files
30 includedir = @
includedir@
31 # Pathname of directory to install the library
33 # Pathname of directory to install the man page
41 # You shouldn't need to edit anything below.
48 DEFS
= @DEFS@ @V_DEFS@ @V_HAVE_REMOTE@
53 CFLAGS
= $(CCOPT
) $(INCLS
) $(DEFS
)
56 INSTALL_PROGRAM
= @INSTALL_PROGRAM@
57 INSTALL_DATA
= @INSTALL_DATA@
61 # Flex and bison allow you to specify the prefixes of the global symbols
62 # used by the generated parser. This allows programs to use lex/yacc
63 # and link against libpcap. If you don't have flex or bison, get them.
68 # Explicitly define compilation rule since SunOS 4's make doesn't like gcc.
69 # Also, gcc does not remove the .o before forking 'as', which can be a
70 # problem if you don't own the file but can write to the directory.
73 $(CC
) $(CFLAGS
) -c
$(srcdir)/$*.c
75 PSRC
= pcap-@V_PCAP@.c
76 FSRC
= fad-@V_FINDALLDEVS@.c
78 CSRC
= pcap.c inet.c gencode.c optimize.c nametoaddr.c \
79 etherent.c savefile.c bpf_filter.c bpf_image.c bpf_dump.c
80 GENSRC
= scanner.c grammar.c version.c
82 REMOTESRC
= @V_REMOTE_FILES@
86 SRC
= $(PSRC
) $(FSRC
) $(CSRC
) $(SSRC
) $(GENSRC
) $(REMOTESRC
)
88 # We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
89 # hack the extra indirection
91 OBJ
= $(PSRC
:.c
=.o
) $(FSRC
:.c
=.o
) $(CSRC
:.c
=.o
) $(SSRC
:.c
=.o
) $(GENSRC
:.c
=.o
) $(REMOTESRC
:.c
=.o
) $(LIBOBJS
)
92 HDR
= pcap.h pcap-int.h pcap-namedb.h pcap-nit.h pcap-pf.h \
93 ethertype.h gencode.h gnuc.h
101 $(SRC
) $(HDR
) $(TAGHDR
)
103 CLEANFILES
= $(OBJ
) libpcap.a
$(GENSRC
) $(GENHDR
) lex.yy.c
109 ar rc
$@
$(OBJ
) $(LIBS
)
112 shared
: libpcap.
$(DYEXT
)
115 # XXX - this works with GNU ld, but won't necessarily work with native
116 # ld on, for example, various SVR4-flavored platforms, or Digital UNIX.
120 ld -shared
-o
$@.
`cat VERSION` $(OBJ
)
122 # the following rule succeeds, but the result is untested.
123 libpcap.dylib
: $(OBJ
)
125 $(CC
) -dynamiclib
-undefined error
-o libpcap.
`cat VERSION`.dylib
$(OBJ
) \
126 -install_name
$(libdir)/libpcap
.0.dylib
-compatibility_version
`cat VERSION` \
127 -current_version
`cat VERSION`
130 scanner.c
: $(srcdir)/scanner.l
132 $(LEX
) -t
$< > $$$$.
$@
; mv
$$$$.
$@
$@
134 scanner.o
: scanner.c tokdefs.h
135 $(CC
) $(CFLAGS
) -c scanner.c
140 grammar.c
: $(srcdir)/grammar.y
141 @
rm -f grammar.c tokdefs.h
148 $(CC
) $(CFLAGS
) -Dyylval
=pcap_lval
-c grammar.c
151 $(CC
) $(CFLAGS
) -c version.c
153 snprintf.o
: $(srcdir)/missing
/snprintf.c
154 $(CC
) $(CFLAGS
) -o
$@
-c
$(srcdir)/missing
/snprintf.c
156 version.c
: $(srcdir)/VERSION
158 sed
-e
's/.*/char pcap_version[] = "&";/' $(srcdir)/VERSION
> $@
161 # NOTE: this really is supposed to be static; importing a string
162 # from a shared library does not work very well on many
163 # versions of UNIX (Solaris, Linux, and the BSDs, for example),
164 # so we make the version string static and return it from
165 # a function, which does work.
167 version.h
: $(srcdir)/VERSION
169 sed
-e
's/.*/static const char pcap_version_string[] = "libpcap version &";/' $(srcdir)/VERSION
> $@
171 bpf_filter.c
: $(srcdir)/bpf
/net
/bpf_filter.c
173 ln
-s
$(srcdir)/bpf
/net
/bpf_filter.c bpf_filter.c
175 bpf_filter.o
: bpf_filter.c
176 $(CC
) $(CFLAGS
) -c bpf_filter.c
179 [ -d
$(DESTDIR
)$(libdir) ] || \
180 (mkdir
-p
$(DESTDIR
)$(libdir); chmod
755 $(DESTDIR
)$(libdir))
181 $(INSTALL_DATA
) libpcap.a
$(DESTDIR
)$(libdir)/libpcap.a
182 $(RANLIB
) $(DESTDIR
)$(libdir)/libpcap.a
183 [ -d
$(DESTDIR
)$(includedir) ] || \
184 (mkdir
-p
$(DESTDIR
)$(includedir); chmod
755 $(DESTDIR
)$(includedir))
185 $(INSTALL_DATA
) $(srcdir)/pcap.h
$(DESTDIR
)$(includedir)/pcap.h
186 $(INSTALL_DATA
) $(srcdir)/pcap-bpf.h \
187 $(DESTDIR
)$(includedir)/pcap-bpf.h
188 $(INSTALL_DATA
) $(srcdir)/pcap-namedb.h \
189 $(DESTDIR
)$(includedir)/pcap-namedb.h
190 [ -d
$(DESTDIR
)$(mandir)/man3
] || \
191 (mkdir
-p
$(DESTDIR
)$(mandir)/man3
; chmod
755 $(DESTDIR
)$(mandir)/man3
)
192 $(INSTALL_DATA
) $(srcdir)/pcap
.3 \
193 $(DESTDIR
)$(mandir)/man3
/pcap
.3
195 install-shared
: install-shared-
$(DYEXT
)
196 install-shared-so
: libpcap.so
197 $(INSTALL_PROGRAM
) libpcap.so.
`cat VERSION` $(DESTDIR
)$(libdir)/libpcap.so.
`cat VERSION`
198 install-shared-dylib
: libpcap.dylib
199 $(INSTALL_PROGRAM
) libpcap.
`cat VERSION`.dylib
$(DESTDIR
)$(libdir)/libpcap.
`cat VERSION`.dylib
200 VER
=`cat VERSION`; cd
$(DESTDIR
)$(libdir) && ln
-sf libpcap.
$$VER.dylib libpcap
.0.dylib
; ln
-sf libpcap
.0.dylib libpcap.dylib
203 rm -f
$(DESTDIR
)$(libdir)/libpcap.a
204 rm -f
$(DESTDIR
)$(includedir)/pcap.h
205 rm -f
$(DESTDIR
)$(includedir)/pcap-bpf.h
206 rm -f
$(DESTDIR
)$(includedir)/pcap-namedb.h
207 rm -f
$(DESTDIR
)$(mandir)/man3
/pcap
.3
210 rm -f
$(CLEANFILES
) libpcap
*.dylib libpcap.so
*
213 rm -f Makefile config.cache config.log config.status \
214 config.h gnuc.h os-proto.h bpf_filter.c stamp-h stamp-h.in
215 rm -rf autom4te.cache
218 ctags
-wtd
$(TAGFILES
)
220 packaging
/pcap.spec
: packaging
/pcap.spec.in VERSION
221 RPMVERSION
=`cat VERSION | sed s/-.*//g`; \
222 sed
-e s
/@VERSION@
/$$RPMVERSION/ -e s
/@NAME@
/libpcap-
`cat VERSION`/ $< > $@
224 tar: Makefile packaging
/pcap.spec
225 @cwd
=`pwd` ; dir=`basename $$cwd` ; name
=libpcap-
`cat VERSION` ; \
226 list
="" ; tar="tar chf" ; \
227 for i in
`cat FILES` ; do list
="$$list $$name/$$i" ; done
; \
229 "rm -f ../$$name; ln -s $$dir ../$$name" ; \
230 rm -f ..
/$$name; ln
-s
$$dir ..
/$$name ; \
232 "(cd .. ; $$tar - [lots of files]) | gzip -c > /tmp/$$name.tar.gz" ; \
233 (cd ..
; $$tar - $$list) | gzip
-c
> /tmp
/$$name.
tar.gz
; \
235 "rm -f ../$$name" ; \
238 depend
: $(GENSRC
) $(GENHDR
) bpf_filter.c
239 .
/mkdep
-c
$(CC
) $(DEFS
) $(INCLS
) $(SRC
)
241 Makefile
: Makefile.in config.status
243 @echo your Makefile was out of date
, now run
$(MAKE
) again