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).
7 CFLAGS=-I. -DPOSIX_MISTAKE -DREDEBUG $(REGCFLAGS)
9 # If you have a pre-ANSI compiler, put -o into MKHFLAGS. If you want
10 # the Berkeley __P macro, put -b in.
13 # Flags for linking but not compiling, if any.
16 # Extra libraries for linking, if any.
19 # Internal stuff, should not need changing.
20 OBJPRODN=regcomp.o regexec.o regerror.o regfree.o
21 OBJS=$(OBJPRODN) split.o debug.o re_main.o
22 H=cclass.h cname.h regex2.h utils.h
23 REGSRC=regcomp.c regerror.c regexec.c regfree.c
24 ALLSRC=$(REGSRC) engine.c debug.c re_main.c split.c
26 # Stuff that matters only if you're trying to lint the package.
27 LINTFLAGS=-I. -Dstatic= -Dconst= -DREDEBUG
28 LINTC=regcomp.c regexec.c regerror.c regfree.c debug.c re_main.c
29 JUNKLINT=possible pointer alignment|null effect
31 # arrangements to build forward-reference header files
34 sh ./mkh $(MKHFLAGS) -p $< >$@
38 lib: purge $(OBJPRODN)
40 ar crv libregex.a $(OBJPRODN)
45 # stuff to build regex.h
47 REGEXHSRC=regex2.h $(REGSRC)
48 $(REGEXH): $(REGEXHSRC) mkh
49 sh ./mkh $(MKHFLAGS) -i _REGEX_H_ $(REGEXHSRC) >regex.tmp
50 cmp -s regex.tmp regex.h 2>/dev/null || cp regex.tmp regex.h
54 $(OBJPRODN) debug.o: utils.h regex.h regex2.h
55 regcomp.o: cclass.h cname.h regcomp.ih
56 regexec.o: engine.c engine.ih
57 regerror.o: regerror.ih
63 $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
71 # 57 variants, and other stuff, for development use -- not useful to you
86 -time ./re -cs -el <tests
89 lint $(LINTFLAGS) -h $(LINTC) 2>&1 | egrep -v '$(JUNKLINT)' | tee lint
92 ti README WHATSNEW notes todo | list
98 ti README WHATSNEW notes todo | list
104 sed '/^REGEXH=/s/=.*/=regex.h/' Makefile | sed '/#DEL$$/d' >$@
106 DTRH=cclass.h cname.h regex2.h utils.h
107 PRE=COPYRIGHT README WHATSNEW
108 POST=mkh regex.3 regex.7 tests $(DTRH) $(ALLSRC) fake/*.[ch]
109 FILES=$(PRE) Makefile $(POST)
110 DTR=$(PRE) Makefile=mf.tmp $(POST)
119 rcsdiff -c $(FILES) 2>&1 | p
121 # various forms of cleanup
123 rm -f junk* core core.* *.core dtr *.tmp lint
126 rm -f *.o *.s *.ih re libregex.a
128 # don't do this one unless you know what you're doing