1SHELL=/bin/sh
2.SUFFIXES: .c .0
3
4############################################################################
5# History File Configuration Stuff
6############################################################################
7
8# Step 1: Define ONE of the CHKHISTORY
9#CHKHISTORY=@HISTORY@
10#CHKHISTORY=chkhistory.o	# use flat file history routine
11#CHKHISTORY=chkhistory_db.o	# use DB history routine, if you use
12                                # DBM, GDBM, NDBM, or DBZ
13                                # in order to use DBZ with INN you will need
14                                # the full compiled source code, especially
15                                # inn/lib/libinn.so & inn/include/dbz.h
16
17# If you are using flat file, you can skip the rest, they don't matter
18
19# Step 2: Define ONE of the Database Types
20#DB_TYPE=@DB_TYPE@
21#DB_TYPE=-DUSE_DBM
22#DB_TYPE=-DUSE_GDBM
23#DB_TYPE=-DUSE_NDBM
24#DB_TYPE=-DUSE_DBZ	# for inn-1.X.X users
25#DB_TYPE=-DUSE_INN2	# for inn-2.1-2.2 users
26#DB_TYPE=-DUSE_INN23	# for inn-2.3.X users
27
28# Step 3: Define ONE Library that contains the functions
29# If you are using INN-2.X, and the compiler complains
30# about Undefined Symbols QIOclose QIOopen QIOread
31# Use the DB_LIB that includes -lstorage
32#DB_LIB=@DB_LIB@
33#DB_LIB=-ldbm
34#DB_LIB=-lgdbm
35#DB_LIB=-lndbm
36#DB_LIB=-ldbz
37#DB_LIB=-linn -lstorage	# see note above
38#DB_LIB=-linn		# INN puts DBZ code in here
39#DB_LIB=-lcnews		# cnews puts DBZ code in here
40
41# Step 4: IF your DB Library/Includes are in a non-standard place,
42# define These
43#DB_INC_LOC=-I/usr/src/inn-2.3.4/include
44#DB_LIB_LOC=-L/usr/src/inn-2.3.4/lib
45#DB_LIB_LOC=-L/usr/local/lib
46
47# Step 5: If you want to use embedded PERL functions as kill routines
48# define these.
49# PERL_CORE needs to point to where perl.h and libperl.a lives.
50# PERL_DEFS might need to be changed, depending on how you compiled
51# your perl.  These defaults should be good for most people.
52# If you get errors about missing libs, add em to the PERL_LIB define.
53# If your compile fails with refs to missing symbols like pow() and floor(),
54# add -lm to the PERL_LIB line.
55# The rest of these should be left alone (except to remove the #).
56# If you're using perl5.004 or older, add "-DOLD_PERL to PERL_DEFS
57PERL_LIB=@PERL_LIB@
58PERL_DEFS=@PERL_DEFS@
59PERL_INC_LOC=@PERL_INC_LOC@
60PERL_LIB_LOC=@PERL_LIB_LOC@
61#PERL_CORE=/usr/lib/perl5/5.8.0/i386-linux-thread-mult/CORE
62#PERL_LIB=-lperl -lcrypt
63PERL_DEFS=-D_REENTRANT -D_GNU_SOURCE
64#PERL_INC_LOC=-I$(PERL_CORE)
65#PERL_LIB_LOC=-L$(PERL_CORE)
66
67# Step 6: If compiling for OS/2 uncomment the following
68#OS2_LD=-Zexe
69#OS2_DEFS=-DEMX
70
71# Step 7: If compiling with SSL uncomment the following
72#SSL_LIB=@SSL_LIB@
73#SSL_DEFS=@SSL_DEFS@
74#SSL_LIB=-lssl -lcrypto
75#SSL_DEFS=-I/usr/local/ssl/include -DHAVE_LIBSSL
76#SSL_LIB_LOC=-L/usr/local/ssl/lib
77############################################################################
78# COMPILE flags for GCC
79############################################################################
80GCC_FLAGS=
81DBZ_GCC_FLAGS=
82############################################################################
83# YOU SHOULD NOT NEED TO TOUCH BELOW HERE
84############################################################################
85# my compile stuff
86############################################################################
87MY_GCC_FLAGS =  -Wall -Wpointer-arith -Wcast-align -Wcast-qual \
88  -Wshadow  -Waggregate-return -Wmissing-prototypes -Wnested-externs \
89  -Wstrict-prototypes -Wwrite-strings -Wmissing-declarations
90
91MY_DBZ_GCC_FLAGS =  -Wall -Wpointer-arith -Wcast-align -Wcast-qual \
92  -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wwrite-strings \
93  -Wmissing-declarations
94############################################################################
95#GCC_FLAGS= $(MY_GCC_FLAGS)
96#DBZ_GCC_FLAGS= $(MY_DBZ_GCC_FLAGS)
97##############################################################################
98
99# Ultrix 2.2 make doesn't expand the value of VPATH.
100VPATH = @srcdir@
101# This must repeat the value, because configure will remove `VPATH = .'.
102srcdir = @srcdir@
103
104# Suck Makefile
105PKGNAME=suck
106VERSION_MAJOR=4
107VERSION_MINOR=3
108VERSION_PATCH=4
109VERSION=$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)
110
111CC = @CC@
112@SET_MAKE@
113
114CFLAGS = @CFLAGS@
115CPPFLAGS = -I. -I$(srcdir) $(INCDIR2) @CPPFLAGS@
116LDFLAGS = @LDFLAGS@ $(DMALLOC_LD) $(OS2_LD)
117DEFS = @DEFS@ -DSUCK_VERSION=\"$(VERSION)\" $(DMALLOC_DEFS) $(OS2_DEFS) $(DMALLOC_INC)
118LIBS = @LIBS@ $(DMALLOC_LIB)
119
120prefix = @prefix@
121exec_prefix = @exec_prefix@
122bindir = @bindir@
123manext = 1
124mandir = @mandir@/man$(manext)
125srcdir = @srcdir@
126MAN = $(srcdir)/man
127SMAN= $(srcdir)/Spanish.docs
128
129INSTALL = @INSTALL@
130INSTALL_DATA = @INSTALL_DATA@
131INSTALL_PROGRAM = @INSTALL_PROGRAM@
132AUTOCONF = @AUTOCONF@
133AUTOHEADER = @AUTOHEADER@
134SPECVERSION = `sed -n 's/^%define version //p' suck.spec`
135
136#List of .o files suck needs to compile:
137suckobjs = both.o both_phrases.o suck.o suckutils.o killfile.o timer.o killprg.o \
138           dedupe.o suck_phrases.o active.o batch.o xover.o ssort.o $(CHKHISTORY) \
139	   db.o
140rpostobjs = both.o both_phrases.o rpost.o rpost_phrases.o
141testhobjs = both.o both_phrases.o testhost.o test_phrases.o
142makepobjs = makephrases.o suck_phrases.o rpost_phrases.o test_phrases.o \
143            both_phrases.o lmove_phrases.o
144lmoveobjs = both.o both_phrases.o lmove.o lmove_phrases.o
145
146all: phrases.h suck rpost testhost lmove
147	@echo make done
148
149suck: phrases.h $(suckobjs)
150	$(CC) $(LDFLAGS) $(DB_LIB_LOC) $(PERL_LIB_LOC) $(SSL_LIB_LOC) -o suck $(suckobjs) $(LIBS) $(DB_LIB) $(PERL_LIB) $(SSL_LIB)
151
152lmove: phrases.h $(lmoveobjs)
153	$(CC) $(LDFLAGS) $(SSL_LIB_LOC) -o lmove $(lmoveobjs) $(LIBS) $(SSL_LIB)
154
155lpost: lpost.o
156	$(CC) $(LDFLAGS) -o lpost lpost.o $(LIBS)
157
158readdb: phrases.h read_db.o
159	$(CC) $(LDFLAGS) -o read_db read_db.o $(LIBS)
160
161rpost: phrases.h $(rpostobjs)
162	$(CC) $(LDFLAGS) $(PERL_LIB_LOC) $(SSL_LIB_LOC) -o rpost $(rpostobjs) $(LIBS) $(PERL_LIB) $(SSL_LIB)
163
164testhost: phrases.h $(testhobjs)
165	$(CC) $(LDFLAGS) $(SSL_LIB_LOC) -o testhost $(testhobjs) $(LIBS) $(SSL_LIB)
166
167makephrases: $(makepobjs)
168	$(CC) $(LDFLAGS) -o makephrases $(makepobjs) $(LIBS)
169
170phrases: makephrases
171	./makephrases phrases.engl
172
173phrases.h: makephrases
174	./makephrases phrases.h
175
176install: install_bin install_man
177
178#install_Spanish: install_bin install_sman
179
180install_bin: suck rpost testhost lmove
181	- mkdir -p $(DESTDIR)$(bindir)
182	$(INSTALL_PROGRAM) suck $(DESTDIR)$(bindir)/suck
183	$(INSTALL_PROGRAM) rpost $(DESTDIR)$(bindir)/rpost
184	$(INSTALL_PROGRAM) testhost $(DESTDIR)$(bindir)/testhost
185	$(INSTALL_PROGRAM) lmove $(DESTDIR)$(bindir)/lmove
186
187install_man: $(MAN)/suck.1 $(MAN)/rpost.1 $(MAN)/testhost.1 $(MAN)/lmove.1
188	- mkdir -p $(DESTDIR)$(mandir)
189	- rm -f $(mandir)/lpost.$(manext)
190	$(INSTALL_DATA) $(MAN)/suck.1 $(DESTDIR)$(mandir)/suck.$(manext)
191	$(INSTALL_DATA) $(MAN)/rpost.1 $(DESTDIR)$(mandir)/rpost.$(manext)
192	$(INSTALL_DATA) $(MAN)/testhost.1 $(DESTDIR)$(mandir)/testhost.$(manext)
193	$(INSTALL_DATA) $(MAN)/lmove.1 $(DESTDIR)$(mandir)/lmove.$(manext)
194
195#install_sman: $(SMAN)/suck.1 $(SMAN)/rpost.1 $(SMAN)/testhost.1 $(SMAN)/lpost.1
196#	$(MAKE) -C $(SMAN)
197
198install_lpost: lpost $(MAN)/lpost.1
199	$(INSTALL_PROGRAM) lpost $(DESTDIR)$(bindir)/lpost
200	$(INSTALL_DATA) $(MAN)/lpost.1 $(DESTDIR)$(mandir)/lpost.$(manext)
201
202installall: install install_lpost
203
204clean:
205	rm -f `find . \( -name "*.o" -o -name "*[~%]" \) -print`
206
207chkhistory_db.o: chkhistory_db.c
208	$(CC) -c $(DB_INC_LOC) $(CFLAGS) $(DBZ_GCC_FLAGS) $(CPPFLAGS) $(DEFS) $(DB_TYPE) $<
209
210killfile.o: killfile.c
211	$(CC) -c $(CFLAGS) $(DBZ_GCC_FLAGS) $(CPPFLAGS) $(DEFS) $(PERL_DEFS) $(PERL_INC_LOC) $<
212
213killprg.o: killprg.c
214	$(CC) -c $(CFLAGS) $(DBZ_GCC_FLAGS) $(CPPFLAGS) $(DEFS) $(PERL_DEFS) $(PERL_INC_LOC) $<
215
216xover.o: xover.c
217	$(CC) -c $(CFLAGS) $(DBZ_GCC_FLAGS) $(CPPFLAGS) $(DEFS) $(PERL_DEFS) $(PERL_INC_LOC) $<
218
219rpost.o: rpost.c
220	$(CC) -c $(CFLAGS) $(SSL_DEFS) $(DBZ_GCC_FLAGS) $(CPPFLAGS) $(DEFS) $(PERL_DEFS) $(PERL_INC_LOC) $<
221
222.c.o:
223	$(CC) -c $(CFLAGS) $(SSL_DEFS) $(GCC_FLAGS) $(CPPFLAGS) $(DEFS) $<
224
225#---------------------------------------------------------------------------
226# stuff to make sure configure is up to date (I hope)
227#---------------------------------------------------------------------------
228${srcdir}/configure: configure.ac
229	cd ${srcdir} && autoconf
230
231# autoheader might not change config.h.in, so touch a stamp file
232${srcdir}/config.h.in: stamp-h.in
233${srcdir}/stamp-h.in: configure.ac
234	cd ${srcdir} && autoheader
235	echo timestamp  > ${srcdir}/stamp-h.in
236
237config.h: stamp-h
238stamp-h: config.h.in config.status
239	./config.status
240
241Makefile: Makefile.in config.status
242	./config.status
243
244config.status: configure
245	./config.status --recheck
246#---------------------------------------------------------------------------
247# stuff for me compiling/debugging this sucker
248#---------------------------------------------------------------------------
249debug: moreclean
250	make CFLAGS="-g" LDFLAGS="-g"
251	make readdb CFLAGS=-g LDFLAGS="-g"
252
253debug_both: moreclean
254	make CFLAGS="-g -DDEBUG1=1" LDFLAGS="-g"
255
256profile: moreclean
257	make CFLAGS="-pg" LDFLAGS="-pg"
258
259cleanrun:
260	rm -rf Msgs
261	rm -f suck.errlog suck.status suck.newrc suck.index suck.sorted suck.post \
262        suck.restart suck.lock suck.killlog debug.* gmon.out batch *.tmp core suck.db \
263	dmalloc_logfile
264
265moreclean: clean cleanrun
266	rm -f suck rpost testhost lpost makephrases lmove read_db
267
268distclean: clean cleanrun cleanconfig moreclean
269	rm -rf test
270	rm -f sucknewsrc sucknewsrc.old suckkillfile suckothermsgs batch \
271        phrases.h phrases.engl active active.old active-ignore suckxover suck.db.out
272
273cleanconfig:
274	rm -f Makefile Spanish.docs/Makefile config.h config.cache config.status config.log
275
276makedist: makerpm
277	echo "Done"
278
279maketar: distclean
280# make tar
281	tar -czv -f ../$(PKGNAME)-$(VERSION).tar.gz -C .. suck-$(VERSION)
282
283makerpm: maketar
284# now make RPMS
285	if [ "${SPECVERSION}" != "${VERSION}" ] ; then \
286		echo Mismatch: Makefile version ${VERSION} and .spec file version ${SPECVERSION} ; \
287		exit 1 ; \
288	fi
289	#pwd
290	rpmbuild -ta /home/bobyetman/${PKGNAME}-${VERSION}.tar.gz
291# move em to my home dir and clean up
292	mv /usr/src/redhat/RPMS/i386/*.rpm ~
293	mv /usr/src/redhat/SRPMS/*.rpm ~
294	rm -rf /usr/src/redhat/BUILD/*
295	rm -rf /tmp/suck*
296# now generate the .sig files
297	#pgps -b ~/suck*.rpm ~/suck*.tar.gz
298
299# Add missing dependency to allow parallel (-jX) builds
300active.o batch.o both.o chkhistory.o chkhistory_db.o db.o dedupe.o killfile.o killprg.o lmove.o rpost.o suck.o suckutils.o testhost.o timer.o xover.o: phrases.h
301