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