build: Skip gcc, mlibc, guile or mes builds using CC=, CC32=, GUILE= or MES=.

* GNUmakefile (build-scripts): New target
  (HELP_TOP): Mention it.
* configure (main): Write GUILE_FOR_BUILD.
* make/bin-mlibc.make: Skip if CC32 is not set.
* make/bin.make: Skip if CC is not set.
* make/install.make (install): Only install $(OUT)/mes.mes if
  MES_BOOTSTRAP is set.
* make/mescc-guile.make: Skip if GUILE is not set.
* make/mescc-mes.make: Skip if MES is not set.
* HACKING: write something about
This commit is contained in:
Jan Nieuwenhuizen 2017-05-28 18:32:53 +02:00
parent 9f56b8b102
commit 3a240221f0
10 changed files with 57 additions and 5 deletions

View File

@ -21,6 +21,15 @@ SUBDIRS:=\
include make/common.make
-include .local.make
build-scripts:
make --dry-run MES=$(OUT)/mes CC= CC32= GUILE= MES_BOOTSTRAP=1 > $(OUT)/make.sh
make --dry-run MES=$(OUT)/mes CC= CC32= GUILE= MES_BOOTSTRAP=1 | tail +$(wc -l make.sh) > $(OUT)/make-check.sh
make --dry-run MES=$(OUT)/mes CC= CC32= GUILE= MES_BOOTSTRAP=1 | tail +$(wc -l make.sh) > $(OUT)/make-install.sh
make --dry-run > $(OUT)/make-dev.sh
make --dry-run | tail +$(wc -l make.sh) > $(OUT)/make-dev-check.sh
make --dry-run | tail +$(wc -l make.sh) > $(OUT)/make-dev-install.sh
help: help-top
install: all
@ -34,6 +43,7 @@ Usage: make [OPTION]... [TARGET]...
Targets:
all update everything
build-scripts generate build scripts
check run unit tests
clean remove all generated stuff
dist create tarball in $(TARBALL)

34
HACKING
View File

