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). Take -Dconst= out for an ANSI compiler. 4# Do not take -DPOSIX_MISTAKE out. REGCFLAGS isn't important to you (it's 5# for my use in some special contexts). 6 7PATHS= ${LIBC_SRCTOP}/regex ${LIBC_SRCTOP}/locale ${SRCTOP}/include 8.PATH: ${PATHS} 9 10CFLAGS+= -static -DPOSIX_MISTAKE -DREDEBUG $(REGCFLAGS) 11.for incpath in ${PATHS} 12CFLAGS+= -I${incpath} 13.endfor 14 15# If you have an ANSI compiler, take -o out of MKHFLAGS. If you want 16# the Berkeley __P macro, put -b in. 17MKHFLAGS = 18 19LDFLAGS = 20 21# If you have an ANSI environment, take limits.h and stdlib.h out of 22# HMISSING and take memmove out of SRCMISSING and OBJMISSING. 23HMISSING = 24SRCMISSING = split.c 25OBJMISSING = split.o 26H = cname.h regex2.h utils.h $(HMISSING) 27REGSRC = regcomp.c regerror.c regexec.c regfree.c engine.c 28SRC = $(REGSRC) debug.c main.c $(SRCMISSING) 29 30# Internal stuff, should not need changing. 31OBJPRODN = regcomp.o regexec.o regerror.o regfree.o 32OBJS = $(OBJPRODN) debug.o main.o $(OBJMISSING) 33 34# Stuff that matters only if you're trying to lint the package. 35LINTFLAGS = -I. -Dstatic= -Dconst= -DREDEBUG 36LINTC = regcomp.c regexec.c regerror.c regfree.c debug.c main.c $(SRCMISSING) 37JUNKLINT =possible pointer alignment|null effect 38 39.SUFFIXES: .ih .h 40.c.ih: 41 sh mkh $(MKHFLAGS) -p $< >$@ 42 43default: r 44 45re: $(OBJS) 46 $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ 47 48o: $(OBJPRODN) 49 50REGEXHSRC = ../regex2.h ../reg*.c 51h: $(REGEXHSRC) 52 sh mkh $(MKHFLAGS) -i _REGEX_H_ $(REGEXHSRC) >regex.tmp 53 cmp -s regex.tmp regex.h 2>/dev/null || cp regex.tmp regex.h 54 rm -f regex.tmp 55 56regex.h: h 57 58regcomp.o regexec.o regfree.o debug.o: utils.h regex.h regex2.h 59regcomp.o: cname.h regcomp.ih 60regexec.o: engine.c engine.ih 61regerror.o: regerror.ih 62regerror.o: utils.h 63debug.o: debug.ih 64main.o: debug.ih main.ih split.ih 65split.o: split.ih 66 67r: re tests 68 ./re <tests 69 ./re -el <tests 70 ./re -er <tests 71 72ra: ./re tests 73 -./re <tests 74 -./re -el <tests 75 -./re -er <tests 76 77rx: ./re tests 78 ./re -x <tests 79 ./re -x -el <tests 80 ./re -x -er <tests 81 82t: ./re tests 83 -time ./re <tests 84 -time ./re -cs <tests 85 -time ./re -el <tests 86 -time ./re -cs -el <tests 87 88l: $(LINTC) 89 lint $(LINTFLAGS) -h $(LINTC) 2>&1 | egrep -v '$(JUNKLINT)' | tee lint 90 91clean: tidy 92 rm -f *.o *.s *.ih re 93 94tidy: 95 rm -f junk* core regex.tmp lint 96 97spotless: clean 98 rm -f regex.h 99