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