1#:ts=8
2#
3#    $Id: Makefile,v 4.21 2000/11/17 21:18:06 mj Exp $
4#
5#    Makefile for FIDOGATE src/common/
6#
7
8#
9# Normally it should not be necessary to modify this file, see
10# ../config.make and ../rules.make
11#
12
13TOPDIR		= ../..
14
15include $(TOPDIR)/config.make
16include $(TOPDIR)/rules.make
17
18
19OBJS		= acl.o \
20		  address.o \
21		  aliases.o \
22		  areas.o \
23		  areasbbs.o \
24		  binkley.o \
25		  bounce.o \
26		  cf_funcs.o \
27		  config.o \
28		  crc16.o \
29		  crc32.o \
30		  date.o \
31		  dir.o \
32		  file.o \
33		  flo.o \
34		  fopen.o \
35		  ftnaddr.o \
36		  getopt.o \
37		  getopt1.o \
38		  gettime.o \
39		  hosts.o \
40		  kludge.o \
41		  lock.o \
42		  log.o \
43		  mail.o \
44		  message.o \
45		  mime.o \
46		  misc.o \
47		  msgid.o \
48		  node.o \
49		  outpkt.o \
50		  packet.o \
51		  parsedate.o \
52		  parsenode.o \
53		  passwd.o \
54		  read.o \
55		  rematch.o \
56		  rfcaddr.o \
57		  rfcheader.o \
58		  routing.o \
59		  sequencer.o \
60		  strtok_r.o \
61		  textlist.o \
62		  tick.o \
63		  tmps.o \
64		  version.o \
65		  wildmat.o \
66		  xalloc.o
67
68
69
70LIBOBJS		= $(OBJS:%=$(LIB)(%))
71
72TESTS		= testparse testmatch testflo testheader testdir testtmps \
73		  testftnaddr testdate teststrtok testrematch
74TESTOBJS	= $(TESTS:%=%.o)
75
76
77all:		cf_funcs.mak cf_abbrev.mak cf_env.mak $(LIB)
78
79
80$(LIB):		$(LIBOBJS)
81	$(RANLIB) $(LIB)
82
83parsedate.c:	parsedate.y
84	@echo "expect 6 shift/reduce conflicts"
85	$(YACC) parsedate.y
86	mv y.tab.c parsedate.c
87
88cf_funcs.mak:	$(TOPDIR)/config.make $(TOPDIR)/subst.pl
89	$(PERL) $(TOPDIR)/subst.pl -c$(TOPDIR)/config.make -C >cf_funcs.mak
90	diff cf_funcs.mak cf_funcs.c >/dev/null || cp cf_funcs.mak cf_funcs.c
91
92cf_abbrev.mak:	$(TOPDIR)/config.make $(TOPDIR)/subst.pl
93	$(PERL) $(TOPDIR)/subst.pl -c$(TOPDIR)/config.make -A >cf_abbrev.mak
94	diff cf_abbrev.mak cf_abbrev.c >/dev/null || cp cf_abbrev.mak cf_abbrev.c
95
96cf_env.mak:	$(TOPDIR)/config.make $(TOPDIR)/subst.pl
97	$(PERL) $(TOPDIR)/subst.pl -c$(TOPDIR)/config.make -E >cf_env.mak
98	diff cf_env.mak cf_env.c >/dev/null || cp cf_env.mak cf_env.c
99
100install:
101
102clean veryclean:
103	rm -f $(PROGS) $(LIB)
104	rm -f $(TESTS) $(TESTOBJS)
105	rm -f *~ *.bak *.o tags TAGS core
106
107
108#
109# Test programs
110#
111check:		all $(TESTS)
112
113testparse:	testparse.o $(LIB)
114	$(CC) $(LFLAGS) -o testparse testparse.o $(LIBS)
115testparse.o:	parsenode.c
116	$(CC) $(CFLAGS) $(LOCAL_CFLAGS) -DTEST -c parsenode.c -o testparse.o
117
118testmatch:	testmatch.o $(LIB)
119	$(CC) $(LFLAGS) -o testmatch testmatch.o $(LIBS)
120testmatch.o:	wildmat.c
121	$(CC) $(CFLAGS) $(LOCAL_CFLAGS) -DTEST -c wildmat.c -o testmatch.o
122
123testflo:	testflo.o $(LIB)
124	$(CC) $(LFLAGS) -o testflo testflo.o $(LIBS)
125testflo.o:	flo.c
126	$(CC) $(CFLAGS) $(LOCAL_CFLAGS) -DTEST -c flo.c -o testflo.o
127
128testheader:	testheader.o $(LIB)
129	$(CC) $(LFLAGS) -o testheader testheader.o $(LIBS)
130testheader.o:	rfcheader.c
131	$(CC) $(CFLAGS) $(LOCAL_CFLAGS) -DTEST -c rfcheader.c -o testheader.o
132
133testdir:	testdir.o $(LIB)
134	$(CC) $(LFLAGS) -o testdir testdir.o $(LIBS)
135testdir.o:	dir.c
136	$(CC) $(CFLAGS) $(LOCAL_CFLAGS) -DTEST -c dir.c -o testdir.o
137
138testtmps:	testtmps.o $(LIB)
139	$(CC) $(LFLAGS) -o testtmps testtmps.o $(LIBS)
140testtmps.o:	tmps.c
141	$(CC) $(CFLAGS) $(LOCAL_CFLAGS) -DTEST -c tmps.c -o testtmps.o
142
143testftnaddr:	testftnaddr.o $(LIB)
144	$(CC) $(LFLAGS) -o testftnaddr testftnaddr.o $(LIBS)
145testftnaddr.o:	ftnaddr.c
146	$(CC) $(CFLAGS) $(LOCAL_CFLAGS) -DTEST -c ftnaddr.c -o testftnaddr.o
147
148testdate:	testdate.o $(LIB)
149	$(CC) $(LFLAGS) -o testdate testdate.o $(LIBS)
150testdate.o:	parsedate.c
151	$(CC) $(CFLAGS) $(LOCAL_CFLAGS) -DTEST -c parsedate.c -o testdate.o
152
153teststrtok:	teststrtok.o $(LIB)
154	$(CC) $(LFLAGS) -o teststrtok teststrtok.o $(LIBS)
155teststrtok.o:	strtok_r.c
156	$(CC) $(CFLAGS) $(LOCAL_CFLAGS) -DTEST -c strtok_r.c -o teststrtok.o
157
158testrematch:	testrematch.o $(LIB)
159	$(CC) $(LFLAGS) -o testrematch testrematch.o $(LIBS)
160testrematch.o:	rematch.c
161	$(CC) $(CFLAGS) $(LOCAL_CFLAGS) -DTEST -c rematch.c -o testrematch.o
162
163
164#
165# Dependencies
166#
167depend:
168	$(CC) $(CFLAGS) -MM *.c >.depend
169
170depend-all:
171	$(CC) $(CFLAGS) -M *.c >.depend
172
173ifeq (.depend,$(wildcard .depend))
174include .depend
175endif
176