@ -3,6 +3,40 @@
* SETUP
guix environment -l guix.scm #64 bit + 32bit
guix environment --system=i686-linux -l guix.scm #32 bit only
* BUILD
There are two major modes to build Mes: true bootstrap and
development.
** DEVELOPMENT BUILD
To help development we assume ./configure sets these variables for make
CC -- gcc
CC32 -- i686-unknown-linux-gnu-gcc (or on x86, also gcc)
GUILE -- guile
MES -- unset
Mes is supposed to serve as a full equivalent for GUILE, however mes is much, much
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.
guile is used to develop mescc, the C compiler in Scheme that during
bootstrapping will be executed by mes.
** BOOTSTRAP BUILD
In bootstrap mode, we don't have gcc (CC), we don't have pa 32 bit gcc
(CC32), we have no guile (GUILE)...but we should have a bootstrap mes
(MES). FIXME.
mes is built from src/*.c and some out/src/*.h files that are snarfed from
src/*.c by build-aux/mes-snarf.scm.
Also, during bootstrap we don't have make. Running `make build-scripts'
generates several recipies of sh build scripts in out/.
* ROADMAP
** TODO
*** release 0.x, unsorted

1
configure vendored
View File

@ -237,6 +237,7 @@ Usage: ./configure [OPTION]...
(stdout "CC:=~a\n" CC)
(stdout "CC32:=~a\n" CC32)
(stdout "GUILE:=~a\n" GUILE)
(stdout "GUILE_FOR_BUILD:=~a\n" GUILE)
(stdout "GUILE_EFFECTIVE_VERSION:=~a\n" GUILE_EFFECTIVE_VERSION)
(stdout "GUIX_P:=~a\n" (if guix? guix? ""))
(stdout "PACKAGE:=~a\n" PACKAGE)

View File

@ -1,5 +1,7 @@
ifneq ($(CC32),)
C_FLAGS:=-nostdinc -fno-builtin
LD_FLAGS:=-nostdlib
CROSS:=$(CC32:%gcc=%)
include make/bin.make
endif

View File

@ -1,3 +1,4 @@
ifneq ($(CC),)
O_FILES := $(C_FILES:%.c=$(OUT)/%.$(CROSS)o)
D_FILES := $(O_FILES:%o=%d)
@ -23,3 +24,4 @@ $(OUT)/$(TARGET): $(O_FILES)
$(QUIET)$(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@
include make/compile.make
endif

View File

@ -62,7 +62,7 @@ INSTALL_GO_FILES:=
install: $(CLEAN) ChangeLog
mkdir -p $(DESTDIR)$(PREFIX)/bin
install $(OUT)/mes $(DESTDIR)$(PREFIX)/bin/mes
ifeq (0,1) # No bootstrap mes.mes ATM
ifneq ($(MES_BOOTSTRAP),)
install $(OUT)/mes.mes $(DESTDIR)$(PREFIX)/bin/mes.mes
endif
install scripts/mescc.mes $(DESTDIR)$(PREFIX)/bin/mescc.mes

View File

@ -1,3 +1,4 @@
ifneq ($(GUILE),)
CROSS:=guile-
C_FILES:=libc/libc-mes.c $(C_FILES)
#C_FILES:=libc/mini-libc-mes.c $(C_FILES)
@ -83,4 +84,5 @@ $(foreach c-file,$(strip $(filter %.c,$(C_FILES))),$(eval $(call mescc.scm-c-pre
$(foreach c-file,$(strip $(filter %.c,$(C_FILES))),$(eval $(call mescc.scm-c-compile-E,$(c-file:%.c=$(OUT)/%.$(CROSS)E),$(DEFINES),$(INCLUDES))))
endif
endif
include make/reset.make

View File

@ -1,3 +1,4 @@
ifneq ($(MES),)
CROSS:=mes-
C_FILES:=libc/libc-mes.c $(C_FILES)
O_FILES:=$(C_FILES:%.c=$(OUT)/%.$(CROSS)o)
@ -93,4 +94,5 @@ $(foreach c-file,$(strip $(filter %.c,$(C_FILES))),$(eval $(call mescc.mes-c-pre
$(foreach c-file,$(strip $(filter %.c,$(C_FILES))),$(eval $(call mescc.mes-c-compile-E,$(c-file:%.c=$(OUT)/%.$(CROSS)E),$(DEFINES),$(INCLUDES))))
endif
endif
include make/reset.make

View File

@ -94,7 +94,7 @@ TARGET:=t.guile
include make/check.make
# scripts/mescc.mes
ifeq ($(MES_SKIP_MES),)
ifneq ($(MES),)
TARGET:=m.mes
C_FILES:=$(DIR)/m.c
include make/mescc-mes.make
@ -103,7 +103,7 @@ TARGET:=m.mes
EXPECT:=255
include make/check.make
ifneq ($(SCAFFOLD),)
ifneq ($(MES_SCAFFOLD),)
TARGET:=hello.mes
C_FILES:=$(DIR)/hello.c
include make/mescc-mes.make

View File

@ -40,7 +40,6 @@ snarf-mes: $(SNARF.MES)
include make/reset.make
# TARGET:=$(CROSS)mes
CROSS:=$(CC32:%gcc=%)
$(OUT)/$(CROSS)%: $(OUT)/%.mlibc
@ln -sf $(<F) $@
@ -56,7 +55,7 @@ $(OUT)/mes.guile: $(SNARF.MES)
C_FILES:=$(DIR)/mes.c
include make/mescc-guile.make
ifeq (0,1) # No bootstrap mes.mes ATM
ifneq ($(MES_BOOTSTRAP),)
safe-MES_MAX_ARENA:=$(MES_MAX_ARENA)
MES_MAX_ARENA:=80000000
TARGET:=mes.mes