build: mlib/include to include, move mlib to lib.

* include: Move from mlib/include.
* lib: Move from mlib.
* BOOTSTRAP: Update.
* HACKING: Update.
* guile/guix/make.scm: Update.
* make.scm: Update.
* module/language/c99/compiler.mes: Update.
This commit is contained in:
Jan Nieuwenhuizen 2017-11-22 16:23:48 +01:00
parent 1762efc4b9
commit 0fa18b338d
52 changed files with 71 additions and 71 deletions

View File

@ -68,10 +68,10 @@ Do:
*** Remember that mes.M1 is compiled by mescc from prototyped src/mes.c in C. *** Remember that mes.M1 is compiled by mescc from prototyped src/mes.c in C.
*** stage0/mescc-tools: TODO *** stage0/mescc-tools: TODO
*** Mes *** Mes
M1 -f stage0/x86.M1 -f mlibc/crt1.M1 --LittleEndian --Architecture=1 > mlibc/crt1.hex2 M1 -f stage0/x86.M1 -f lib/crt1.M1 --LittleEndian --Architecture=1 > lib/crt1.hex2
M1 -f stage0/x86.M1 -f mlibc/mini-libc-mes.M1 --LittleEndian --Architecture=1 > mlibc/libc-mes.hex2 M1 -f stage0/x86.M1 -f lib/mini-libc-mes.M1 --LittleEndian --Architecture=1 > lib/libc-mes.hex2
M1 -f stage0/x86.M1 -f src/mes.M1 --LittleEndian --Architecture=1 > src/mes.hex2 M1 -f stage0/x86.M1 -f src/mes.M1 --LittleEndian --Architecture=1 > src/mes.hex2
hex2 --LittleEndian --Architecture=1 --BaseAddress=0x1000000 -f stage0/elf32-header.hex2 -f mlibc/crt1.hex2 -f mlibc/libc-mes.hex2 -f src/mes.hex2 -f stage0/elf32-footer-single-main.hex2 > src/mes-mes hex2 --LittleEndian --Architecture=1 --BaseAddress=0x1000000 -f stage0/elf32-header.hex2 -f lib/crt1.hex2 -f lib/libc-mes.hex2 -f src/mes.hex2 -f stage0/elf32-footer-single-main.hex2 > src/mes-mes
exec_enable src/mes-mes exec_enable src/mes-mes
*** Tinycc *** Tinycc
./build.sh ./build.sh

View File

@ -24,7 +24,7 @@ slower than guile. That's why we usually don't use mes during development.
gcc is used to verify the sanity of our C sources. gcc is used to verify the sanity of our C sources.
i686-unknown-linux-gnu-gcc is used to compare hex/assembly, to test i686-unknown-linux-gnu-gcc is used to compare hex/assembly, to test
the gcc variant of mlbic: mlibc/libc-gcc.c and steal ideas. the gcc variant of mes libc: lib/libc-gcc.c and steal ideas.
Guile is used to develop mescc, the C compiler in Scheme that during Guile is used to develop mescc, the C compiler in Scheme that during
bootstrapping will be executed by mes. bootstrapping will be executed by mes.

View File

