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