source: src/router/libpcap/Makefile @ 9055

Last change on this file since 9055 was 9055, checked in by botho, 5 years ago

works better

File size: 7.4 KB
Line 
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.99 2003/12/15 01:35:03 guy Exp $ (LBL)
21
22#
23# Various configurable paths (remember to edit Makefile.in, not Makefile)
24#
25
26# Top level hierarchy
27prefix = /usr/local
28exec_prefix = ${prefix}
29# Pathname of directory to install the include files
30includedir = ${prefix}/include
31# Pathname of directory to install the library
32libdir =  ${exec_prefix}/lib
33# Pathname of directory to install the man page
34mandir = ${prefix}/man
35
36# VPATH
37srcdir = .
38
39
40#
41# You shouldn't need to edit anything below.
42#
43
44CCOPT = $(COPTS) -fomit-frame-pointer -fpic -fPIC -I$(LINUXDIR)/include
45INCLS = -I.
46DEFS = -DHAVE_CONFIG_H  -D_U_="__attribute__((unused))"
47LIBS =
48DYEXT = so
49
50# Standard CFLAGS
51CFLAGS = $(CCOPT) $(INCLS) $(DEFS)
52
53INSTALL = /usr/bin/install -c
54INSTALL_PROGRAM = ${INSTALL}
55INSTALL_DATA = ${INSTALL} -m 644
56RANLIB = mipsel-linux-ranlib
57
58#
59# Flex and bison allow you to specify the prefixes of the global symbols
60# used by the generated parser.  This allows programs to use lex/yacc
61# and link against libpcap.  If you don't have flex or bison, get them.
62#
63LEX = flex -Ppcap_
64YACC = bison -y -p pcap_
65
66# Explicitly define compilation rule since SunOS 4's make doesn't like gcc.
67# Also, gcc does not remove the .o before forking 'as', which can be a
68# problem if you don't own the file but can write to the directory.
69.c.o:
70        @rm -f $@
71        $(CC) $(CFLAGS) -c $(srcdir)/$*.c
72
73PSRC =  pcap-linux.c
74FSRC =  fad-gifc.c
75SSRC = 
76CSRC =  pcap.c inet.c gencode.c optimize.c nametoaddr.c \
77        etherent.c savefile.c bpf_filter.c bpf_image.c bpf_dump.c
78GENSRC = scanner.c grammar.c version.c
79LIBOBJS =
80
81SRC =   $(PSRC) $(FSRC) $(CSRC) $(SSRC) $(GENSRC)
82
83# We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
84# hack the extra indirection
85OBJ =   $(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) $(LIBOBJS)
86HDR =   pcap.h pcap-int.h pcap-namedb.h pcap-nit.h pcap-pf.h \
87        ethertype.h gencode.h gnuc.h
88GENHDR = \
89        tokdefs.h version.h
90
91TAGHDR = \
92        pcap-bpf.h
93
94TAGFILES = \
95        $(SRC) $(HDR) $(TAGHDR)
96
97CLEANFILES = $(OBJ) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c
98
99all: libpcap.a
100
101libpcap.a: $(OBJ)
102        @rm -f $@
103        ar rc $@ $(OBJ) $(LIBS)
104        $(RANLIB) $@
105
106shared: libpcap.$(DYEXT)
107
108#
109# XXX - this works with GNU ld, but won't necessarily work with native
110# ld on, for example, various SVR4-flavored platforms, or Digital UNIX.
111#
112libpcap.so: $(OBJ)
113        @rm -f $@
114        $(LD) -shared -o $@ $(OBJ)
115
116# the following rule succeeds, but the result is untested.
117libpcap.dylib: $(OBJ)
118        rm -f libpcap*.dylib
119        $(CC) -dynamiclib -undefined error -o libpcap.`cat VERSION`.dylib $(OBJ) \
120                -install_name $(libdir)/libpcap.0.dylib -compatibility_version `cat VERSION` \
121                -current_version `cat VERSION`
122
123
124scanner.c: $(srcdir)/scanner.l
125        @rm -f $@
126        $(LEX) -t $< > $$$$.$@; mv $$$$.$@ $@
127
128scanner.o: scanner.c tokdefs.h
129        $(CC) $(CFLAGS) -c scanner.c
130
131pcap.o: version.h
132
133tokdefs.h: grammar.c
134grammar.c: $(srcdir)/grammar.y
135        @rm -f grammar.c tokdefs.h
136        $(YACC) -d $<
137        mv y.tab.c grammar.c
138        mv y.tab.h tokdefs.h
139
140grammar.o: grammar.c
141        @rm -f $@
142        $(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c
143
144version.o: version.c
145        $(CC) $(CFLAGS) -c version.c
146
147snprintf.o: $(srcdir)/missing/snprintf.c
148        $(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
149
150version.c: $(srcdir)/VERSION
151        @rm -f $@
152        sed -e 's/.*/char pcap_version[] = "&";/' $(srcdir)/VERSION > $@
153
154#
155# NOTE: this really is supposed to be static; importing a string
156# from a shared library does not work very well on many
157# versions of UNIX (Solaris, Linux, and the BSDs, for example),
158# so we make the version string static and return it from
159# a function, which does work.
160#
161version.h: $(srcdir)/VERSION
162        @rm -f $@
163        sed -e 's/.*/static const char pcap_version_string[] = "libpcap version &";/' $(srcdir)/VERSION > $@
164
165bpf_filter.c: $(srcdir)/bpf/net/bpf_filter.c
166        rm -f bpf_filter.c
167        ln -s $(srcdir)/bpf/net/bpf_filter.c bpf_filter.c
168
169bpf_filter.o: bpf_filter.c
170        $(CC) $(CFLAGS) -c bpf_filter.c
171
172install: libpcap.a
173        [ -d $(DESTDIR)$(libdir) ] || \
174            (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
175        $(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a
176        $(RANLIB) $(DESTDIR)$(libdir)/libpcap.a
177        [ -d $(DESTDIR)$(includedir) ] || \
178            (mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir))
179        $(INSTALL_DATA) $(srcdir)/pcap.h $(DESTDIR)$(includedir)/pcap.h
180        $(INSTALL_DATA) $(srcdir)/pcap-bpf.h \
181            $(DESTDIR)$(includedir)/pcap-bpf.h
182        $(INSTALL_DATA) $(srcdir)/pcap-namedb.h \
183            $(DESTDIR)$(includedir)/pcap-namedb.h
184        [ -d $(DESTDIR)$(mandir)/man3 ] || \
185                (mkdir -p $(DESTDIR)$(mandir)/man3; chmod 755 $(DESTDIR)$(mandir)/man3)
186        $(INSTALL_DATA) $(srcdir)/pcap.3 \
187            $(DESTDIR)$(mandir)/man3/pcap.3
188
189install-shared: install-shared-$(DYEXT)
190install-shared-so: libpcap.so
191        $(INSTALL_PROGRAM) libpcap.so.`cat VERSION` $(DESTDIR)$(libdir)/libpcap.so.`cat VERSION`
192install-shared-dylib: libpcap.dylib
193        $(INSTALL_PROGRAM) libpcap.`cat VERSION`.dylib $(DESTDIR)$(libdir)/libpcap.`cat VERSION`.dylib
194        VER=`cat VERSION`; cd $(DESTDIR)$(libdir) && ln -sf libpcap.$$VER.dylib libpcap.0.dylib;  ln -sf libpcap.0.dylib libpcap.dylib
195
196uninstall:
197        rm -f $(DESTDIR)$(libdir)/libpcap.a
198        rm -f $(DESTDIR)$(includedir)/pcap.h
199        rm -f $(DESTDIR)$(includedir)/pcap-bpf.h
200        rm -f $(DESTDIR)$(includedir)/pcap-namedb.h
201        rm -f $(DESTDIR)$(mandir)/man3/pcap.3
202
203clean:
204        rm -f $(CLEANFILES) libpcap*.dylib libpcap.so*
205
206distclean: clean
207        rm -f Makefile config.cache config.log config.status \
208            config.h gnuc.h os-proto.h bpf_filter.c stamp-h stamp-h.in
209        rm -rf autom4te.cache
210
211tags: $(TAGFILES)
212        ctags -wtd $(TAGFILES)
213
214packaging/pcap.spec: packaging/pcap.spec.in VERSION
215        RPMVERSION=`cat VERSION | sed s/-.*//g`; \
216                sed -e s/@VERSION@/$$RPMVERSION/ -e s/@NAME@/libpcap-`cat VERSION`/ $<   > $@
217
218tar: Makefile packaging/pcap.spec
219        @cwd=`pwd` ; dir=`basename $$cwd` ; name=libpcap-`cat VERSION` ; \
220            list="" ; tar="tar chf" ; \
221            for i in `cat FILES` ; do list="$$list $$name/$$i" ; done; \
222            echo \
223            "rm -f ../$$name; ln -s $$dir ../$$name" ; \
224             rm -f ../$$name; ln -s $$dir ../$$name ; \
225            echo \
226            "(cd .. ; $$tar - [lots of files]) | gzip -c > /tmp/$$name.tar.gz" ; \
227             (cd .. ; $$tar - $$list) | gzip -c > /tmp/$$name.tar.gz ; \
228            echo \
229            "rm -f ../$$name" ; \
230             rm -f ../$$name
231
232depend: $(GENSRC) $(GENHDR) bpf_filter.c
233        ./mkdep -c $(CC) $(DEFS) $(INCLS) $(SRC)
234
Note: See TracBrowser for help on using the repository browser.