From ba50d4bd25108e678bebf0fc844345939671f924 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sun, 6 Aug 2017 13:14:09 +0200 Subject: [PATCH] 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 --- README | 2 +- guile/mescc.scm | 3 +-- make.scm | 13 +++++++++++++ {doc/examples => scaffold}/main.c | 1 - scripts/mescc.mes | 3 +-- 5 files changed, 16 insertions(+), 6 deletions(-) rename {doc/examples => scaffold}/main.c (96%) diff --git a/README b/README index 704f46b8..685ee306 100644 --- a/README +++ b/README @@ -53,5 +53,5 @@ General Public Licence version 3 or later. See the file COPYING. * Mescc compiler - scripts/mescc.mes doc/examples/main.c > a.out + scripts/mescc.mes scaffold/main.c > a.out diff --git a/guile/mescc.scm b/guile/mescc.scm index 89947458..55447215 100755 --- a/guile/mescc.scm +++ b/guile/mescc.scm @@ -115,8 +115,7 @@ Usage: mescc.scm [OPTION]... FILE... (define (main args) (let* ((options (parse-opts args)) (files (option-ref options '() '())) - (file (if (null? files) (string-append %docdir "examples/main.c") - (car files))) + (file (car files)) (preprocess? (option-ref options 'E #f)) (compile? (option-ref options 'c #f)) (debug-info? (option-ref options 'g #f)) diff --git a/make.scm b/make.scm index 04b05f20..8be7ca89 100755 --- a/make.scm +++ b/make.scm @@ -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 (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 (check "scaffold/hello.gcc" #:exit 42)) diff --git a/doc/examples/main.c b/scaffold/main.c similarity index 96% rename from doc/examples/main.c rename to scaffold/main.c index 65a64af5..5ac0120b 100644 --- a/doc/examples/main.c +++ b/scaffold/main.c @@ -21,6 +21,5 @@ int main (int argc, char *argv[]) { - if (argc > 1) return argc; return 42; } diff --git a/scripts/mescc.mes b/scripts/mescc.mes index 542621e0..677ea56d 100755 --- a/scripts/mescc.mes +++ b/scripts/mescc.mes @@ -119,8 +119,7 @@ Usage: mescc.mes [OPTION]... FILE... (let* ((args (cons* (car args) (cdr (member "--" args)))) (options (parse-opts args)) (files (option-ref options '() '())) - (file (if (null? files) (string-append %docdir "examples/main.c") - (car files))) + (file (car files)) (preprocess? (option-ref options 'E #f)) (compile? (option-ref options 'c #f)) (debug-info? (option-ref options 'g #f))