xref: /freebsd/contrib/libpcap/Makefile.in (revision 4cf49a43559ed9fdad601bdcccd2c55963008675)
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: Makefile.in,v 1.72 97/06/30 13:56:14 leres 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
105tokdefs.h: grammar.c
106grammar.c: $(srcdir)/grammar.y
107	@rm -f grammar.c tokdefs.h
108	$(YACC) -d $<
109	mv y.tab.c grammar.c
110	mv y.tab.h tokdefs.h
111
112grammar.o: grammar.c
113	@rm -f $@
114	$(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c
115
116version.o: version.c
117version.c: $(srcdir)/VERSION
118	@rm -f $@
119	sed -e 's/.*/char pcap_version[] = "&";/' $(srcdir)/VERSION > $@
120
121install: force
122	$(INSTALL) -m 444 -o bin -g bin libpcap.a $(DESTDIR)$(LIBDEST)/libpcap.a
123	$(RANLIB) $(DESTDIR)$(LIBDEST)/libpcap.a
124
125install-incl: force
126	$(INSTALL) -m 444 -o bin -g bin $(srcdir)/pcap.h \
127	    $(DESTDIR)$(INCLDEST)/pcap.h
128	$(INSTALL) -m 444 -o bin -g bin $(srcdir)/pcap-namedb.h \
129	    $(DESTDIR)$(INCLDEST)/pcap-namedb.h
130	$(INSTALL) -m 444 -o bin -g bin $(srcdir)/net/bpf.h \
131	    $(DESTDIR)$(INCLDEST)/net/bpf.h
132
133install-man: force
134	$(INSTALL) -m 444 -o bin -g bin $(srcdir)/pcap.3 \
135	    $(DESTDIR)$(MANDEST)/man3/pcap.3
136
137clean:
138	rm -f $(CLEANFILES)
139
140distclean:
141	rm -f $(CLEANFILES) Makefile config.cache config.log config.status \
142	    gnuc.h os-proto.h bpf_filter.c net
143
144tags: $(TAGFILES)
145	ctags -wtd $(TAGFILES)
146
147tar:	force
148	@cwd=`pwd` ; dir=`basename $$cwd` ; name=libpcap-`cat VERSION` ; \
149	    list="" ; tar="tar chFFf" ; \
150	    for i in `cat FILES` ; do list="$$list $$name/$$i" ; done; \
151	    echo \
152	    "rm -f ../$$name; ln -s $$dir ../$$name" ; \
153	     rm -f ../$$name; ln -s $$dir ../$$name ; \
154	    echo \
155	    "(cd .. ; $$tar - [lots of files]) | compress > /tmp/$$name.tar.Z" ; \
156	     (cd .. ; $$tar - $$list) | compress > /tmp/$$name.tar.Z ; \
157	    echo \
158	    "rm -f ../$$name" ; \
159	     rm -f ../$$name
160
161force:	/tmp
162depend:	$(GENSRC) force
163	./mkdep -c $(CC) $(DEFS) $(INCLS) $(SRC)
164