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