forked from katef/libfsm
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
194 lines (177 loc) · 4.11 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
.MAKEFLAGS: -r -m $(.CURDIR)/share/mk
.MAKE.JOB.PREFIX=
.MAIN: all
.SYSPATH:
.SYSPATH: $(.CURDIR)/share/mk
.if defined(unix)
BUILD_IMPOSSIBLE="attempting to use sys.mk"
.endif
.if $(.OBJDIR) != $(.CURDIR)
BUILD_IMPOSSIBLE="attempting to use .OBJDIR other than .CURDIR"
.endif
# targets
all:: mkdir .WAIT dep .WAIT lib prog
.if make(fuzz)
fuzz:: mkdir
.endif
doc:: mkdir
dep::
gen::
test:: all
theft:: all
install:: all doc
uninstall::
clean::
# things to override
CC ?= gcc
DOT ?= dot
RE ?= re
BUILD ?= build
PREFIX ?= /usr/local
# libfsm has EXPENSIVE_CHECKS which are a superset of assertions;
# this is here just so CI can only set one flag at a time.
.if defined(EXPENSIVE_CHECKS)
CFLAGS += -DEXPENSIVE_CHECKS
DEBUG ?= 1
.endif
# combined just to save time in CI
.if defined(AUSAN)
ASAN ?= 1
UBSAN ?= 1
.endif
# ${unix} is an arbitrary variable set by sys.mk
.if defined(unix)
.BEGIN::
@echo "We don't use sys.mk; run ${MAKE} with -r" >&2
@false
.endif
.if $(.OBJDIR) != $(.CURDIR)
.BEGIN::
@echo "We cannot handle .OBJDIR other than .CURDIR" >&2
.if exists(${.OBJDIR})
@echo "You may want to delete $(.OBJDIR)" >&2
.endif
@false
.endif
.if make(theft) || make(${BUILD}/theft/theft)
PKG += libtheft
.endif
# layout
.if !defined(NODOC)
SUBDIR += man/fsm.1
SUBDIR += man/re.1
SUBDIR += man/rx.1
SUBDIR += man/lx.1
SUBDIR += man/fsm_print.3
SUBDIR += man/libfsm.3
SUBDIR += man/fsm.5
SUBDIR += man/lx.5
SUBDIR += man/fsm_lang.5fsm
SUBDIR += man/glob.5re
SUBDIR += man/like.5re
SUBDIR += man/literal.5re
SUBDIR += man/native.5re
SUBDIR += man/re_dialect.5re
SUBDIR += man/sql.5re
.endif
SUBDIR += include/fsm
SUBDIR += include/re
SUBDIR += include
SUBDIR += src/adt
SUBDIR += src/print
SUBDIR += src/libfsm/cost
SUBDIR += src/libfsm/pred
SUBDIR += src/libfsm/print
SUBDIR += src/libfsm/walk
SUBDIR += src/libfsm/vm
SUBDIR += src/libfsm
SUBDIR += src/libre/class
SUBDIR += src/libre/dialect
SUBDIR += src/libre/print
SUBDIR += src/libre
SUBDIR += src/fsm
SUBDIR += src/re
SUBDIR += src/rx
SUBDIR += src/retest
SUBDIR += src/lx/print
SUBDIR += src/lx
SUBDIR += src
SUBDIR += tests/capture
SUBDIR += tests/complement
SUBDIR += tests/gen
SUBDIR += tests/idmap
SUBDIR += tests/intersect
#SUBDIR += tests/ir # XXX: fragile due to state numbering
SUBDIR += tests/eclosure
SUBDIR += tests/equals
SUBDIR += tests/subtract
SUBDIR += tests/detect_required
SUBDIR += tests/determinise
SUBDIR += tests/endids
SUBDIR += tests/epsilons
SUBDIR += tests/fsm
SUBDIR += tests/glob
SUBDIR += tests/like
SUBDIR += tests/literal
# FIXME: commenting this out for now due to Makefile error
#SUBDIR += tests/lxpos
SUBDIR += tests/minimise
SUBDIR += tests/native
SUBDIR += tests/pcre
SUBDIR += tests/pcre-classes
SUBDIR += tests/pcre-anchor
SUBDIR += tests/pcre-flags
SUBDIR += tests/pcre-repeat
SUBDIR += tests/pred
SUBDIR += tests/re_literal
SUBDIR += tests/re_strings
SUBDIR += tests/reverse
SUBDIR += tests/trim
SUBDIR += tests/union
SUBDIR += tests/set
SUBDIR += tests/stateset
SUBDIR += tests/internedstateset
SUBDIR += tests/sql
SUBDIR += tests/queue
SUBDIR += tests/aho_corasick
SUBDIR += tests/retest
SUBDIR += tests
.if make(theft) || make(${BUILD}/theft/theft)
SUBDIR += theft
.endif
.if make(fuzz) || make(${BUILD}/fuzzer/fuzzer)
SUBDIR += fuzz
.endif
SUBDIR += pc
INCDIR += include
# if the build is impossible for a bmake-specific reason,
# then these includes may cause an error before we can print a message
.if !defined(BUILD_IMPOSSIBLE)
.include <subdir.mk>
.include <pc.mk>
.include <sid.mk>
.include <pkgconf.mk>
.include <lx.mk>
.include <obj.mk>
.include <dep.mk>
.include <ar.mk>
.include <so.mk>
.include <part.mk>
.include <prog.mk>
.include <man.mk>
.include <mkdir.mk>
.endif
# these are internal tools for development; we don't install them to $PREFIX
STAGE_BUILD := ${STAGE_BUILD:Nbin/retest}
STAGE_BUILD := ${STAGE_BUILD:Nbin/reperf}
STAGE_BUILD := ${STAGE_BUILD:Nbin/cvtpcre}
# if the build is impossible for a bmake-specific reason,
# then these includes may cause an error before we can print a message
.if !defined(BUILD_IMPOSSIBLE)
.include <install.mk>
.include <clean.mk>
.endif
.if make(test)
.END::
grep FAIL ${BUILD}/tests/*/res*; [ $$? -ne 0 ]
.endif