df00bf190a7577b3bb3dcc3d583eff9a1f98ffe0
[mes.git] / make.scm
1 #! /bin/sh
2 # -*- scheme -*-
3 exec ${GUILE-guile} --no-auto-compile -L . -L guile -C . -C guile -s "$0" ${1+"$@"}
4 !#
5
6 (use-modules (srfi srfi-26)
7              (guix shell-utils))
8
9 ;; FIXME: .go dependencies
10 ;; workaround: always update .go before calculating hashes
11 ;;(use-modules ((mes make) #:select (sytem**)))
12 (define %scm-files
13   '("guix/make.scm"
14     "guix/records.scm"
15     "guix/shell-utils.scm"
16     "language/c99/compiler.scm"
17     "mes/as-i386.scm"
18     "mes/as.scm"
19     "mes/bytevectors.scm"
20     "mes/elf.scm"
21     "mes/M1.scm"))
22 (define %go-files (map (compose (cut string-append <> ".go") (cut string-drop-right <> 4)) %scm-files))
23 (setenv "srcdir" ".")
24 (setenv "host" %host-type)
25 (with-directory-excursion "guile"
26   (apply system* `("guile"
27                    "--no-auto-compile"
28                    "-L" "."
29                    "-C" "."
30                    "-s"
31                    "../build-aux/compile-all.scm"
32                    ,@%scm-files)))
33
34 (use-modules (srfi srfi-1)
35              (ice-9 curried-definitions)
36              (ice-9 match)
37              (guix make))
38
39 (add-target (bin.mescc "stage0/exit-42.c" #:libc #f))
40 (add-target (check "stage0/exit-42.0-guile" #:signal 11))  ; FIXME: segfault
41
42 (add-target (cpp.mescc "mlibc/mini-libc-mes.c"))
43 (add-target (compile.mescc "mlibc/mini-libc-mes.c"))
44
45 (add-target (bin.mescc "stage0/exit-42.c" #:libc mini-libc-mes.E))
46 (add-target (check "stage0/exit-42.mini-guile" #:exit 42))
47
48 (add-target (cpp.mescc "mlibc/libc-mes.c"))
49 (add-target (compile.mescc "mlibc/libc-mes.c"))
50
51 (add-target (bin.mescc "stage0/exit-42.c"))
52 (add-target (check "stage0/exit-42.guile" #:exit 42))
53
54 (define* (add-scaffold-test name #:key (exit 0) (libc libc-mes.E))
55   (add-target (bin.gcc (string-append "scaffold/tests/" name ".c") #:libc #f))
56   (add-target (check (string-append "scaffold/tests/" name ".mlibc-gcc") #:exit exit))
57
58   (add-target (bin.mescc (string-append "scaffold/tests/" name ".c") #:libc libc))
59   (add-target (check (string-append "scaffold/tests/" name "." (cond ((not libc) "0-")
60                                                                      ((eq? libc mini-libc-mes.E) "mini-")
61                                                                      (else "")) "guile") #:exit exit)))
62
63 ;; tests/00: exit, functions without libc
64 (add-scaffold-test "00-exit-0" #:libc #f)
65 (add-scaffold-test "01-return-0" #:libc #f)
66 (add-scaffold-test "02-return-1" #:libc #f #:exit 1)
67 (add-scaffold-test "03-call" #:libc #f)
68 (add-scaffold-test "04-call-0" #:libc #f)
69 (add-scaffold-test "05-call-1" #:libc #f #:exit 1)
70 (add-scaffold-test "06-call-!1" #:libc #f)
71
72 (add-target (group "check-scaffold-tests/0" #:dependencies (filter (target-prefix? "check-scaffold/tests/0") %targets)))
73
74 ;; tests/10: control without libc
75 (for-each
76  (cut add-scaffold-test <> #:libc #f)
77  '("10-if-0"
78    "11-if-1"
79    "12-if-=="
80    "13-if-!="
81    "14-if-goto"
82    "15-if-!f"
83    "16-if-t"))
84
85 (add-target (group "check-scaffold-tests/1" #:dependencies (filter (target-prefix? "check-scaffold/tests/1") %targets)))
86
87 ;; tests/20: loop without libc
88 (for-each
89  (cut add-scaffold-test <> #:libc #f)
90  '("20-while"
91    "21-char[]"
92    "22-while-char[]"))
93
94 (add-target (group "check-scaffold-tests/2" #:dependencies (filter (target-prefix? "check-scaffold/tests/2") %targets)))
95
96 ;; tests/30: call, compare: mini-libc-mes.c
97 (for-each
98  (cut add-scaffold-test <> #:libc mini-libc-mes.E)
99  '("30-strlen"
100    "31-eputs"
101    "32-compare"
102    "33-and-or"
103    "34-pre-post"
104    "35-compare-char"
105    "36-compare-arithmetic"
106    "37-compare-assign"
107    "38-compare-call"))
108
109 (add-target (group "check-scaffold-tests/3" #:dependencies (filter (target-prefix? "check-scaffold/tests/3") %targets)))
110
111 ;; tests/40: control: mini-libc-mes.c
112 (for-each
113  (cut add-scaffold-test <> #:libc mini-libc-mes.E)
114  '("40-if-else"
115    "41-?"
116    "42-goto-label"
117    "43-for-do-while"
118    "44-switch"
119    "45-void-call"))
120
121 (add-target (group "check-scaffold-tests/4" #:dependencies (filter (target-prefix? "check-scaffold/tests/4") %targets)))
122
123 ;; tests/50: libc-mes.c
124 (for-each
125  add-scaffold-test
126  '("50-assert"
127    "51-strcmp"
128    "52-itoa"
129    "54-argv"))
130
131 (add-target (group "check-scaffold-tests/5" #:dependencies (filter (target-prefix? "check-scaffold/tests/5") %targets)))
132
133 ;; tests/60: building up to scaffold/m.c, scaffold/micro-mes.c
134 (for-each
135  add-scaffold-test
136  '("60-math"
137    "61-array"
138    "63-struct-cell"
139    "64-make-cell"
140    "65-read"))
141
142 (add-target (group "check-scaffold-tests/6" #:dependencies (filter (target-prefix? "check-scaffold/tests/6") %targets)))
143
144 ;; tests/70: and beyond src/mes.c -- building up to 8cc.c, pcc.c, tcc.c, libguile/eval.c
145 (for-each
146  add-scaffold-test
147  '("70-printf"
148    "71-struct-array"))
149
150 (add-target (group "check-scaffold-tests/7" #:dependencies (filter (target-prefix? "check-scaffold/tests/7") %targets)))
151
152 (add-target (group "check-scaffold-tests" #:dependencies (filter (target-prefix? "check-scaffold/tests") %targets)))
153
154
155 (define* (add-tcc-test name)
156   (add-target (bin.gcc (string-append "scaffold/tinycc/" name ".c") #:libc #f #:includes '("scaffold/tinycc")))
157   (add-target (check (string-append "scaffold/tinycc/" name ".mlibc-gcc") #:baseline (string-append "scaffold/tinycc/" name ".expect")))
158
159   (add-target (bin.mescc (string-append "scaffold/tinycc/" name ".c") #:includes '("scaffold/tinycc")))
160   (add-target (check (string-append "scaffold/tinycc/" name ".guile") #:baseline (string-append "scaffold/tinycc/" name ".expect"))))
161 (map
162  add-tcc-test
163  '("00_assignment"
164    "01_comment"
165    "02_printf"
166    "03_struct"
167    "04_for"
168    "05_array"
169    "06_case"
170    "07_function"
171    "08_while"
172    "09_do_while"
173
174    "10_pointer"
175    "11_precedence"
176    "12_hashdefine"
177    "13_integer_literals"
178    "14_if"
179    "15_recursion"
180    "16_nesting"
181    "17_enum"
182    "18_include"
183    "19_pointer_arithmetic"
184
185    "20_pointer_comparison"
186    "21_char_array"
187    ;;"22_floating_point"       ; float
188    ;;"23_type_coercion"        ; float
189    ;;"24_math_library"         ; float
190    "25_quicksort"
191    ;;"27_sizeof"               ; float
192    ;;"28_strings"              ; TODO: strncpy strchr strrchr memset memcpy memcmp
193    "29_array_address"
194
195    ;;"30_hanoi"                ; fails with GCC
196    "31_args"
197    ;;"32_led"                  ; unsupported: (decl (decl-spec-list (stor-spec (static)) (type-spec (fixed-type "int"))) (init-declr-list (init-declr (array-of (ident "d") (p-expr (fixed "32"))))))
198    ;;"34_array_assignment"     ; fails with GCC
199    "33_ternary_op"
200    "35_sizeof"
201    ;;"36_array_initialisers"   ; unspported: (decl (decl-spec-list (type-spec (fixed-type "int"))) (init-declr-list (init-declr (array-of (ident "Array") (p-expr (fixed "10"))) (initzer (initzer-list (initzer (p-expr (fixed "12"))) (initzer (p-expr (fixed "34"))) (initzer (p-expr (fixed "56"))) (initzer (p-expr (fixed "78"))) (initzer (p-expr (fixed "90"))) (initzer (p-expr (fixed "123"))) (initzer (p-expr (fixed "456"))) (initzer (p-expr (fixed "789"))) (initzer (p-expr (fixed "8642"))) (initzer (p-expr (fixed "9753"))))))))
202    ;; "37_sprintf"             ; integer formatting unsupported
203    ;;"38_multiple_array_index" ; unspported: (decl (decl-spec-list (type-spec (fixed-type "int"))) (init-declr-list (init-declr (array-of (array-of (ident "a") (p-expr (fixed "4"))) (p-expr (fixed "4"))))))
204    ;;"39_typedef"              ; unsupported: (decl (decl-spec-list (stor-spec (typedef)) (type-spec (typename "MyFunStruct"))) (init-declr-list (init-declr (ptr-declr (pointer) (ident "MoreFunThanEver")))))
205
206    ;;"40_stdio"                ; f* functions
207    "41_hashif"
208    ;;"42_function_pointer"     ; f* functions
209    "43_void_param"
210    "44_scoped_declarations"
211    ;; "45_empty_for"           ; unsupported
212    ;;"46_grep"                 ; f* functions
213    "47_switch_return"
214    "48_nested_break"
215    ;;"49_bracket_evaluation"   ; float
216
217    "50_logical_second_arg"
218    ;;"51_static"               ; unsupported: (decl (decl-spec-list (stor-spec (static)) (type-spec (fixed-type "int"))) (init-declr-list (init-declr (ident "fred") (initzer (p-expr (fixed "1234"))))))
219    ;;"52_unnamed_enum"         ; unsupported: (decl (decl-spec-list (stor-spec (typedef)) (type-spec (enum-def (enum-def-list (enum-defn (ident "e")) (enum-defn (ident "f")) (enum-defn (ident "g")))))) (init-declr-list (init-declr (ident "h"))))
220    "54_goto"
221    ;;"55_lshift_type"          ; unsigned
222    ))
223
224 (add-target (group "check-scaffold-tinycc" #:dependencies (filter (target-prefix? "check-scaffold/tinycc") %targets)))
225
226 ;;(add-target (group "check-scaffold" #:dependencies (filter (target-prefix? "check-scaffold") %targets)))
227
228 (add-target (bin.gcc "scaffold/hello.c"))
229 (add-target (check "scaffold/hello.gcc" #:exit 42))
230
231 (add-target (bin.gcc "scaffold/hello.c" #:libc #f))
232 (add-target (check "scaffold/hello.mlibc-gcc" #:exit 42))
233
234 (add-target (bin.mescc "scaffold/hello.c" #:libc mini-libc-mes.E))
235 (add-target (check "scaffold/hello.mini-guile" #:exit 42))
236
237 (add-target (bin.mescc "scaffold/hello.c"))
238 (add-target (check "scaffold/hello.guile" #:exit 42))
239
240
241 (add-target (bin.gcc "scaffold/m.c"))
242 (add-target (check "scaffold/m.gcc" #:exit 255))
243
244 (add-target (bin.gcc "scaffold/m.c" #:libc #f))
245 (add-target (check "scaffold/m.mlibc-gcc" #:exit 255))
246
247 (add-target (bin.mescc "scaffold/m.c"))
248 (add-target (check "scaffold/m.guile" #:exit 255))
249
250 (add-target (bin.gcc "scaffold/micro-mes.c" #:libc #f))
251 (add-target (check "scaffold/micro-mes.mlibc-gcc" #:exit 6)) ; arg1 arg2 arg3 arg4 arg5
252
253 (add-target (bin.mescc "scaffold/micro-mes.c"))
254 (add-target (check "scaffold/micro-mes.guile" #:exit 6)) ; arg1 arg2 arg3 arg4 arg5
255
256 (add-target (group "check-scaffold" #:dependencies (filter (target-prefix? "check-scaffold") %targets)))
257
258 (define snarf-bases
259   '("gc" "lib" "math" "mes" "posix" "reader" "vector"))
260
261 (define bla
262   `(,@(map (cut string-append "src/" <> ".c") snarf-bases)
263     ,@(map (cut string-append "src/" <> ".mes.h") snarf-bases)
264     ,@(map (cut string-append "src/" <> ".mes.i") snarf-bases)
265     ,@(map (cut string-append "src/" <> ".mes.environment.i") snarf-bases)))
266
267 (define gcc-snarf-targets
268   (list
269    (add-target (snarf "src/gc.c" #:mes? #f))
270    (add-target (snarf "src/lib.c" #:mes? #f))
271    (add-target (snarf "src/math.c" #:mes? #f))
272    (add-target (snarf "src/mes.c" #:mes? #f))
273    (add-target (snarf "src/posix.c" #:mes? #f))
274    (add-target (snarf "src/reader.c" #:mes? #f))
275    (add-target (snarf "src/vector.c" #:mes? #f))))
276
277 (define mes-snarf-targets
278   (list
279    (add-target (snarf "src/gc.c"))
280    (add-target (snarf "src/lib.c" #:mes? #t))
281    (add-target (snarf "src/math.c" #:mes? #t))
282    (add-target (snarf "src/mes.c" #:mes? #t))
283    (add-target (snarf "src/posix.c" #:mes? #t))
284    (add-target (snarf "src/reader.c" #:mes? #t))
285    (add-target (snarf "src/vector.c" #:mes? #t))))
286
287 (add-target (bin.gcc "src/mes.c" #:dependencies gcc-snarf-targets
288                      #:defines `("FIXED_PRIMITIVES=1"
289                                  "MES_FULL=1"
290                                  "POSIX=1"
291                                  ,(string-append "VERSION=\"" %version "\"")
292                                  ,(string-append "MODULEDIR=\"" (string-append %moduledir "/") "\"")
293                                  ,(string-append "PREFIX=\"" %prefix "\""))))
294
295 (add-target (bin.gcc "src/mes.c" #:libc #f
296                      #:dependencies mes-snarf-targets
297                      #:defines `("FIXED_PRIMITIVES=1"
298                                  "MES_FULL=1"
299                                  ,(string-append "VERSION=\"" %version "\"")
300                                  ,(string-append "MODULEDIR=\"" (string-append %moduledir "/") "\"")
301                                  ,(string-append "PREFIX=\"" %prefix "\""))))
302
303 (add-target (bin.mescc "src/mes.c" #:dependencies mes-snarf-targets
304                        #:defines `("FIXED_PRIMITIVES=1"
305                                    "MES_FULL=1"
306                                  ,(string-append "VERSION=\"" %version "\"")
307                                  ,(string-append "MODULEDIR=\"" (string-append %moduledir "/") "\"")
308                                  ,(string-append "PREFIX=\"" %prefix "\""))))
309
310 (define mes-tests
311   '("tests/read.test"
312     "tests/base.test"
313     "tests/closure.test"
314     "tests/quasiquote.test"
315     "tests/let.test"
316     "tests/scm.test"
317     "tests/display.test"
318     "tests/cwv.test"
319     "tests/math.test"
320     "tests/vector.test"
321     "tests/srfi-1.test"
322     "tests/srfi-13.test"
323     "tests/srfi-14.test"
324     "tests/optargs.test"
325     "tests/fluids.test"
326     "tests/catch.test"
327     "tests/psyntax.test"
328     "tests/pmatch.test"
329     "tests/let-syntax.test"
330     "tests/guile.test"
331     "tests/record.test"
332     ;;sloooowwww
333     ;;"tests/match.test"
334     ;;"tests/peg.test"
335     ))
336
337 (define (add-mes.gcc-test o)
338   (add-target (target (file-name o)))
339   (add-target (check o #:dependencies (list (get-target "src/mes.mlibc-gcc")))))
340
341 (define (add-mes.guile-test o)
342   (add-target (target (file-name o)))
343   (add-target (check o #:dependencies (list (get-target "src/mes.guile")))))
344
345 ;; takes long, and should always pass if...
346 ;;(for-each add-mes.gcc-test mes-tests)
347
348 ;; ...mes.guile passes :-)
349 (for-each add-mes.guile-test mes-tests)
350
351 ;; FIXME: run tests/base.test
352 (setenv "MES" "src/mes.guile")
353
354 (add-target (install "guile/mescc.scm" #:dir "bin" #:substitutes #t))
355 (add-target (install "scripts/mescc.mes" #:dir "bin" #:substitutes #t))
356 (add-target (install "scripts/repl.mes" #:dir "bin" #:substitutes #t))
357 (define bootstrap? #f)
358 (if bootstrap?
359     (add-target (install "src/mes.mes" #:dir "bin" #:installed-name "mes"))
360     (add-target (install "src/mes.guile" #:dir "bin" #:installed-name "mes")))
361
362 (define* ((install-dir #:key dir) name)
363   (add-target (install name  #:dir (string-append dir "/" (dirname name)))))
364
365 (add-target (install "module/mes/base-0.mes" #:dir (string-append %moduledir "/mes") #:substitutes #t))
366 (add-target (install "module/language/c99/compiler.mes" #:dir (string-append %moduledir "/language/c99") #:substitutes #t))
367
368 (define %module-dir "share/mes")
369 (for-each
370  (lambda (f)
371    ((install-dir #:dir (string-append %module-dir)) f))
372  '("module/language/c99/compiler.mes"
373    "module/language/c99/compiler.scm"
374    "module/language/paren.mes"
375    "module/mes/M1.mes"
376    "module/mes/M1.scm"
377    "module/mes/as-i386.mes"
378    "module/mes/as-i386.scm"
379    "module/mes/as.mes"
380    "module/mes/as.scm"
381    ;;"module/mes/base-0.mes"
382    "module/mes/base.mes"
383    "module/mes/bytevectors.mes"
384    "module/mes/bytevectors.scm"
385    "module/mes/catch.mes"
386    "module/mes/display.mes"
387    "module/mes/elf.mes"
388    "module/mes/elf.scm"
389    "module/mes/fluids.mes"
390    "module/mes/getopt-long.mes"
391    "module/mes/getopt-long.scm"
392    "module/mes/guile.mes"
393    "module/mes/lalr.mes"
394    "module/mes/lalr.scm"
395    "module/mes/let.mes"
396    "module/mes/match.mes"
397    "module/mes/match.scm"
398    "module/mes/optargs.mes"
399    "module/mes/optargs.scm"
400    "module/mes/peg.mes"
401    "module/mes/peg/cache.scm"
402    "module/mes/peg/codegen.scm"
403    "module/mes/peg/simplify-tree.scm"
404    "module/mes/peg/string-peg.scm"
405    "module/mes/peg/using-parsers.scm"
406    "module/mes/pmatch.mes"
407    "module/mes/pmatch.scm"
408    "module/mes/posix.mes"
409    "module/mes/pretty-print.mes"
410    "module/mes/pretty-print.scm"
411    "module/mes/psyntax-0.mes"
412    "module/mes/psyntax-1.mes"
413    "module/mes/psyntax.mes"
414    "module/mes/psyntax.pp"
415    "module/mes/psyntax.ss"
416    "module/mes/quasiquote.mes"
417    "module/mes/quasisyntax.mes"
418    "module/mes/quasisyntax.scm"
419    "module/mes/read-0.mes"
420    "module/mes/record-0.mes"
421    "module/mes/record.mes"
422    "module/mes/repl.mes"
423    "module/mes/scm.mes"
424    "module/mes/syntax.mes"
425    "module/mes/syntax.scm"
426    "module/mes/test.mes"
427    "module/mes/tiny-0.mes"
428    "module/mes/type-0.mes"
429    "module/nyacc/lalr.mes"
430    "module/nyacc/lang/c99/cpp.mes"
431    "module/nyacc/lang/c99/parser.mes"
432    "module/nyacc/lang/calc/parser.mes"
433    "module/nyacc/lang/util.mes"
434    "module/nyacc/lex.mes"
435    "module/nyacc/parse.mes"
436    "module/nyacc/util.mes"
437    "module/rnrs/arithmetic/bitwise.mes"
438    "module/srfi/srfi-0.mes"
439    "module/srfi/srfi-1.mes"
440    "module/srfi/srfi-1.scm"
441    "module/srfi/srfi-13.mes"
442    "module/srfi/srfi-14.mes"
443    "module/srfi/srfi-16.mes"
444    "module/srfi/srfi-16.scm"
445    "module/srfi/srfi-26.mes"
446    "module/srfi/srfi-26.scm"
447    "module/srfi/srfi-43.mes"
448    "module/srfi/srfi-9-psyntax.mes"
449    "module/srfi/srfi-9.mes"
450    "module/srfi/srfi-9.scm"
451    "module/sxml/xpath.mes"
452    "module/sxml/xpath.scm"))
453
454 (define* ((install-guile-dir #:key dir) name)
455   (add-target (install (string-append "guile/" name) #:dir (string-append dir "/" (dirname name)))))
456
457 (for-each
458  (lambda (f)
459    ((install-guile-dir #:dir (string-append %guiledir)) f))
460  %scm-files)
461
462 (for-each
463  (lambda (f)
464    ((install-guile-dir #:dir (string-append %godir)) f))
465  %go-files)
466
467 (add-target (install "mlibc/libc-mes.E" #:dir "lib"))
468 (add-target (install "mlibc/libc-mes.M1" #:dir "lib"))
469 (add-target (install "mlibc/mini-libc-mes.E" #:dir "lib"))
470 (add-target (install "mlibc/mini-libc-mes.M1" #:dir "lib"))
471
472 (for-each
473  (lambda (f)
474    ((install-dir #:dir "share/") f))
475  '("mlibc/include/alloca.h"
476    "mlibc/include/assert.h"
477    "mlibc/include/ctype.h"
478    "mlibc/include/dlfcn.h"
479    "mlibc/include/errno.h"
480    "mlibc/include/fcntl.h"
481    "mlibc/include/features.h"
482    "mlibc/include/inttypes.h"
483    "mlibc/include/libgen.h"
484    "mlibc/include/limits.h"
485    "mlibc/include/locale.h"
486    "mlibc/include/math.h"
487    "mlibc/include/mlibc.h"
488    "mlibc/include/setjmp.h"
489    "mlibc/include/signal.h"
490    "mlibc/include/stdarg.h"
491    "mlibc/include/stdbool.h"
492    "mlibc/include/stdint.h"
493    "mlibc/include/stdio.h"
494    "mlibc/include/stdlib.h"
495    "mlibc/include/stdnoreturn.h"
496    "mlibc/include/string.h"
497    "mlibc/include/strings.h"
498    "mlibc/include/sys/cdefs.h"
499    "mlibc/include/sys/mman.h"
500    "mlibc/include/sys/stat.h"
501    "mlibc/include/sys/time.h"
502    "mlibc/include/sys/timeb.h"
503    "mlibc/include/sys/types.h"
504    "mlibc/include/sys/ucontext.h"
505    "mlibc/include/sys/wait.h"
506    "mlibc/include/time.h"
507    "mlibc/include/unistd.h"))
508
509 (for-each
510  (compose add-target (cut install <> #:dir "share/doc/mes"))
511  '("AUTHORS"
512    ;;"ChangeLog"
513    "COPYING"
514    "HACKING"
515    "INSTALL"
516    "NEWS"
517    "README"))
518
519 (add-target (install "doc/fosdem/fosdem.pdf" #:dir "share/doc/mes"))
520
521 (define (main args)
522   (cond ((member "all-go" args) #t)
523         ((member "clean-go" args) (map delete-file (filter file-exists? %go-files)))
524         ((member "clean" args) (clean))
525         ((member "list" args) (display (string-join (map target-file-name %targets) "\n" 'suffix)))
526         ((member "help" args) (format #t "Usage: ./make.scm [TARGET]...
527
528 Targets:
529     all
530     all-go
531     check
532     clean
533     clean-go
534     help~a
535     install
536     list
537 "
538                                       (string-join (filter (negate (cut string-index <> #\/)) (map target-file-name %targets)) "\n    " 'prefix)))
539         (else
540          (let ((targets (match args
541                           (() (filter (negate check-target?) %targets))
542                           ((? (cut member "all" <>)) (filter (conjoin (negate install-target?)
543                                                                       (negate check-target?))
544                                                              %targets))
545                           ((? (cut member "check" <>)) (filter check-target? %targets))
546                           ((? (cut member "install" <>)) (filter install-target? %targets))
547                           (_ (filter-map (cut get-target <>) args)))))
548            (for-each build targets)
549            ;;((@@ (mes make) store) #:print 0)
550            (exit %status)))))
551
552 (main (cdr (command-line)))