xref: /csrg-svn/lib/libcompat/regexp/Makefile (revision 41342)
1*41342Sbostic# Things you might want to put in ENV and LENV:
2*41342Sbostic# -Dvoid=int		compilers that don't do void
3*41342Sbostic# -DCHARBITS=0377	compilers that don't do unsigned char
4*41342Sbostic# -DSTATIC=extern	compilers that don't like "static foo();" as forward decl
5*41342Sbostic# -DSTRCSPN		library does not have strcspn()
6*41342Sbostic# -Dstrchr=index	library does not have strchr()
7*41342Sbostic# -DERRAVAIL		have utzoo-compatible error() function and friends
8*41342SbosticENV=
9*41342SbosticLENV=
10*41342Sbostic
11*41342Sbostic# Things you might want to put in TEST:
12*41342Sbostic# -DDEBUG		debugging hooks
13*41342Sbostic# -I.			regexp.h from current directory, not /usr/include
14*41342SbosticTEST= -I.
15*41342Sbostic
16*41342Sbostic# Things you might want to put in PROF:
17*41342Sbostic# -Dstatic='/* */'	make everything global so profiler can see it.
18*41342Sbostic# -p			profiler
19*41342SbosticPROF=
20*41342Sbostic
21*41342SbosticCFLAGS=-O $(ENV) $(TEST) $(PROF)
22*41342SbosticLINTFLAGS=$(LENV) $(TEST) -ha
23*41342Sbostic#LDFLAGS=-i		uncomment for pdp 11
24*41342Sbostic
25*41342SbosticOBJ=regexp.o regsub.o
26*41342SbosticLSRC=regexp.c regsub.c regerror.c
27*41342SbosticDTR=README.regexp dMakefile regexp.3 regexp.h regexp.c regsub.c regerror.c \
28*41342Sbostic	regmagic.h try.c timer.c tests
29*41342Sbostic
30*41342Sbostictry:	try.o $(OBJ)
31*41342Sbostic	cc $(LDFLAGS) try.o $(OBJ) -o try
32*41342Sbostic
33*41342Sbostic# Making timer will probably require putting stuff in $(PROF) and then
34*41342Sbostic# recompiling everything; the following is just the final stage.
35*41342Sbostictimer:	timer.o $(OBJ)
36*41342Sbostic	cc $(LDFLAGS) $(PROF) timer.o $(OBJ) -o timer
37*41342Sbostic
38*41342Sbostictimer.o:	timer.c timer.t.h
39*41342Sbostic
40*41342Sbostictimer.t.h:	tests
41*41342Sbostic	sed 's/	/","/g;s/\\/&&/g;s/.*/{"&"},/' tests >timer.t.h
42*41342Sbostic
43*41342Sbostic# Regression test.
44*41342Sbosticr:	try tests
45*41342Sbostic	@echo 'No news is good news...'
46*41342Sbostic	try <tests
47*41342Sbostic
48*41342Sbosticlint:	timer.t.h
49*41342Sbostic	@echo 'Complaints about multiply-declared regerror() are legit.'
50*41342Sbostic	lint $(LINTFLAGS) $(LSRC) try.c
51*41342Sbostic	lint $(LINTFLAGS) $(LSRC) timer.c
52*41342Sbostic
53*41342Sbosticregexp.o:	regexp.c regexp.h regmagic.h
54*41342Sbosticregsub.o:	regsub.c regexp.h regmagic.h
55*41342Sbostic
56*41342Sbosticclean:
57*41342Sbostic	rm -f *.o core mon.out timer.t.h dMakefile dtr try timer
58*41342Sbostic
59*41342Sbosticdtr:	r makedtr $(DTR)
60*41342Sbostic	makedtr $(DTR) >dtr
61*41342Sbostic
62*41342SbosticdMakefile:	Makefile
63*41342Sbostic	sed '/^L*ENV=/s/ *-DERRAVAIL//' Makefile >dMakefile
64