@ -343,9 +343,9 @@
"-D" "-D"
"POSIX=1" "POSIX=1"
"-I" "src" "-I" "src"
"-I" "mlibc" "-I" "lib"
"-I" "mlibc/include" "-I" "include"
"--include=mlibc/libc-gcc.c")) "--include=lib/libc-gcc.c"))
(define %C32-FLAGS (define %C32-FLAGS
'("--std=gnu99" '("--std=gnu99"
@ -353,8 +353,8 @@
"-g" "-g"
"-m32" "-m32"
"-I" "src" "-I" "src"
"-I" "mlibc" "-I" "lib"
"-I" "mlibc/include")) "-I" "include"))
(define* (CC.gcc #:key (libc #t) (cc (if (eq? libc #t) %CC %CC32)) (c-flags (if (eq? libc #t) %C-FLAGS %C32-FLAGS)) (defines '()) (includes '())) (define* (CC.gcc #:key (libc #t) (cc (if (eq? libc #t) %CC %CC32)) (c-flags (if (eq? libc #t) %C-FLAGS %C32-FLAGS)) (defines '()) (includes '()))
(method (name "CC.gcc") (method (name "CC.gcc")
@ -538,6 +538,6 @@
(if (target? o) o (if (target? o) o
(find (lambda (t) (equal? (target-file-name t) o)) %targets))) (find (lambda (t) (equal? (target-file-name t) o)) %targets)))
(define crt1.mlibc-o (compile.gcc "mlibc/crt1.c" #:libc #f)) (define crt1.mlibc-o (compile.gcc "lib/crt1.c" #:libc #f))
(define libc-gcc.mlibc-o (compile.gcc "mlibc/libc-gcc.c" #:libc #f)) (define libc-gcc.mlibc-o (compile.gcc "lib/libc-gcc.c" #:libc #f))
(define libc-gcc+tcc.mlibc-o (compile.gcc "mlibc/libc-gcc+tcc.c" #:libc #f)) (define libc-gcc+tcc.mlibc-o (compile.gcc "lib/libc-gcc+tcc.c" #:libc #f))

114
make.scm
View File

@ -38,7 +38,7 @@ exec ${GUILE-guile} --no-auto-compile -L . -L guile -C . -C guile -s "$0" ${1+"$
(ice-9 match) (ice-9 match)
(guix make)) (guix make))
(define crt1.hex2 (m1.as "mlibc/crt1.c")) (define crt1.hex2 (m1.as "lib/crt1.c"))
(add-target crt1.hex2) (add-target crt1.hex2)
(add-target crt1.mlibc-o) (add-target crt1.mlibc-o)
@ -95,28 +95,28 @@ exec ${GUILE-guile} --no-auto-compile -L . -L guile -C . -C guile -s "$0" ${1+"$
,@(if libc (list libc) '()))) ,@(if libc (list libc) '())))
(method (LINK.hex2 #:hex2 hex2 #:crt1 crt1 #:libc libc #:debug? (eq? libc libc-mes.hex2)))))) (method (LINK.hex2 #:hex2 hex2 #:crt1 crt1 #:libc libc #:debug? (eq? libc libc-mes.hex2))))))
;;(define mini-libc-mes.E (m1.as "mlibc/mini-libc-mes.c")) ;;(define mini-libc-mes.E (m1.as "lib/mini-libc-mes.c"))
(define libc-mes.hex2 (m1.as "mlibc/libc-mes.c")) (define libc-mes.hex2 (m1.as "lib/libc-mes.c"))
(add-target libc-mes.hex2) (add-target libc-mes.hex2)
(define mini-libc-mes.hex2 (m1.as "mlibc/mini-libc-mes.c")) (define mini-libc-mes.hex2 (m1.as "lib/mini-libc-mes.c"))
(add-target mini-libc-mes.hex2) (add-target mini-libc-mes.hex2)
(define libc-mes+tcc.hex2 (m1.as "mlibc/libc-mes+tcc.c")) (define libc-mes+tcc.hex2 (m1.as "lib/libc-mes+tcc.c"))
(add-target libc-mes+tcc.hex2) (add-target libc-mes+tcc.hex2)
(add-target (bin.mescc "stage0/exit-42.c" #:libc #f)) (add-target (bin.mescc "stage0/exit-42.c" #:libc #f))
(add-target (check "stage0/exit-42.0-guile" #:exit 42)) (add-target (check "stage0/exit-42.0-guile" #:exit 42))
(add-target (cpp.mescc "mlibc/mini-libc-mes.c")) (add-target (cpp.mescc "lib/mini-libc-mes.c"))
(add-target (compile.mescc "mlibc/mini-libc-mes.c")) (add-target (compile.mescc "lib/mini-libc-mes.c"))
(add-target (bin.mescc "stage0/exit-42.c" #:libc mini-libc-mes.hex2)) (add-target (bin.mescc "stage0/exit-42.c" #:libc mini-libc-mes.hex2))
(add-target (check "stage0/exit-42.mini-guile" #:exit 42)) (add-target (check "stage0/exit-42.mini-guile" #:exit 42))
(add-target (cpp.mescc "mlibc/libc-mes.c")) (add-target (cpp.mescc "lib/libc-mes.c"))
(add-target (compile.mescc "mlibc/libc-mes.c")) (add-target (compile.mescc "lib/libc-mes.c"))
(add-target (bin.mescc "stage0/exit-42.c")) (add-target (bin.mescc "stage0/exit-42.c"))
(add-target (check "stage0/exit-42.guile" #:exit 42)) (add-target (check "stage0/exit-42.guile" #:exit 42))
@ -130,9 +130,9 @@ exec ${GUILE-guile} --no-auto-compile -L . -L guile -C . -C guile -s "$0" ${1+"$
((eq? libc mini-libc-mes.hex2) "mini-") ((eq? libc mini-libc-mes.hex2) "mini-")
(else "")) "guile") #:exit exit))) (else "")) "guile") #:exit exit)))
(add-target (compile.gcc "mlibc/crt1.c" #:libc #f)) (add-target (compile.gcc "lib/crt1.c" #:libc #f))
(add-target (compile.gcc "mlibc/libc-gcc.c" #:libc #f)) (add-target (compile.gcc "lib/libc-gcc.c" #:libc #f))
(add-target (compile.gcc "mlibc/libc-gcc+tcc.c" #:libc #f)) (add-target (compile.gcc "lib/libc-gcc+tcc.c" #:libc #f))
;;(add-scaffold-test "t" #:libc mini-libc-mes.hex2) ;;(add-scaffold-test "t" #:libc mini-libc-mes.hex2)
(add-scaffold-test "t") (add-scaffold-test "t")
@ -253,8 +253,8 @@ exec ${GUILE-guile} --no-auto-compile -L . -L guile -C . -C guile -s "$0" ${1+"$
(add-target (group "check-scaffold-tests" #:dependencies (filter (target-prefix? "check-scaffold/tests") %targets))) (add-target (group "check-scaffold-tests" #:dependencies (filter (target-prefix? "check-scaffold/tests") %targets)))
(add-target (cpp.mescc "mlibc/libc-mes+tcc.c")) (add-target (cpp.mescc "lib/libc-mes+tcc.c"))
(add-target (compile.mescc "mlibc/libc-mes+tcc.c")) (add-target (compile.mescc "lib/libc-mes+tcc.c"))
(define* (add-tcc-test name) (define* (add-tcc-test name)
(add-target (bin.gcc (string-append "scaffold/tinycc/" name ".c") #:libc libc-gcc.mlibc-o #:includes '("scaffold/tinycc"))) (add-target (bin.gcc (string-append "scaffold/tinycc/" name ".c") #:libc libc-gcc.mlibc-o #:includes '("scaffold/tinycc")))
@ -593,54 +593,54 @@ exec ${GUILE-guile} --no-auto-compile -L . -L guile -C . -C guile -s "$0" ${1+"$
((install-guile-dir #:dir (string-append %godir)) f)) ((install-guile-dir #:dir (string-append %godir)) f))
%go-files) %go-files)
(add-target (install "mlibc/crt1.hex2" #:dir "lib")) (add-target (install "lib/crt1.hex2" #:dir "lib"))
(add-target (install "mlibc/libc-mes.M1" #:dir "lib")) (add-target (install "lib/libc-mes.M1" #:dir "lib"))
(add-target (install "mlibc/libc-mes.hex2" #:dir "lib")) (add-target (install "lib/libc-mes.hex2" #:dir "lib"))
(add-target (install "mlibc/libc-mes+tcc.M1" #:dir "lib")) (add-target (install "lib/libc-mes+tcc.M1" #:dir "lib"))
(add-target (install "mlibc/libc-mes+tcc.hex2" #:dir "lib")) (add-target (install "lib/libc-mes+tcc.hex2" #:dir "lib"))
(add-target (install "mlibc/mini-libc-mes.M1" #:dir "lib")) (add-target (install "lib/mini-libc-mes.M1" #:dir "lib"))
(add-target (install "mlibc/mini-libc-mes.hex2" #:dir "lib")) (add-target (install "lib/mini-libc-mes.hex2" #:dir "lib"))
(add-target (install "mlibc/crt1.mlibc-o" #:dir "lib")) (add-target (install "lib/crt1.mlibc-o" #:dir "lib"))
(add-target (install "mlibc/libc-gcc.mlibc-o" #:dir "lib")) (add-target (install "lib/libc-gcc.mlibc-o" #:dir "lib"))
(add-target (install "mlibc/libc-gcc+tcc.mlibc-o" #:dir "lib")) (add-target (install "lib/libc-gcc+tcc.mlibc-o" #:dir "lib"))
(for-each (for-each
(lambda (f) (lambda (f)
((install-dir #:dir "share/") f)) ((install-dir #:dir "share/") f))
'("mlibc/include/alloca.h" '("include/alloca.h"
"mlibc/include/assert.h" "include/assert.h"
"mlibc/include/ctype.h" "include/ctype.h"
"mlibc/include/dlfcn.h" "include/dlfcn.h"
"mlibc/include/errno.h" "include/errno.h"
"mlibc/include/fcntl.h" "include/fcntl.h"
"mlibc/include/features.h" "include/features.h"
"mlibc/include/inttypes.h" "include/inttypes.h"
"mlibc/include/libgen.h" "include/libgen.h"
"mlibc/include/limits.h" "include/limits.h"
"mlibc/include/locale.h" "include/locale.h"
"mlibc/include/math.h" "include/math.h"
"mlibc/include/mlibc.h" "include/mlibc.h"
"mlibc/include/setjmp.h" "include/setjmp.h"
"mlibc/include/signal.h" "include/signal.h"
"mlibc/include/stdarg.h" "include/stdarg.h"
"mlibc/include/stdbool.h" "include/stdbool.h"
"mlibc/include/stdint.h" "include/stdint.h"
"mlibc/include/stdio.h" "include/stdio.h"
"mlibc/include/stdlib.h" "include/stdlib.h"
"mlibc/include/stdnoreturn.h" "include/stdnoreturn.h"
"mlibc/include/string.h" "include/string.h"
"mlibc/include/strings.h" "include/strings.h"
"mlibc/include/sys/cdefs.h" "include/sys/cdefs.h"
"mlibc/include/sys/mman.h" "include/sys/mman.h"
"mlibc/include/sys/stat.h" "include/sys/stat.h"
"mlibc/include/sys/time.h" "include/sys/time.h"
"mlibc/include/sys/timeb.h" "include/sys/timeb.h"
"mlibc/include/sys/types.h" "include/sys/types.h"
"mlibc/include/sys/ucontext.h" "include/sys/ucontext.h"
"mlibc/include/sys/wait.h" "include/sys/wait.h"
"mlibc/include/time.h" "include/time.h"
"mlibc/include/unistd.h")) "include/unistd.h"))
(for-each (for-each
(compose add-target (cut install <> #:dir "share/doc/mes")) (compose add-target (cut install <> #:dir "share/doc/mes"))

View File

@ -63,9 +63,9 @@
(define mes? (pair? (current-module))) (define mes? (pair? (current-module)))
(define* (c99-input->full-ast #:key (defines '()) (includes '())) (define* (c99-input->full-ast #:key (defines '()) (includes '()))
(let ((include (if (equal? %prefix "") "mlibc/include" (string-append %prefix "/share/mlibc/include")))) (let ((include (if (equal? %prefix "") "include" (string-append %prefix "/share/include"))))
(parse-c99 (parse-c99
#:inc-dirs (append includes (cons* include "mlibc/include" "mlibc" (or (and=> (getenv "C_INCLUDE_PATH") (cut string-split <> #\:)) '()))) #:inc-dirs (append includes (cons* include "include" "lib" (or (and=> (getenv "C_INCLUDE_PATH") (cut string-split <> #\:)) '())))
#:cpp-defs `( #:cpp-defs `(
"NULL=0" "NULL=0"
"__linux__=1" "__linux__=1"