xref: /freebsd/contrib/libpcap/Makefile.in (revision daf1cffce2e07931f27c6c6998652e90df6ba87e)
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.75 1999/10/30 05:33:45 itojun Exp $ (LBL)
21
22#
23# Various configurable paths (remember to edit Makefile.in, not Makefile)
24#
25
26# Top level hierarchy
27prefix = @prefix@
28exec_prefix = @exec_prefix@
29# Pathname of directory to install the include files
30INCLDEST = @includedir@
31# Pathname of directory to install the library
32LIBDEST =  @libdir@
33# Pathname of directory to install the man page
34MANDEST = @mandir@
35
36# VPATH
37srcdir = @srcdir@
38VPATH = @srcdir@
39
40#
41# You shouldn't need to edit anything below.
42#
43
44CC = @CC@
45CCOPT = @V_CCOPT@
46INCLS = -I. @V_INCLS@
47DEFS = @DEFS@
48
49# Standard CFLAGS
50CFLAGS = $(CCOPT) $(INCLS) $(DEFS)
51
52INSTALL = @INSTALL@
53RANLIB = @V_RANLIB@
54
55#
56# Flex and bison allow you to specify the prefixes of the global symbols
57# used by the generated parser.  This allows programs to use lex/yacc
58# and link against libpcap.  If you don't have flex or bison, get them.
59#
60LEX = @V_LEX@
61YACC = @V_YACC@
62
63# Explicitly define compilation rule since SunOS 4's make doesn't like gcc.
64# Also, gcc does not remove the .o before forking 'as', which can be a
65# problem if you don't own the file but can write to the directory.
66.c.o:
67	@rm -f $@
68	$(CC) $(CFLAGS) -c $(srcdir)/$*.c
69
70PSRC =	pcap-@V_PCAP@.c
71CSRC =	pcap.c inet.c gencode.c optimize.c nametoaddr.c \
72	etherent.c savefile.c bpf_filter.c bpf_image.c
73GENSRC = scanner.c grammar.c version.c
74
75SRC =	$(PSRC) $(CSRC) $(GENSRC)
76
77# We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
78# hack the extra indirection
79OBJ =	$(PSRC:.c=.o) $(CSRC:.c=.o) $(GENSRC:.c=.o)
80HDR =	pcap.h pcap-int.h pcap-namedb.h pcap-nit.h pcap-pf.h \
81	ethertype.h gencode.h gnuc.h
82GENHDR = \
83	tokdefs.h
84
85TAGHDR = \
86	bpf/net/bpf.h
87
88TAGFILES = \
89	$(SRC) $(HDR) $(TAGHDR)
90
91CLEANFILES = $(OBJ) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c
92
93all: libpcap.a
94
95libpcap.a: $(OBJ)
96	@rm -f $@
97	ar rc $@ $(OBJ)
98	$(RANLIB) $@
99
100scanner.c: $(srcdir)/scanner.l
101	@rm -f $@
102	$(LEX) -t $< > $$$$.$@; mv $$$$.$@ $@
103
104scanner.o: scanner.c tokdefs.h
105	$(CC) $(CFLAGS) -c scanner.c
106
107tokdefs.h: grammar.c
108grammar.c: $(srcdir)/grammar.y
109	@rm -f grammar.c tokdefs.h
110	$(YACC) -d $<
111	mv y.tab.c grammar.c
112	mv y.tab.h tokdefs.h
113
114grammar.o: grammar.c
115	@rm -f $@
116	$(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c
117
118version.o: version.c
119	$(CC) $(CFLAGS) -c version.c
120
121version.c: $(srcdir)/VERSION
122	@rm -f $@
123	sed -e 's/.*/char pcap_version[] = "&";/' $(srcdir)/VERSION > $@
124
125bpf_filter.o: $(srcdir)/bpf/net/bpf_filter.c
126	$(CC) $(CFLAGS) -c $(srcdir)/bpf/net/bpf_filter.c -o bpf_filter.o
127
128install: force
129	$(INSTALL) -m 444 -o bin -g bin libpcap.a $(DESTDIR)$(LIBDEST)/libpcap.a
130	$(RANLIB) $(DESTDIR)$(LIBDEST)/libpcap.a
131
132install-incl: force
133	$(INSTALL) -m 444 -o bin -g bin $(srcdir)/pcap.h \
134	    $(DESTDIR)$(INCLDEST)/pcap.h
135	$(INSTALL) -m 444 -o bin -g bin $(srcdir)/pcap-namedb.h \
136	    $(DESTDIR)$(INCLDEST)/pcap-namedb.h
137	$(INSTALL) -m 444 -o bin -g bin $(srcdir)/bpf/net/bpf.h \
138	    $(DESTDIR)$(INCLDEST)/net/bpf.h
139
140install-man: force
141	$(INSTALL) -m 444 -o bin -g bin $(srcdir)/pcap.3 \
142	    $(DESTDIR)$(MANDEST)/man3/pcap.3
143
144clean:
145	rm -f $(CLEANFILES)
146
147distclean:
148	rm -f $(CLEANFILES) Makefile config.cache config.log config.status \
149	    gnuc.h os-proto.h net
150
151tags: $(TAGFILES)
152	ctags -wtd $(TAGFILES)
153
154tar:	force
155	@cwd=`pwd` ; dir=`basename $$cwd` ; name=libpcap-`cat VERSION` ; \
156	    list="" ; tar="tar chFFf" ; \
157	    for i in `cat FILES` ; do list="$$list $$name/$$i" ; done; \
158	    echo \
159	    "rm -f ../$$name; ln -s $$dir ../$$name" ; \
160	     rm -f ../$$name; ln -s $$dir ../$$name ; \
161	    echo \
162	    "(cd .. ; $$tar - [lots of files]) | compress > /tmp/$$name.tar.Z" ; \
163	     (cd .. ; $$tar - $$list) | compress > /tmp/$$name.tar.Z ; \
164	    echo \
165	    "rm -f ../$$name" ; \
166	     rm -f ../$$name
167
168force:	/tmp
169depend:	$(GENSRC) force
170	./mkdep -c $(CC) $(DEFS) $(INCLS) $(SRC)
171