162856Sdcs# $FreeBSD: stable/10/lib/libc/regex/grot/Makefile 313221 2017-02-04 16:36:07Z ngie $
262856Sdcs# You probably want to take -DREDEBUG out of CFLAGS, and put something like
362856Sdcs# -O in, *after* testing (-DREDEBUG strengthens testing by enabling a lot of
462856Sdcs# internal assertion checking).  Take -Dconst= out for an ANSI compiler.
562856Sdcs# Do not take -DPOSIX_MISTAKE out.  REGCFLAGS isn't important to you (it's
662856Sdcs# for my use in some special contexts).
762856Sdcs
8313221SngiePATHS= ${.CURDIR:H} ${.CURDIR:H:H}/locale ${SRCTOP}/include
962872Sgreen.PATH: ${PATHS}
1062872Sgreen
11292481SngieCFLAGS+= -static -DPOSIX_MISTAKE -DREDEBUG $(REGCFLAGS)
1262872Sgreen.for incpath in ${PATHS}
1362872SgreenCFLAGS+= -I${incpath}
1462872Sgreen.endfor
1562872Sgreen
1662856Sdcs# If you have an ANSI compiler, take -o out of MKHFLAGS.  If you want
1762856Sdcs# the Berkeley __P macro, put -b in.
1862856SdcsMKHFLAGS =
1962856Sdcs
2062856SdcsLDFLAGS =
2162856Sdcs
2262856Sdcs# If you have an ANSI environment, take limits.h and stdlib.h out of
2362856Sdcs# HMISSING and take memmove out of SRCMISSING and OBJMISSING.
2462856SdcsHMISSING =
2562856SdcsSRCMISSING = split.c
2662856SdcsOBJMISSING = split.o
27132389StjrH = cname.h regex2.h utils.h $(HMISSING)
2862856SdcsREGSRC = regcomp.c regerror.c regexec.c regfree.c engine.c
2962856SdcsSRC = $(REGSRC) debug.c main.c $(SRCMISSING)
3062856Sdcs
3162856Sdcs# Internal stuff, should not need changing.
3262856SdcsOBJPRODN = regcomp.o regexec.o regerror.o regfree.o
3362856SdcsOBJS = $(OBJPRODN) debug.o main.o $(OBJMISSING)
3462856Sdcs
3562856Sdcs# Stuff that matters only if you're trying to lint the package.
3662856SdcsLINTFLAGS = -I. -Dstatic= -Dconst= -DREDEBUG
3762856SdcsLINTC = regcomp.c regexec.c regerror.c regfree.c debug.c main.c $(SRCMISSING)
3862856SdcsJUNKLINT =possible pointer alignment|null effect
3962856Sdcs
4062856Sdcs.SUFFIXES:	.ih .h
4162856Sdcs.c.ih:
42132389Stjr	sh mkh $(MKHFLAGS) -p $< >$@
4362856Sdcs
4462856Sdcsdefault:	r
4562856Sdcs
4662856Sdcsre:	$(OBJS)
4762856Sdcs	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@
4862856Sdcs
4962856Sdcso:	$(OBJPRODN)
5062856Sdcs
51132390StjrREGEXHSRC = ../regex2.h ../reg*.c
5262856Sdcsh:	$(REGEXHSRC)
53132389Stjr	sh mkh $(MKHFLAGS) -i _REGEX_H_ $(REGEXHSRC) >regex.tmp
5462856Sdcs	cmp -s regex.tmp regex.h 2>/dev/null || cp regex.tmp regex.h
5562856Sdcs	rm -f regex.tmp
5662856Sdcs
57132390Stjrregex.h: h
58132390Stjr
5962856Sdcsregcomp.o regexec.o regfree.o debug.o:	utils.h regex.h regex2.h
60132389Stjrregcomp.o:	cname.h regcomp.ih
6162856Sdcsregexec.o:	engine.c engine.ih
6262856Sdcsregerror.o:	regerror.ih
6362856Sdcsregerror.o:	utils.h
6462856Sdcsdebug.o:	debug.ih
65292170Sngiemain.o:	debug.ih main.ih split.ih
66292170Sngiesplit.o:	split.ih
6762856Sdcs
6862856Sdcsr:	re tests
6962856Sdcs	./re <tests
7062856Sdcs	./re -el <tests
7162856Sdcs	./re -er <tests
7262856Sdcs
7362856Sdcsra:	./re tests
7462856Sdcs	-./re <tests
7562856Sdcs	-./re -el <tests
7662856Sdcs	-./re -er <tests
7762856Sdcs
7862856Sdcsrx:	./re tests
7962856Sdcs	./re -x <tests
8062856Sdcs	./re -x -el <tests
8162856Sdcs	./re -x -er <tests
8262856Sdcs
8362856Sdcst:	./re tests
8462856Sdcs	-time ./re <tests
8562856Sdcs	-time ./re -cs <tests
8662856Sdcs	-time ./re -el <tests
8762856Sdcs	-time ./re -cs -el <tests
8862856Sdcs
8962856Sdcsl:	$(LINTC)
9062856Sdcs	lint $(LINTFLAGS) -h $(LINTC) 2>&1 | egrep -v '$(JUNKLINT)' | tee lint
9162856Sdcs
9262856Sdcsclean:	tidy
9362856Sdcs	rm -f *.o *.s *.ih re
9462856Sdcs
9562856Sdcstidy:
96132389Stjr	rm -f junk* core regex.tmp lint
9762856Sdcs
9862856Sdcsspotless:	clean
99132389Stjr	rm -f regex.h
100