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
Targets:
all update everything
+ build-scripts generate build scripts
check run unit tests
clean remove all generated stuff
dist create tarball in $(TARBALL)
* 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
(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)
+ifneq ($(CC32),)
C_FLAGS:=-nostdinc -fno-builtin
LD_FLAGS:=-nostdlib
CROSS:=$(CC32:%gcc=%)
include make/bin.make
+endif
+ifneq ($(CC),)
O_FILES := $(C_FILES:%.c=$(OUT)/%.$(CROSS)o)
D_FILES := $(O_FILES:%o=%d)
$(QUIET)$(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@
include make/compile.make
+endif
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
+ifneq ($(GUILE),)
CROSS:=guile-
C_FILES:=libc/libc-mes.c $(C_FILES)
#C_FILES:=libc/mini-libc-mes.c $(C_FILES)
$(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
+ifneq ($(MES),)
CROSS:=mes-
C_FILES:=libc/libc-mes.c $(C_FILES)
O_FILES:=$(C_FILES:%.c=$(OUT)/%.$(CROSS)o)
$(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
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
EXPECT:=255
include make/check.make
-ifneq ($(SCAFFOLD),)
+ifneq ($(MES_SCAFFOLD),)
TARGET:=hello.mes
C_FILES:=$(DIR)/hello.c
include make/mescc-mes.make
include make/reset.make
-# TARGET:=$(CROSS)mes
CROSS:=$(CC32:%gcc=%)
$(OUT)/$(CROSS)%: $(OUT)/%.mlibc
@ln -sf $(<F) $@
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