2 default target 'default'
4 variable package = 'build'
5 variable version = '0.1'
7 variable prefix = '/usr/local'
12 '-D_POSIX_C_SOURCE=200809L'
16 '-DLOCALEDIR="./po/locale"'
19 variable warn_flags = [
28 '-Wdisabled-optimization'
30 '-Wduplicated-branches'
36 '-Wformat-truncation=2'
38 '-Wimplicit-fallthrough=2'
42 '-Wmissing-attributes'
44 '-Wmissing-declarations'
45 '-Wmissing-format-attribute'
46 '-Wmissing-include-dirs'
48 '-Wmissing-prototypes'
51 '-Wold-style-definition'
64 '-Wsuggest-attribute=cold'
65 '-Wsuggest-attribute=const'
66 '-Wsuggest-attribute=format'
67 '-Wsuggest-attribute=malloc'
68 '-Wsuggest-attribute=noreturn'
69 '-Wsuggest-attribute=pure'
70 '-Wsuggest-final-methods'
71 '-Wsuggest-final-types'
78 '-Wunused-const-variable=2'
82 '-Wvector-operation-performance'
83 '-Wvla-larger-than=4031'
93 '-fsanitize=alignment'
97 '-fsanitize=float-cast-overflow'
98 '-fsanitize=float-divide-by-zero'
99 '-fsanitize=integer-divide-by-zero'
100 '-fsanitize=nonnull-attribute'
102 '-fsanitize=object-size'
103 '-fsanitize=pointer-overflow'
105 '-fsanitize=returns-nonnull-attribute'
107 '-fsanitize=signed-integer-overflow'
109 '-fsanitize=undefined'
110 '-fsanitize=unreachable'
111 '-fsanitize=vla-bound'
115 variable debug_cflags = [
116 '-D_FORTIFY_SOURCE=2'
128 variable release_cflags = [
134 '-fno-fat-lto-objects'
135 '-fno-stack-protector'
136 '-fomit-frame-pointer'
153 #PCC '-Wl,-znoexecstack'
157 description: 'YACC @in'
158 >bison -Wall -Wdangling-alias -Wcounterexamples @in
162 description: 'LEX @in'
167 description: 'CC @in'
168 >@cc @cppflags @cflags -c -o @out @in
176 description: 'LINK @out'
177 >@cc @ldflags @cflags -o @out @in
180 variable potfile = 'po/build.pot'
181 variable pofiles = 'po/ru.po'
182 variable mofiles = 'po/locale/ru/LC_MESSAGES/build.mo'
184 variable xgettext_options = [
185 '--flag=N_:1:pass-c-format'
186 '--flag=S_:1:pass-c-format'
187 '--flag=S_:2:pass-c-format'
188 '--flag=_:1:pass-c-format'
189 '--flag=error:1:c-format'
190 '--flag=error_at:2:c-format'
191 '--flag=fatal:1:c-format'
192 '--flag=info:1:c-format'
193 '--flag=warning:1:c-format'
194 '--flag=warning_at:2:c-format'
199 '--keyword=YY_FATAL_ERROR:1'
207 description: 'MSGMERGE @out'
208 >msgmerge -U @out @in
212 description: 'XGETTEXT @out'
213 >xgettext @xgettext_options --package-name @package --package-version @version --default-domain @package --output @out @in
217 description: 'MSGFMT @in'
218 >msgfmt --check --statistics --verbose --output-file @out @in
221 file target [ 'src/parse.c' 'src/parse.h' ] @ 'src/parse.y' {
224 file target [ 'src/scan.c' 'src/scan.h' ] @ 'src/scan.l' {
227 file target [ 'src/sh-scan.c' 'src/sh-scan.h' ] @ 'src/sh-scan.l' {
231 file target [ 'src/sh-parse.c' 'src/sh-parse.h' ] @ 'src/sh-parse.y' {
235 file target 'src/dep-scan.c' @ 'src/dep-scan.l' {
236 lex @files -> @target
240 'src/blake3/blake3.c'
241 'src/blake3/blake3_dispatch.c'
242 'src/blake3/blake3_portable.c'
249 'src/libquote/localcharset.c'
250 'src/libquote/quotearg.c'
265 # @sources.filter('%.c')
266 # map @sources ('%.c' -> compile -> '%.o')
267 map compile @sources ('%.c' -> '%.o')
268 variable objects = [ map @sources ('%.c' -> '%.o') ]
272 >./build -g | dot -Tpng -ograph.png
279 file target 'build' @ @objects {
280 link @files -> @target
283 target 'default': 'build' @mofiles
285 file target 'po/ru.po': @potfile {
286 msgmerge @dependencies -> @target
289 file target 'po/build.pot' @ @sources {
290 xgettext @files -> @target
293 file target 'po/locale/ru/LC_MESSAGES/build.mo': 'po/ru.po' {
294 msgfmt @dependencies -> @target
303 rm @objects 'src/scan.h' 'src/scan.c' 'src/parse.h' 'src/parse.c' 'src/dep-scan.c' 'src/sh-scan.c' 'src/sh-parse.c' 'src/sh-parse.h'
307 #map @sources ('%.o' @ '%.c' ~ '%.d') { compile @in -> @out }
309 file target 'blake3/blake3.o' @ 'blake3/blake3.c' { compile @files -> @target }
310 file target 'blake3/blake3_dispatch.o' @ 'blake3/blake3_dispatch.c' { compile @files -> @target }
311 file target 'blake3/blake3_portable.o' @ 'blake3/blake3_portable.c' { compile @files -> @target }
312 file target 'build.o' @ 'build.c' { compile @files -> @target }
313 file target 'dep-scan.o' @ 'dep-scan.c' { compile @files -> @target }
314 file target 'diagnostic.o' @ 'diagnostic.c' { compile @files -> @target }
315 file target 'graph.o' @ 'graph.c' { compile @files -> @target }
316 file target 'hash.o' @ 'hash.c' { compile @files -> @target }
317 file target 'job-server.o' @ 'job-server.c' { compile @files -> @target }
318 file target 'libquote/localcharset.o' @ 'libquote/localcharset.c' { compile @files -> @target }
319 file target 'libquote/quotearg.o' @ 'libquote/quotearg.c' { compile @files -> @target }
320 file target 'option.o' @ 'option.c' { compile @files -> @target }
321 file target 'parse.o' @ 'parse.c' { compile @files -> @target }
322 file target 'scan.o' @ 'scan.c' { compile @files -> @target }
323 file target 'sh-parse.o' @ 'sh-parse.c' { compile @files -> @target }
324 file target 'sh-scan.o' @ 'sh-scan.c' { compile @files -> @target }
325 file target 'sh.o' @ 'sh.c' { compile @files -> @target }
326 file target 'spawn.o' @ 'spawn.c' { compile @files -> @target }
327 file target 'thread.o' @ 'thread.c' { compile @files -> @target }
328 file target 'uniqstr.o' @ 'uniqstr.c' { compile @files -> @target }
329 file target 'utils.o' @ 'utils.c' { compile @files -> @target }
330 file target 'watchdog.o' @ 'watchdog.c' { compile @files -> @target }
331 file target 'yy.o' @ 'yy.c' { compile @files -> @target }
334 #file target 'dep-scan.l'
335 #file target 'parse.y'
336 #file target 'scan.l'
337 #file target 'sh-parse.y'
338 #file target 'sh-scan.l'