mescc: Move simple main to scaffold.

* scaffold/main.c (main): Move from doc/examples/main.c
* make.scm: Build it.
* README: Update.
* guile/mescc.scm (main):
* scripts/mescc.mes (main): Remove fallback doc/examples/main.c
This commit is contained in:
Jan Nieuwenhuizen 2017-08-06 13:14:09 +02:00
parent 12b41e0e86
commit ba50d4bd25
5 changed files with 16 additions and 6 deletions

2
README
View file

@ -53,5 +53,5 @@ General Public Licence version 3 or later. See the file COPYING.
* Mescc compiler * Mescc compiler
scripts/mescc.mes doc/examples/main.c > a.out scripts/mescc.mes scaffold/main.c > a.out

View file

@ -115,8 +115,7 @@ Usage: mescc.scm [OPTION]... FILE...
(define (main args) (define (main args)
(let* ((options (parse-opts args)) (let* ((options (parse-opts args))
(files (option-ref options '() '())) (files (option-ref options '() '()))
(file (if (null? files) (string-append %docdir "examples/main.c") (file (car files))
(car files)))
(preprocess? (option-ref options 'E #f)) (preprocess? (option-ref options 'E #f))
(compile? (option-ref options 'c #f)) (compile? (option-ref options 'c #f))
(debug-info? (option-ref options 'g #f)) (debug-info? (option-ref options 'g #f))

View file

@ -248,6 +248,19 @@ exec ${GUILE-guile} --no-auto-compile -L . -L guile -C . -C guile -s "$0" ${1+"$
;;(add-target (group "check-scaffold" #:dependencies (filter (target-prefix? "check-scaffold") %targets))) ;;(add-target (group "check-scaffold" #:dependencies (filter (target-prefix? "check-scaffold") %targets)))
(add-target (bin.gcc "scaffold/main.c"))
(add-target (check "scaffold/main.gcc" #:exit 42))
(add-target (bin.gcc "scaffold/main.c" #:libc #f))
(add-target (check "scaffold/main.mlibc-gcc" #:exit 42))
(add-target (bin.mescc "scaffold/main.c" #:libc mini-libc-mes.E))
(add-target (check "scaffold/main.mini-guile" #:exit 42))
(add-target (bin.mescc "scaffold/main.c"))
(add-target (check "scaffold/main.guile" #:exit 42))
(add-target (bin.gcc "scaffold/hello.c")) (add-target (bin.gcc "scaffold/hello.c"))
(add-target (check "scaffold/hello.gcc" #:exit 42)) (add-target (check "scaffold/hello.gcc" #:exit 42))

View file

@ -21,6 +21,5 @@
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
if (argc > 1) return argc;
return 42; return 42;
} }

View file

@ -119,8 +119,7 @@ Usage: mescc.mes [OPTION]... FILE...
(let* ((args (cons* (car args) (cdr (member "--" args)))) (let* ((args (cons* (car args) (cdr (member "--" args))))
(options (parse-opts args)) (options (parse-opts args))
(files (option-ref options '() '())) (files (option-ref options '() '()))
(file (if (null? files) (string-append %docdir "examples/main.c") (file (car files))
(car files)))
(preprocess? (option-ref options 'E #f)) (preprocess? (option-ref options 'E #f))
(compile? (option-ref options 'c #f)) (compile? (option-ref options 'c #f))
(debug-info? (option-ref options 'g #f)) (debug-info? (option-ref options 'g #f))