• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# You probably want to take -DREDEBUG out of CFLAGS, and put something like
2# -O in, *after* testing (-DREDEBUG strengthens testing by enabling a lot of
3# internal assertion checking and some debugging facilities).
4# Put -Dconst= in for a pre-ANSI compiler.
5# Do not take -DPOSIX_MISTAKE out.
6# REGCFLAGS isn't important to you (it's for my use in some special contexts).
7CFLAGS=-I. -DPOSIX_MISTAKE -DREDEBUG $(REGCFLAGS)
8
9# If you have a pre-ANSI compiler, put -o into MKHFLAGS.  If you want
10# the Berkeley __P macro, put -b in.
11MKHFLAGS=
12
13# Flags for linking but not compiling, if any.
14LDFLAGS=
15
16# Extra libraries for linking, if any.
17LIBS=
18
19# Internal stuff, should not need changing.
20OBJPRODN=regcomp.o regexec.o regerror.o regfree.o
21OBJS=$(OBJPRODN) split.o debug.o main.o
22H=regex2.h utils.h
23REGSRC=regcomp.c regerror.c regexec.c regfree.c
24ALLSRC=$(REGSRC) engine.c debug.c main.c split.c
25
26# Stuff that matters only if you're trying to lint the package.
27LINTFLAGS=-I. -Dstatic= -Dconst= -DREDEBUG
28LINTC=regcomp.c regexec.c regerror.c regfree.c debug.c main.c
29JUNKLINT=possible pointer alignment|null effect
30
31default:	r
32
33lib:	purge $(OBJPRODN)
34	rm -f libregex.a
35	ar crv libregex.a $(OBJPRODN)
36
37purge:
38	rm -f *.o
39
40# stuff to build regex.h
41REGEXH=regex.h
42REGEXHSRC=regex2.h $(REGSRC)
43$(REGEXH):	$(REGEXHSRC) mkh
44	sh ./mkh $(MKHFLAGS) -i _REGEX_H_ $(REGEXHSRC) >regex.tmp
45	cmp -s regex.tmp regex.h 2>/dev/null || cp regex.tmp regex.h
46	rm -f regex.tmp
47
48# dependencies
49$(OBJPRODN) debug.o:	utils.h regex.h regex2.h
50regcomp.o:	regcomp.h
51regexec.o:	engine.c engine.h
52regerror.o:	regerror.h
53debug.o:	debug.h
54main.o:	main.h
55
56# tester
57re:	$(OBJS)
58	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
59
60# regression test
61r:	re tests
62	./re <tests
63	./re -el <tests
64	./re -er <tests
65
66# 57 variants, and other stuff, for development use -- not useful to you
67ra:	./re tests
68	-./re <tests
69	-./re -el <tests
70	-./re -er <tests
71
72rx:	./re tests
73	./re -x <tests
74	./re -x -el <tests
75	./re -x -er <tests
76
77t:	./re tests
78	-time ./re <tests
79	-time ./re -cs <tests
80	-time ./re -el <tests
81	-time ./re -cs -el <tests
82
83l:	$(LINTC)
84	lint $(LINTFLAGS) -h $(LINTC) 2>&1 | egrep -v '$(JUNKLINT)' | tee lint
85
86fullprint:
87	ti README WHATSNEW notes todo | list
88	ti *.h | list
89	list *.c
90	list rxspenser.3 rxspenser.7
91
92print:
93	ti README WHATSNEW notes todo | list
94	ti *.h | list
95	list reg*.c engine.c
96
97
98mf.tmp:	Makefile
99	sed '/^REGEXH=/s/=.*/=regex.h/' Makefile | sed '/#DEL$$/d' >$@
100
101DTRH=regex2.h utils.h
102PRE=COPYRIGHT README WHATSNEW
103POST=mkh rxspenser.3 rxspenser.7 tests $(DTRH) $(ALLSRC) fake/*.[ch]
104FILES=$(PRE) Makefile $(POST)
105DTR=$(PRE) Makefile=mf.tmp $(POST)
106dtr:	$(FILES) mf.tmp
107	makedtr $(DTR) >$@
108	rm mf.tmp
109
110cio:	$(FILES)
111	cio $(FILES)
112
113rdf:	$(FILES)
114	rcsdiff -c $(FILES) 2>&1 | p
115
116# various forms of cleanup
117tidy:
118	rm -f junk* core core.* *.core dtr *.tmp lint
119
120clean:	tidy
121	rm -f *.o *.s re libregex.a
122
123# don't do this one unless you know what you're doing
124spotless:	clean
125	rm -f mkh regex.h
126