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