From 4d1df9cbcb4a450c8cb095f2a963a119e7c06220 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sat, 3 Jun 2017 12:11:57 +0200 Subject: [PATCH] mescc: move include into share/mlibc, allows installing alongside gcc. * mlibc: Rename from libc. * HACKING: Update for name change. * make/bin.make: Likewise. * make/mescc-guile.make: Likewise. * make/mescc-mes.make: Likewise. * scaffold/scaffold.make: Likewise. * make/install.make: Likewise. (install): Install mlibc into share/mlibc. --- HACKING | 2 +- make/bin.make | 2 +- make/install.make | 6 +++--- make/mescc-guile.make | 10 +++++----- make/mescc-mes.make | 6 +++--- {libc => mlibc}/include/assert.h | 0 {libc => mlibc}/include/ctype.h | 0 {libc => mlibc}/include/dlfcn.h | 0 {libc => mlibc}/include/errno.h | 0 {libc => mlibc}/include/fcntl.h | 0 {libc => mlibc}/include/features.h | 0 {libc => mlibc}/include/inttypes.h | 0 {libc => mlibc}/include/limits.h | 0 {libc => mlibc}/include/math.h | 0 {libc => mlibc}/include/mlibc.h | 0 {libc => mlibc}/include/setjmp.h | 0 {libc => mlibc}/include/signal.h | 0 {libc => mlibc}/include/stdarg.h | 0 {libc => mlibc}/include/stdio.h | 0 {libc => mlibc}/include/stdlib.h | 0 {libc => mlibc}/include/string.h | 0 {libc => mlibc}/include/strings.h | 0 {libc => mlibc}/include/sys/cdefs.h | 0 {libc => mlibc}/include/sys/mman.h | 0 {libc => mlibc}/include/sys/stat.h | 0 {libc => mlibc}/include/sys/time.h | 0 {libc => mlibc}/include/sys/timeb.h | 0 {libc => mlibc}/include/sys/types.h | 0 {libc => mlibc}/include/sys/ucontext.h | 0 {libc => mlibc}/include/time.h | 0 {libc => mlibc}/include/unistd.h | 0 {libc => mlibc}/libc-gcc.c | 0 {libc => mlibc}/libc-mes.c | 0 {libc => mlibc}/mini-libc-mes.c | 0 module/language/c99/compiler.mes | 4 ++-- scaffold/scaffold.make | 8 ++++---- src/src.make | 2 +- 37 files changed, 20 insertions(+), 20 deletions(-) rename {libc => mlibc}/include/assert.h (100%) rename {libc => mlibc}/include/ctype.h (100%) rename {libc => mlibc}/include/dlfcn.h (100%) rename {libc => mlibc}/include/errno.h (100%) rename {libc => mlibc}/include/fcntl.h (100%) rename {libc => mlibc}/include/features.h (100%) rename {libc => mlibc}/include/inttypes.h (100%) rename {libc => mlibc}/include/limits.h (100%) rename {libc => mlibc}/include/math.h (100%) rename {libc => mlibc}/include/mlibc.h (100%) rename {libc => mlibc}/include/setjmp.h (100%) rename {libc => mlibc}/include/signal.h (100%) rename {libc => mlibc}/include/stdarg.h (100%) rename {libc => mlibc}/include/stdio.h (100%) rename {libc => mlibc}/include/stdlib.h (100%) rename {libc => mlibc}/include/string.h (100%) rename {libc => mlibc}/include/strings.h (100%) rename {libc => mlibc}/include/sys/cdefs.h (100%) rename {libc => mlibc}/include/sys/mman.h (100%) rename {libc => mlibc}/include/sys/stat.h (100%) rename {libc => mlibc}/include/sys/time.h (100%) rename {libc => mlibc}/include/sys/timeb.h (100%) rename {libc => mlibc}/include/sys/types.h (100%) rename {libc => mlibc}/include/sys/ucontext.h (100%) rename {libc => mlibc}/include/time.h (100%) rename {libc => mlibc}/include/unistd.h (100%) rename {libc => mlibc}/libc-gcc.c (100%) rename {libc => mlibc}/libc-mes.c (100%) rename {libc => mlibc}/mini-libc-mes.c (100%) diff --git a/HACKING b/HACKING index 3038bfb7..d9e40bd4 100644 --- a/HACKING +++ b/HACKING @@ -21,7 +21,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. i686-unknown-linux-gnu-gcc is used to compare hex/assembly, to test -the gcc variant of mlbic: libc/libc-gcc.c and steal ideas. +the gcc variant of mlbic: mlibc/libc-gcc.c and steal ideas. guile is used to develop mescc, the C compiler in Scheme that during bootstrapping will be executed by mes. diff --git a/make/bin.make b/make/bin.make index c57bd4bc..7d2c6373 100644 --- a/make/bin.make +++ b/make/bin.make @@ -12,7 +12,7 @@ endif CLEAN+=$(O_FILES) $(OUT)/$(TARGET) DIST-CLEAN+=$(D_FILES) -INCLUDES+=libc/include libc $(OUT)/$(DIR) +INCLUDES+=mlibc/include mlibc $(OUT)/$(DIR) $(OUT)/$(TARGET): ld:=$(CROSS)LD $(OUT)/$(TARGET): LD:=$(CROSS)$(LD) diff --git a/make/install.make b/make/install.make index 17535db3..9b608241 100644 --- a/make/install.make +++ b/make/install.make @@ -100,9 +100,9 @@ endif tar -cf- -C module $(INSTALL_GO_FILES:module/%=%)\ | tar -C $(DESTDIR)$(GODIR) -xf- mkdir -p $(DESTDIR)$(PREFIX)/lib - $(GIT_ARCHIVE_HEAD) libc/include \ - | tar -C $(DESTDIR)$(PREFIX) --strip=1 -xf- - cp out/libc/libc-mes.guile-o $(DESTDIR)$(PREFIX)/lib/libc-mes.o + $(GIT_ARCHIVE_HEAD) mlibc/include \ + | tar -C $(DESTDIR)$(PREFIX)/share -xf- + cp out/mlibc/libc-mes.guile-o $(DESTDIR)$(PREFIX)/lib/libc-mes.o release: tree-clean-p check dist git tag v$(VERSION) diff --git a/make/mescc-guile.make b/make/mescc-guile.make index f89e1601..76aa21d4 100644 --- a/make/mescc-guile.make +++ b/make/mescc-guile.make @@ -1,7 +1,7 @@ ifneq ($(GUILE),) CROSS:=guile- -C_FILES:=libc/libc-mes.c $(C_FILES) -#C_FILES:=libc/mini-libc-mes.c $(C_FILES) +C_FILES:=mlibc/libc-mes.c $(C_FILES) +#C_FILES:=mlibc/mini-libc-mes.c $(C_FILES) O_FILES:=$(C_FILES:%.c=$(OUT)/%.$(CROSS)o) ifneq ($(DEBUG),) @@ -14,7 +14,7 @@ CLEAN+=$(O_FILES) $(OUT)/$(TARGET) CLEAN+=$(OUT)/$(TARGET) -INCLUDES+=libc/include libc $(OUT)/$(DIR) +INCLUDES+=mlibc/include mlibc $(OUT)/$(DIR) MESCC.scm:=guile/mescc.scm MESLD.scm:=guile/mescc.scm @@ -73,8 +73,8 @@ endef ifeq ($(MLIBC.scm),) MLIBC.scm:=DONE else -C_FILES:=$(filter-out libc/libc-mes.c,$(C_FILES)) -C_FILES:=$(filter-out libc/mini-libc-mes.c,$(C_FILES)) +C_FILES:=$(filter-out mlibc/libc-mes.c,$(C_FILES)) +C_FILES:=$(filter-out mlibc/mini-libc-mes.c,$(C_FILES)) endif ifneq ($(MESC_DIRECT),) diff --git a/make/mescc-mes.make b/make/mescc-mes.make index b6f49ac8..6f182f16 100644 --- a/make/mescc-mes.make +++ b/make/mescc-mes.make @@ -1,6 +1,6 @@ ifneq ($(MES),) CROSS:=mes- -C_FILES:=libc/libc-mes.c $(C_FILES) +C_FILES:=mlibc/libc-mes.c $(C_FILES) O_FILES:=$(C_FILES:%.c=$(OUT)/%.$(CROSS)o) ifneq ($(DEBUG),) @@ -13,7 +13,7 @@ CLEAN+=$(O_FILES) $(OUT)/$(TARGET) CLEAN+=$(OUT)/$(TARGET) -INCLUDES+=libc/include libc $(OUT)/$(DIR) +INCLUDES+=mlibc/include mlibc $(OUT)/$(DIR) MESCC.mes:=scripts/mescc.mes MESLD.mes:=scripts/mescc.mes @@ -84,7 +84,7 @@ endef ifeq ($(MLIBC.mes),) MLIBC.mes:=DONE else -C_FILES:=$(filter-out libc/libc-mes.c,$(C_FILES)) +C_FILES:=$(filter-out mlibc/libc-mes.c,$(C_FILES)) endif ifneq ($(MESC_DIRECT),) diff --git a/libc/include/assert.h b/mlibc/include/assert.h similarity index 100% rename from libc/include/assert.h rename to mlibc/include/assert.h diff --git a/libc/include/ctype.h b/mlibc/include/ctype.h similarity index 100% rename from libc/include/ctype.h rename to mlibc/include/ctype.h diff --git a/libc/include/dlfcn.h b/mlibc/include/dlfcn.h similarity index 100% rename from libc/include/dlfcn.h rename to mlibc/include/dlfcn.h diff --git a/libc/include/errno.h b/mlibc/include/errno.h similarity index 100% rename from libc/include/errno.h rename to mlibc/include/errno.h diff --git a/libc/include/fcntl.h b/mlibc/include/fcntl.h similarity index 100% rename from libc/include/fcntl.h rename to mlibc/include/fcntl.h diff --git a/libc/include/features.h b/mlibc/include/features.h similarity index 100% rename from libc/include/features.h rename to mlibc/include/features.h diff --git a/libc/include/inttypes.h b/mlibc/include/inttypes.h similarity index 100% rename from libc/include/inttypes.h rename to mlibc/include/inttypes.h diff --git a/libc/include/limits.h b/mlibc/include/limits.h similarity index 100% rename from libc/include/limits.h rename to mlibc/include/limits.h diff --git a/libc/include/math.h b/mlibc/include/math.h similarity index 100% rename from libc/include/math.h rename to mlibc/include/math.h diff --git a/libc/include/mlibc.h b/mlibc/include/mlibc.h similarity index 100% rename from libc/include/mlibc.h rename to mlibc/include/mlibc.h diff --git a/libc/include/setjmp.h b/mlibc/include/setjmp.h similarity index 100% rename from libc/include/setjmp.h rename to mlibc/include/setjmp.h diff --git a/libc/include/signal.h b/mlibc/include/signal.h similarity index 100% rename from libc/include/signal.h rename to mlibc/include/signal.h diff --git a/libc/include/stdarg.h b/mlibc/include/stdarg.h similarity index 100% rename from libc/include/stdarg.h rename to mlibc/include/stdarg.h diff --git a/libc/include/stdio.h b/mlibc/include/stdio.h similarity index 100% rename from libc/include/stdio.h rename to mlibc/include/stdio.h diff --git a/libc/include/stdlib.h b/mlibc/include/stdlib.h similarity index 100% rename from libc/include/stdlib.h rename to mlibc/include/stdlib.h diff --git a/libc/include/string.h b/mlibc/include/string.h similarity index 100% rename from libc/include/string.h rename to mlibc/include/string.h diff --git a/libc/include/strings.h b/mlibc/include/strings.h similarity index 100% rename from libc/include/strings.h rename to mlibc/include/strings.h diff --git a/libc/include/sys/cdefs.h b/mlibc/include/sys/cdefs.h similarity index 100% rename from libc/include/sys/cdefs.h rename to mlibc/include/sys/cdefs.h diff --git a/libc/include/sys/mman.h b/mlibc/include/sys/mman.h similarity index 100% rename from libc/include/sys/mman.h rename to mlibc/include/sys/mman.h diff --git a/libc/include/sys/stat.h b/mlibc/include/sys/stat.h similarity index 100% rename from libc/include/sys/stat.h rename to mlibc/include/sys/stat.h diff --git a/libc/include/sys/time.h b/mlibc/include/sys/time.h similarity index 100% rename from libc/include/sys/time.h rename to mlibc/include/sys/time.h diff --git a/libc/include/sys/timeb.h b/mlibc/include/sys/timeb.h similarity index 100% rename from libc/include/sys/timeb.h rename to mlibc/include/sys/timeb.h diff --git a/libc/include/sys/types.h b/mlibc/include/sys/types.h similarity index 100% rename from libc/include/sys/types.h rename to mlibc/include/sys/types.h diff --git a/libc/include/sys/ucontext.h b/mlibc/include/sys/ucontext.h similarity index 100% rename from libc/include/sys/ucontext.h rename to mlibc/include/sys/ucontext.h diff --git a/libc/include/time.h b/mlibc/include/time.h similarity index 100% rename from libc/include/time.h rename to mlibc/include/time.h diff --git a/libc/include/unistd.h b/mlibc/include/unistd.h similarity index 100% rename from libc/include/unistd.h rename to mlibc/include/unistd.h diff --git a/libc/libc-gcc.c b/mlibc/libc-gcc.c similarity index 100% rename from libc/libc-gcc.c rename to mlibc/libc-gcc.c diff --git a/libc/libc-mes.c b/mlibc/libc-mes.c similarity index 100% rename from libc/libc-mes.c rename to mlibc/libc-mes.c diff --git a/libc/mini-libc-mes.c b/mlibc/mini-libc-mes.c similarity index 100% rename from libc/mini-libc-mes.c rename to mlibc/mini-libc-mes.c diff --git a/module/language/c99/compiler.mes b/module/language/c99/compiler.mes index e6353464..aba55d30 100644 --- a/module/language/c99/compiler.mes +++ b/module/language/c99/compiler.mes @@ -54,9 +54,9 @@ (define mes? (pair? (current-module))) (define* (c99-input->full-ast #:key (defines '()) (includes '())) - (let ((include (if (equal? %prefix "") "libc/include" (string-append %prefix "/include")))) + (let ((include (if (equal? %prefix "") "mlibc/include" (string-append %prefix "/share/mlibc/include")))) (parse-c99 - #:inc-dirs (append includes (cons* "." "libc" "src" "out" "out/src" include (string-split (getenv "C_INCLUDE_PATH") #\:))) + #:inc-dirs (append includes (cons* "." "mlibc" "src" "out" "out/src" include (string-split (getenv "C_INCLUDE_PATH") #\:))) #:cpp-defs `( "POSIX=0" "_POSIX_SOURCE=0" diff --git a/scaffold/scaffold.make b/scaffold/scaffold.make index fbf28f9a..803f424b 100644 --- a/scaffold/scaffold.make +++ b/scaffold/scaffold.make @@ -1,7 +1,7 @@ TARGET:=m C_FILES:=$(DIR)/m.c DEFINES:=POSIX=1 -INCLUDES:=libc +INCLUDES:=mlibc include make/bin.make TARGET:=m @@ -11,7 +11,7 @@ include make/check.make TARGET:=hello C_FILES:=$(DIR)/hello.c DEFINES:=POSIX=1 -INCLUDES:=libc +INCLUDES:=mlibc include make/bin.make TARGET:=hello @@ -21,7 +21,7 @@ include make/check.make TARGET:=t C_FILES:=$(DIR)/t.c DEFINES:=POSIX=1 -INCLUDES:=libc +INCLUDES:=mlibc include make/bin.make TARGET:=t @@ -30,7 +30,7 @@ include make/check.make TARGET:=t-tcc C_FILES:=$(DIR)/t-tcc.c DEFINES:=POSIX=1 -INCLUDES:=libc +INCLUDES:=mlibc include make/bin.make TARGET:=t-tcc diff --git a/src/src.make b/src/src.make index 0cf248ea..1e49cbd0 100644 --- a/src/src.make +++ b/src/src.make @@ -22,7 +22,7 @@ snarf-gcc: $(SNARF.GCC) $(OUT)/$(DIR)/mes.o: $(SNARF.GCC) DEFINES:=FIXED_PRIMITIVES=1 MES_FULL=1 POSIX=1 VERSION='"$(VERSION)"' MODULEDIR='"$(MODULEDIR)"' PREFIX='"$(PREFIX)"' -INCLUDES:=libc $(OUT)/$(DIR) +INCLUDES:=mlibc $(OUT)/$(DIR) TARGET:=mes C_FILES:=$(DIR)/mes.c include make/bin.make