6a391df5e0
* make.scm (check-scaffold-tinycc): New target. * guile/guix/make.scm (<target>): Add baseline field. (method-check): Handle baseline. * scaffold/tinycc/00_assignment.c: New file. * scaffold/tinycc/00_assignment.expect: New file. * scaffold/tinycc/01_comment.c: New file. * scaffold/tinycc/01_comment.expect: New file. * scaffold/tinycc/02_printf.c: New file. * scaffold/tinycc/02_printf.expect: New file. * scaffold/tinycc/03_struct.c: New file. * scaffold/tinycc/03_struct.expect: New file. * scaffold/tinycc/04_for.c: New file. * scaffold/tinycc/04_for.expect: New file. * scaffold/tinycc/05_array.c: New file. * scaffold/tinycc/05_array.expect: New file. * scaffold/tinycc/06_case.c: New file. * scaffold/tinycc/06_case.expect: New file. * scaffold/tinycc/07_function.c: New file. * scaffold/tinycc/07_function.expect: New file. * scaffold/tinycc/08_while.c: New file. * scaffold/tinycc/08_while.expect: New file. * scaffold/tinycc/09_do_while.c: New file. * scaffold/tinycc/09_do_while.expect: New file. * scaffold/tinycc/10_pointer.c: New file. * scaffold/tinycc/10_pointer.expect: New file. * scaffold/tinycc/11_precedence.c: New file. * scaffold/tinycc/11_precedence.expect: New file. * scaffold/tinycc/12_hashdefine.c: New file. * scaffold/tinycc/12_hashdefine.expect: New file. * scaffold/tinycc/13_integer_literals.c: New file. * scaffold/tinycc/13_integer_literals.expect: New file. * scaffold/tinycc/14_if.c: New file. * scaffold/tinycc/14_if.expect: New file. * scaffold/tinycc/15_recursion.c: New file. * scaffold/tinycc/15_recursion.expect: New file. * scaffold/tinycc/16_nesting.c: New file. * scaffold/tinycc/16_nesting.expect: New file. * scaffold/tinycc/17_enum.c: New file. * scaffold/tinycc/17_enum.expect: New file. * scaffold/tinycc/18_include.h: New file. * scaffold/tinycc/18_include.c: New file. * scaffold/tinycc/18_include.expect: New file. * scaffold/tinycc/19_pointer_arithmetic.c: New file. * scaffold/tinycc/19_pointer_arithmetic.expect: New file. * scaffold/tinycc/20_pointer_comparison.c: New file. * scaffold/tinycc/20_pointer_comparison.expect: New file. * scaffold/tinycc/21_char_array.c: New file. * scaffold/tinycc/21_char_array.expect: New file. * scaffold/tinycc/22_floating_point.c: New file. * scaffold/tinycc/22_floating_point.expect: New file. * scaffold/tinycc/23_type_coercion.c: New file. * scaffold/tinycc/23_type_coercion.expect: New file. * scaffold/tinycc/24_math_library.c: New file. * scaffold/tinycc/24_math_library.expect: New file. * scaffold/tinycc/25_quicksort.c: New file. * scaffold/tinycc/25_quicksort.expect: New file. * scaffold/tinycc/26_character_constants.c: New file. * scaffold/tinycc/26_character_constants.expect: New file. * scaffold/tinycc/27_sizeof.c: New file. * scaffold/tinycc/27_sizeof.expect: New file. * scaffold/tinycc/28_strings.c: New file. * scaffold/tinycc/28_strings.expect: New file. * scaffold/tinycc/29_array_address.c: New file. * scaffold/tinycc/29_array_address.expect: New file. * scaffold/tinycc/30_hanoi.c: New file. * scaffold/tinycc/30_hanoi.expect: New file. * scaffold/tinycc/31_args.c: New file. * scaffold/tinycc/31_args.expect: New file. * scaffold/tinycc/32_led.c: New file. * scaffold/tinycc/32_led.expect: New file. * scaffold/tinycc/33_ternary_op.c: New file. * scaffold/tinycc/33_ternary_op.expect: New file. * scaffold/tinycc/34_array_assignment.c: New file. * scaffold/tinycc/34_array_assignment.expect: New file. * scaffold/tinycc/35_sizeof.c: New file. * scaffold/tinycc/35_sizeof.expect: New file. * scaffold/tinycc/36_array_initialisers.c: New file. * scaffold/tinycc/36_array_initialisers.expect: New file. * scaffold/tinycc/37_sprintf.c: New file. * scaffold/tinycc/37_sprintf.expect: New file. * scaffold/tinycc/38_multiple_array_index.c: New file. * scaffold/tinycc/38_multiple_array_index.expect: New file. * scaffold/tinycc/39_typedef.c: New file. * scaffold/tinycc/39_typedef.expect: New file. * scaffold/tinycc/40_stdio.c: New file. * scaffold/tinycc/40_stdio.expect: New file. * scaffold/tinycc/41_hashif.c: New file. * scaffold/tinycc/41_hashif.expect: New file. * scaffold/tinycc/42_function_pointer.c: New file. * scaffold/tinycc/42_function_pointer.expect: New file. * scaffold/tinycc/43_void_param.c: New file. * scaffold/tinycc/43_void_param.expect: New file. * scaffold/tinycc/44_scoped_declarations.c: New file. * scaffold/tinycc/44_scoped_declarations.expect: New file. * scaffold/tinycc/45_empty_for.c: New file. * scaffold/tinycc/45_empty_for.expect: New file. * scaffold/tinycc/46_grep.c: New file. * scaffold/tinycc/46_grep.expect: New file. * scaffold/tinycc/47_switch_return.c: New file. * scaffold/tinycc/47_switch_return.expect: New file. * scaffold/tinycc/48_nested_break.c: New file. * scaffold/tinycc/48_nested_break.expect: New file. * scaffold/tinycc/49_bracket_evaluation.c: New file. * scaffold/tinycc/49_bracket_evaluation.expect: New file. * scaffold/tinycc/50_logical_second_arg.c: New file. * scaffold/tinycc/50_logical_second_arg.expect: New file. * scaffold/tinycc/51_static.c: New file. * scaffold/tinycc/51_static.expect: New file. * scaffold/tinycc/52_unnamed_enum.c: New file. * scaffold/tinycc/52_unnamed_enum.expect: New file. * scaffold/tinycc/54_goto.c: New file. * scaffold/tinycc/54_goto.expect: New file. * scaffold/tinycc/55_lshift_type.c: New file. * scaffold/tinycc/55_lshift_type.expect: New file. * scaffold/tinycc/56_btype_excess-1.c: New file. * scaffold/tinycc/56_btype_excess-1.expect: New file. * scaffold/tinycc/57_btype_excess-2.c: New file. * scaffold/tinycc/57_btype_excess-2.expect: New file. * scaffold/tinycc/58_function_redefinition.c: New file. * scaffold/tinycc/58_function_redefinition.expect: New file. * scaffold/tinycc/59_function_array.c: New file. * scaffold/tinycc/59_function_array.expect: New file. * scaffold/tinycc/60_enum_redefinition.c: New file. * scaffold/tinycc/60_enum_redefinition.expect: New file. * scaffold/tinycc/61_undefined_enum.c: New file. * scaffold/tinycc/61_undefined_enum.expect: New file. * scaffold/tinycc/62_enumerator_redefinition.c: New file. * scaffold/tinycc/62_enumerator_redefinition.expect: New file. * scaffold/tinycc/63_local_enumerator_redefinition.c: New file. * scaffold/tinycc/63_local_enumerator_redefinition.expect: New file. * scaffold/tinycc/64_macro_nesting.c: New file. * scaffold/tinycc/64_macro_nesting.expect: New file. * scaffold/tinycc/67_macro_concat.c: New file. * scaffold/tinycc/67_macro_concat.expect: New file. * scaffold/tinycc/70_floating_point_literals.c: New file. * scaffold/tinycc/70_floating_point_literals.expect: New file. * scaffold/tinycc/71_macro_empty_arg.c: New file. * scaffold/tinycc/71_macro_empty_arg.expect: New file. * scaffold/tinycc/72_long_long_constant.c: New file. * scaffold/tinycc/72_long_long_constant.expect: New file. * scaffold/tinycc/73_arm64.c: New file. * scaffold/tinycc/73_arm64.expect: New file. * scaffold/tinycc/74_nocode_wanted.c: New file. * scaffold/tinycc/74_nocode_wanted.expect: New file. * scaffold/tinycc/75_array_in_struct_init.c: New file. * scaffold/tinycc/75_array_in_struct_init.expect: New file. * scaffold/tinycc/76_dollars_in_identifiers.c: New file. * scaffold/tinycc/76_dollars_in_identifiers.expect: New file. * scaffold/tinycc/77_push_pop_macro.c: New file. * scaffold/tinycc/77_push_pop_macro.expect: New file. * scaffold/tinycc/78_vla_label.c: New file. * scaffold/tinycc/78_vla_label.expect: New file. * scaffold/tinycc/79_vla_continue.c: New file. * scaffold/tinycc/79_vla_continue.expect: New file. * scaffold/tinycc/80_flexarray.c: New file. * scaffold/tinycc/80_flexarray.expect: New file. * scaffold/tinycc/81_types.c: New file. * scaffold/tinycc/81_types.expect: New file. * scaffold/tinycc/82_attribs_position.c: New file. * scaffold/tinycc/82_attribs_position.expect: New file. * scaffold/tinycc/83_utf8_in_identifiers.c: New file. * scaffold/tinycc/83_utf8_in_identifiers.expect: New file. * scaffold/tinycc/84_hex-float.c: New file. * scaffold/tinycc/84_hex-float.expect: New file. * scaffold/tinycc/85_asm-outside-function.c: New file. * scaffold/tinycc/85_asm-outside-function.expect: New file. * scaffold/tinycc/86_memory-model.c: New file. * scaffold/tinycc/86_memory-model.expect: New file. * scaffold/tinycc/87_dead_code.c: New file. * scaffold/tinycc/87_dead_code.expect: New file. * scaffold/tinycc/88_codeopt.c: New file. * scaffold/tinycc/88_codeopt.expect: New file. * scaffold/tinycc/89_nocode_wanted.c: New file. * scaffold/tinycc/89_nocode_wanted.expect: New file. * scaffold/tinycc/90_struct-init.c: New file. * scaffold/tinycc/90_struct-init.expect: New file. * scaffold/tinycc/91_ptr_longlong_arith32.c: New file. * scaffold/tinycc/91_ptr_longlong_arith32.expect: New file. * scaffold/tinycc/92_enum_bitfield.c: New file. * scaffold/tinycc/92_enum_bitfield.expect: New file. * scaffold/tinycc/93_integer_promotion.c: New file. * scaffold/tinycc/93_integer_promotion.expect: New file. * scaffold/tinycc/COPYING: New file. * scaffold/tinycc/LICENSE: New file. include
374 lines
14 KiB
Scheme
Executable file
374 lines
14 KiB
Scheme
Executable file
#! /usr/bin/env guile
|
|
!#
|
|
|
|
(set! %load-path (cons "guile" %load-path))
|
|
(set! %load-path (cons "../guix" %load-path))
|
|
(set! %load-compiled-path (cons "guile" %load-compiled-path))
|
|
(set! %load-compiled-path (cons "../guix" %load-compiled-path))
|
|
|
|
(use-modules (guix shell-utils))
|
|
|
|
;; FIXME: .go dependencies
|
|
;; workaround: always update .go before calculating hashes
|
|
;;(use-modules ((mes make) #:select (sytem**)))
|
|
(let* ((scm-files '("guix/make.scm"
|
|
"guix/records.scm"
|
|
"guix/shell-utils.scm"
|
|
"language/c99/compiler.scm"
|
|
"mes/as-i386.scm"
|
|
"mes/as.scm"
|
|
"mes/elf.scm"
|
|
"mes/M1.scm")))
|
|
(setenv "srcdir" "guile")
|
|
(setenv "host" %host-type)
|
|
(with-directory-excursion "guile"
|
|
(apply system* `("guile"
|
|
"--no-auto-compile"
|
|
"-L" "."
|
|
"-C" "."
|
|
"-s"
|
|
"../build-aux/compile-all.scm"
|
|
,@scm-files))))
|
|
|
|
(use-modules (srfi srfi-1)
|
|
(srfi srfi-26)
|
|
(ice-9 curried-definitions)
|
|
(ice-9 match)
|
|
(guix make))
|
|
|
|
(add-target (bin.mescc "stage0/exit-42.c" #:libc #f))
|
|
(add-target (check "stage0/exit-42.0-guile" #:signal 11)) ; FIXME: segfault
|
|
|
|
(add-target (bin.mescc "stage0/exit-42.c" #:libc mini-libc-mes.E))
|
|
(add-target (check "stage0/exit-42.mini-guile" #:exit 42))
|
|
|
|
(add-target (bin.mescc "stage0/exit-42.c"))
|
|
(add-target (check "stage0/exit-42.guile" #:exit 42))
|
|
|
|
(define* (add-scaffold-test name #:key (exit 0) (libc libc-mes.E))
|
|
(add-target (bin.gcc (string-append "scaffold/tests/" name ".c") #:libc #f))
|
|
(add-target (check (string-append "scaffold/tests/" name ".mlibc-gcc") #:exit exit))
|
|
|
|
(add-target (bin.mescc (string-append "scaffold/tests/" name ".c") #:libc libc))
|
|
(add-target (check (string-append "scaffold/tests/" name "." (cond ((not libc) "0-")
|
|
((eq? libc mini-libc-mes.E) "mini-")
|
|
(else "")) "guile") #:exit exit)))
|
|
|
|
;; tests/00: exit, functions without libc
|
|
(add-scaffold-test "00-exit-0" #:libc #f)
|
|
(add-scaffold-test "01-return-0" #:libc #f)
|
|
(add-scaffold-test "02-return-1" #:libc #f #:exit 1)
|
|
(add-scaffold-test "03-call" #:libc #f)
|
|
(add-scaffold-test "04-call-0" #:libc #f)
|
|
(add-scaffold-test "05-call-1" #:libc #f #:exit 1)
|
|
(add-scaffold-test "06-call-!1" #:libc #f)
|
|
|
|
(add-target (group "check-scaffold-tests/0" #:dependencies (filter (target-prefix? "check-scaffold/tests/0") %targets)))
|
|
|
|
;; tests/10: control without libc
|
|
(for-each
|
|
(cut add-scaffold-test <> #:libc #f)
|
|
'("10-if-0"
|
|
"11-if-1"
|
|
"12-if-=="
|
|
"13-if-!="
|
|
"14-if-goto"
|
|
"15-if-!f"
|
|
"16-if-t"))
|
|
|
|
(add-target (group "check-scaffold-tests/1" #:dependencies (filter (target-prefix? "check-scaffold/tests/1") %targets)))
|
|
|
|
;; tests/20: loop without libc
|
|
(for-each
|
|
(cut add-scaffold-test <> #:libc #f)
|
|
'("20-while"
|
|
"21-char[]"
|
|
"22-while-char[]"))
|
|
|
|
(add-target (group "check-scaffold-tests/2" #:dependencies (filter (target-prefix? "check-scaffold/tests/2") %targets)))
|
|
|
|
;; tests/30: call, compare: mini-libc-mes.c
|
|
(for-each
|
|
(cut add-scaffold-test <> #:libc mini-libc-mes.E)
|
|
'("30-strlen"
|
|
"31-eputs"
|
|
"32-compare"
|
|
"33-and-or"
|
|
"34-pre-post"
|
|
"35-compare-char"
|
|
"36-compare-arithmetic"
|
|
"37-compare-assign"
|
|
"38-compare-call"))
|
|
|
|
(add-target (group "check-scaffold-tests/3" #:dependencies (filter (target-prefix? "check-scaffold/tests/3") %targets)))
|
|
|
|
;; tests/40: control: mini-libc-mes.c
|
|
(for-each
|
|
(cut add-scaffold-test <> #:libc mini-libc-mes.E)
|
|
'("40-if-else"
|
|
"41-?"
|
|
"42-goto-label"
|
|
"43-for-do-while"
|
|
"44-switch"
|
|
"45-void-call"))
|
|
|
|
(add-target (group "check-scaffold-tests/4" #:dependencies (filter (target-prefix? "check-scaffold/tests/4") %targets)))
|
|
|
|
;; tests/50: libc-mes.c
|
|
(for-each
|
|
add-scaffold-test
|
|
'("50-assert"
|
|
"51-strcmp"
|
|
"52-itoa"
|
|
"54-argv"))
|
|
|
|
(add-target (group "check-scaffold-tests/5" #:dependencies (filter (target-prefix? "check-scaffold/tests/5") %targets)))
|
|
|
|
;; tests/60: building up to scaffold/m.c, scaffold/micro-mes.c
|
|
(for-each
|
|
add-scaffold-test
|
|
'("60-math"
|
|
"61-array"
|
|
"63-struct-cell"
|
|
"64-make-cell"
|
|
"65-read"))
|
|
|
|
(add-target (group "check-scaffold-tests/6" #:dependencies (filter (target-prefix? "check-scaffold/tests/6") %targets)))
|
|
|
|
;; tests/70: and beyond src/mes.c -- building up to 8cc.c, pcc.c, tcc.c, libguile/eval.c
|
|
(for-each
|
|
add-scaffold-test
|
|
'("70-printf"
|
|
"71-struct-array"))
|
|
|
|
(add-target (group "check-scaffold-tests/7" #:dependencies (filter (target-prefix? "check-scaffold/tests/7") %targets)))
|
|
|
|
(add-target (group "check-scaffold-tests" #:dependencies (filter (target-prefix? "check-scaffold/tests") %targets)))
|
|
|
|
|
|
(define* (add-tcc-test name)
|
|
(add-target (bin.gcc (string-append "scaffold/tinycc/" name ".c") #:libc #f #:includes '("scaffold/tinycc")))
|
|
(add-target (check (string-append "scaffold/tinycc/" name ".mlibc-gcc") #:baseline (string-append "scaffold/tinycc/" name ".expect")))
|
|
|
|
(add-target (bin.mescc (string-append "scaffold/tinycc/" name ".c") #:includes '("scaffold/tinycc")))
|
|
(add-target (check (string-append "scaffold/tinycc/" name ".guile") #:baseline (string-append "scaffold/tinycc/" name ".expect"))))
|
|
(map
|
|
add-tcc-test
|
|
'("00_assignment"
|
|
"01_comment"
|
|
"02_printf"
|
|
"03_struct"
|
|
"04_for"
|
|
"05_array"
|
|
"06_case"
|
|
"07_function"
|
|
"08_while"
|
|
"09_do_while"
|
|
|
|
"10_pointer"
|
|
"11_precedence"
|
|
"12_hashdefine"
|
|
"13_integer_literals"
|
|
"14_if"
|
|
"15_recursion"
|
|
"16_nesting"
|
|
"17_enum"
|
|
"18_include"
|
|
"19_pointer_arithmetic"
|
|
|
|
"20_pointer_comparison"
|
|
"21_char_array"
|
|
;;"22_floating_point" ; float
|
|
;;"23_type_coercion" ; float
|
|
;;"24_math_library" ; float
|
|
"25_quicksort"
|
|
;;"27_sizeof" ; float
|
|
;;"28_strings" ; TODO: strncpy strchr strrchr memset memcpy memcmp
|
|
"29_array_address"
|
|
|
|
;;"30_hanoi" ; fails with GCC
|
|
"31_args"
|
|
;;"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"))))))
|
|
;;"34_array_assignment" ; fails with GCC
|
|
"33_ternary_op"
|
|
"35_sizeof"
|
|
;;"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"))))))))
|
|
;; "37_sprintf" ; integer formatting unsupported
|
|
;;"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"))))))
|
|
;;"39_typedef" ; unsupported: (decl (decl-spec-list (stor-spec (typedef)) (type-spec (typename "MyFunStruct"))) (init-declr-list (init-declr (ptr-declr (pointer) (ident "MoreFunThanEver")))))
|
|
|
|
;;"40_stdio" ; f* functions
|
|
"41_hashif"
|
|
;;"42_function_pointer" ; f* functions
|
|
"43_void_param"
|
|
"44_scoped_declarations"
|
|
;; "45_empty_for" ; unsupported
|
|
;;"46_grep" ; f* functions
|
|
"47_switch_return"
|
|
"48_nested_break"
|
|
;;"49_bracket_evaluation" ; float
|
|
|
|
"50_logical_second_arg"
|
|
;;"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"))))))
|
|
;;"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"))))
|
|
"54_goto"
|
|
;;"55_lshift_type" ; unsigned
|
|
))
|
|
|
|
(add-target (group "check-scaffold-tinycc" #:dependencies (filter (target-prefix? "check-scaffold/tinycc") %targets)))
|
|
|
|
;;(add-target (group "check-scaffold" #:dependencies (filter (target-prefix? "check-scaffold") %targets)))
|
|
|
|
(add-target (bin.gcc "scaffold/hello.c"))
|
|
(add-target (check "scaffold/hello.gcc" #:exit 42))
|
|
|
|
(add-target (bin.gcc "scaffold/hello.c" #:libc #f))
|
|
(add-target (check "scaffold/hello.mlibc-gcc" #:exit 42))
|
|
|
|
(add-target (bin.mescc "scaffold/hello.c" #:libc mini-libc-mes.E))
|
|
(add-target (check "scaffold/hello.mini-guile" #:exit 42))
|
|
|
|
(add-target (bin.mescc "scaffold/hello.c"))
|
|
(add-target (check "scaffold/hello.guile" #:exit 42))
|
|
|
|
|
|
(add-target (bin.gcc "scaffold/m.c"))
|
|
(add-target (check "scaffold/m.gcc" #:exit 255))
|
|
|
|
(add-target (bin.gcc "scaffold/m.c" #:libc #f))
|
|
(add-target (check "scaffold/m.mlibc-gcc" #:exit 255))
|
|
|
|
(add-target (bin.mescc "scaffold/m.c"))
|
|
(add-target (check "scaffold/m.guile" #:exit 255))
|
|
|
|
(add-target (bin.gcc "scaffold/micro-mes.c" #:libc #f))
|
|
(add-target (check "scaffold/micro-mes.mlibc-gcc" #:exit 6)) ; arg1 arg2 arg3 arg4 arg5
|
|
|
|
(add-target (bin.mescc "scaffold/micro-mes.c"))
|
|
(add-target (check "scaffold/micro-mes.guile" #:exit 6)) ; arg1 arg2 arg3 arg4 arg5
|
|
|
|
(define snarf-bases
|
|
'("gc" "lib" "math" "mes" "posix" "reader" "vector"))
|
|
|
|
(define bla
|
|
`(,@(map (cut string-append "src/" <> ".c") snarf-bases)
|
|
,@(map (cut string-append "src/" <> ".mes.h") snarf-bases)
|
|
,@(map (cut string-append "src/" <> ".mes.i") snarf-bases)
|
|
,@(map (cut string-append "src/" <> ".mes.environment.i") snarf-bases)))
|
|
|
|
(define gcc-snarf-targets
|
|
(list
|
|
(add-target (snarf "src/gc.c" #:mes? #f))
|
|
(add-target (snarf "src/lib.c" #:mes? #f))
|
|
(add-target (snarf "src/math.c" #:mes? #f))
|
|
(add-target (snarf "src/mes.c" #:mes? #f))
|
|
(add-target (snarf "src/posix.c" #:mes? #f))
|
|
(add-target (snarf "src/reader.c" #:mes? #f))
|
|
(add-target (snarf "src/vector.c" #:mes? #f))))
|
|
|
|
(define mes-snarf-targets
|
|
(list
|
|
(add-target (snarf "src/gc.c" #:mes? #t))
|
|
(add-target (snarf "src/lib.c" #:mes? #t))
|
|
(add-target (snarf "src/math.c" #:mes? #t))
|
|
(add-target (snarf "src/mes.c" #:mes? #t))
|
|
(add-target (snarf "src/posix.c" #:mes? #t))
|
|
(add-target (snarf "src/reader.c" #:mes? #t))
|
|
(add-target (snarf "src/vector.c" #:mes? #t))))
|
|
|
|
(define VERSION "0.8")
|
|
(define PREFIX (or (getenv "PREFIX") "/usr/local"))
|
|
(define DATADIR (or (getenv "DATADIR") (string-append PREFIX " /share")))
|
|
(define MODULEDIR (or (getenv "MODULEDIR") (string-append DATADIR "/module/")))
|
|
|
|
(add-target (bin.gcc "src/mes.c" #:dependencies gcc-snarf-targets
|
|
#:defines `("FIXED_PRIMITIVES=1"
|
|
"MES_FULL=1"
|
|
"POSIX=1"
|
|
,(string-append "VERSION=\"" VERSION "\"")
|
|
,(string-append "MODULEDIR=\"" MODULEDIR "\"")
|
|
,(string-append "PREFIX=\"" PREFIX "\""))))
|
|
|
|
(add-target (bin.gcc "src/mes.c" #:libc #f
|
|
#:dependencies mes-snarf-targets
|
|
#:defines `("FIXED_PRIMITIVES=1"
|
|
"MES_FULL=1"
|
|
,(string-append "VERSION=\"" VERSION "\"")
|
|
,(string-append "MODULEDIR=\"" MODULEDIR "\"")
|
|
,(string-append "PREFIX=\"" PREFIX "\""))))
|
|
|
|
(add-target (bin.mescc "src/mes.c" #:dependencies mes-snarf-targets
|
|
#:defines `("FIXED_PRIMITIVES=1"
|
|
"MES_FULL=1"
|
|
,(string-append "VERSION=\"" VERSION "\"")
|
|
,(string-append "MODULEDIR=\"" MODULEDIR "\"")
|
|
,(string-append "PREFIX=\"" PREFIX "\""))))
|
|
|
|
(define mes-tests
|
|
'("tests/read.test"
|
|
"tests/base.test"
|
|
"tests/closure.test"
|
|
"tests/quasiquote.test"
|
|
"tests/let.test"
|
|
"tests/scm.test"
|
|
"tests/display.test"
|
|
"tests/cwv.test"
|
|
"tests/math.test"
|
|
"tests/vector.test"
|
|
"tests/srfi-1.test"
|
|
"tests/srfi-13.test"
|
|
"tests/srfi-14.test"
|
|
"tests/optargs.test"
|
|
"tests/fluids.test"
|
|
"tests/catch.test"
|
|
"tests/psyntax.test"
|
|
"tests/pmatch.test"
|
|
"tests/let-syntax.test"
|
|
"tests/guile.test"
|
|
"tests/record.test"
|
|
;;sloooowwww
|
|
;;"tests/match.test"
|
|
;;"tests/peg.test"
|
|
))
|
|
|
|
(define (add-mes.gcc-test o)
|
|
(add-target (target (file-name o)))
|
|
(add-target (check o #:dependencies (list (get-target "src/mes.mlibc-gcc")))))
|
|
|
|
(define (add-mes.guile-test o)
|
|
(add-target (target (file-name o)))
|
|
(add-target (check o #:dependencies (list (get-target "src/mes.guile")))))
|
|
|
|
;; takes long, and should always pass if...
|
|
;;(for-each add-mes.gcc-test mes-tests)
|
|
|
|
;; ...mes.guile passes :-)
|
|
(for-each add-mes.guile-test mes-tests)
|
|
|
|
;; FIXME: run tests/base.test
|
|
(setenv "MES" "src/mes.guile")
|
|
|
|
(define (main args)
|
|
(cond ((member "clean" args) (clean))
|
|
((member "help" args) (format #t "Usage: ./make.scm [TARGET]...
|
|
|
|
Targets:
|
|
all
|
|
check
|
|
clean
|
|
help~a
|
|
"
|
|
;;(string-join (map target-file-name %targets) "\n " 'prefix)
|
|
(string-join (filter (negate (cut string-index <> #\/)) (map target-file-name %targets)) "\n " 'prefix)))
|
|
(else
|
|
(let ((targets (match args
|
|
(() (filter (negate check-target?) %targets))
|
|
((? (cut member "all" <>)) (filter (negate check-target?) %targets))
|
|
((? (cut member "check" <>)) (filter check-target? %targets))
|
|
(_ (filter-map (cut get-target <>) args)))))
|
|
(for-each build targets)
|
|
;;((@@ (mes make) store) #:print 0)
|
|
(exit %status)))))
|
|
|
|
(main (cdr (command-line)))
|