build: Make build more autotools-like.

* build-aux/build.sh.in: Move from ./build.sh
* build-aux/check.sh.in: Likewise.
* build-aux/GNUmakefile.in: Likewise.
* build-aux/install.sh.in: Likewise.
* build-aux/uninstall.sh.in: Likewise.
* configure: Substitute them.
* configure.sh: Likewise.
* build-aux/build-cc.sh: Update: use ${srcdest} instead of ${top_builddest}.
* build-aux/build-cc32.sh: Likewise.
* build-aux/build-guile.sh: Likewise.
* build-aux/build-mes.sh: Likewise.
* build-aux/cc-mes.sh: Likewise.
* build-aux/cc.sh: Likewise.
* build-aux/cc32-mes.sh: Likewise.
* build-aux/check-boot.sh: Likewise.
* build-aux/check-mes.sh: Likewise.
* build-aux/check-mescc.sh: Likewise.
* build-aux/config.sh: Likewise.
* build-aux/export.make: Likewise.
* build-aux/mes-snarf.scm: Likewise.
* build-aux/pre-inst-env.in: Likewise.
* build-aux/test.sh: Likewise.
* build-aux/trace.sh: Likewise.
* module/mescc/mescc.scm: Likewise.
* scripts/mescc.in: Likewise.
* src/mes.c: Likewise.
* .gitignore: Likewise.
This commit is contained in:
Jan Nieuwenhuizen 2018-07-25 08:14:13 +02:00
parent 3140b0ed44
commit f18e1fea36
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
28 changed files with 607 additions and 641 deletions

6
.gitignore vendored
View file

@ -71,3 +71,9 @@
/mes/module/mes/boot-0.scm
/scripts/mescc
/doc/images/gcc-mesboot-graph.png
/GNUmakefile
/build.sh
/check.sh
/install.sh
/pre-inst-env
/uninstall.sh

View file

@ -1,309 +0,0 @@
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
# GNU Mes is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# GNU Mes is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
GUILE_FLAGS:=--no-auto-compile -L . -L module -C . -C module
cleaning-p:=$(filter clean%, $(MAKECMDGOALS))$(filter %clean, $(MAKECMDGOALS))
ifndef cleaning-p
ifndef config.make
config.make:=.config.make
include $(config.make)
$(config.make):
./configure --prefix=$(prefix)
endif
endif
PHONY_TARGETS:=\
${top_builddest}src/mes\
TAGS\
all-go\
all\
build\
check\
clean-go\
clean\
default\
dist\
distclean\
doc\
dvi\
gcc\
generate-ChangeLog\
help\
html\
info\
install-dvi\
install-html\
install-pdf\
install-ps\
install-strip\
install\
installcheck\
installdirs\
maintainer-clean\
man\
mes-gcc\
mes-tcc\
mes\
mostlyclean\
pdf\
ps\
uninstall\
#
.PHONY: $(PHONY_TARGETS)
default: all
all: build doc
build:
./build.sh
gcc:
build-aux/build-cc.sh
mes-gcc:
build-aux/build-cc32.sh
mes-tcc:
ifdef TCC
CC32=$(TCC) build-aux/build-cc32.sh
else
$(warning skipping mes-tcc: no tcc)
endif
mes:
build-aux/build-mes.sh
clean:
git clean -dfx
# Mes does not cache anything on the file system; therefore clean
distclean: clean
mostlyclean: clean
maintainer-clean: clean
TAGS:
etags lib/*.c lib/*/*.c src/*.c include/*.h include/sys/*.h
all-go:
build-aux/build-guile.sh
clean-go:
rm -f $(shell find . -name '*.go')
check:
./check.sh
# Mes does not feature post-install checks yet, so we're great!
installcheck:
true
install: ${top_builddest}src/mes
./install.sh
uninstall:
./uninstall.sh
$(config.make): configure
seed: all-go mes-gcc mes-tcc
ifdef TCC
cd $(TINYCC_SEED) && MES_PREFIX=$(PWD) ./refresh.sh
endif
cd $(MES_SEED) && git reset --hard HEAD
MES=$(GUILE) GUILE=$(GUILE) SEED=1 build-aux/build-mes.sh
cd $(MES_SEED) && MES_PREFIX=$(PWD) ./refresh.sh
MES=$(GUILE) GUILE=$(GUILE) SEED=1 build-aux/build-mes.sh
cp lib/x86-mes/elf32-header.hex2\
lib/x86-mes/x86.M1\
lib/x86-mes/libc+tcc.S\
lib/x86-mes/libc.S\
lib/x86-mes/crt1.S\
lib/x86-mes/libgetopt.S\
$(MESCC_TOOLS_SEED)/libs
cd $(MESCC_TOOLS_SEED) && MES_PREFIX=$(PWD) ./bootstrap.sh
${top_builddest}doc/version.texi: doc/mes.texi GNUmakefile
@mkdir -p $(@D)
(set `LANG= date -r $< +'%d %B %Y'`;\
echo "@set UPDATED $$1 $$2 $$3"; \
echo "@set UPDATED-MONTH $$2 $$3"; \
echo "@set EDITION $(VERSION)"; \
echo "@set VERSION $(VERSION)") > $@
doc: ${top_builddest}doc/version.texi
ifdef MAKEINFO
doc: info
else
$(warning skipping info: no makeinfo)
endif
ifdef HELP2MAN
doc: man
else
$(warning skipping man: no help2man)
endif
info: ${top_builddest}doc/mes.info
${top_builddest}doc/mes.info: doc/mes.texi ${top_builddest}doc/version.texi doc/images/gcc-mesboot-graph.dot GNUmakefile
$(MAKEINFO) -o $@ -I ${top_builddest}doc -I doc $<
${top_builddest}doc/images/gcc-mesboot-graph.png: doc/images/gcc-mesboot-graph.dot
ifdef DOT
$(DOT) -T png $< > $@
else
touch $@
$(warning info: graphvis missing: no images)
endif
man: ${top_builddest}doc/mes.1 ${top_builddest}doc/mescc.1
${top_builddest}src/mes: build
${top_builddest}doc/mes.1: ${top_builddest}src/mes
MES_ARENA=10000000 ${top_builddir}/pre-inst-env $(HELP2MAN) $(<F) > $@
${top_builddest}doc/mescc.1: ${top_builddest}src/mes ${top_builddest}scripts/mescc
MES_ARENA=10000000 ${top_builddir}/pre-inst-env $(HELP2MAN) $(<F) > $@
html: ${top_builddest}doc/html/index.html
${top_builddest}doc/html/index.html: doc/mes.texi ${top_builddest}doc/version.texi ${top_builddest}doc/images/gcc-mesboot-graph.png
$(MAKEINFO) --html -o $(@D) -I ${top_builddest}doc -I doc $<
dvi: ${top_builddest}doc/mes.dvi
${top_builddest}doc/mes.dvi: doc/mes.texi
$(MAKEINFO) --dvi -I ${top_builddest}/doc -I doc -o doc/mes.dvi $<
pdf: ${top_builddest}doc/mes.pdf
${top_builddest}doc/mes.pdf: doc/mes.texi
$(MAKEINFO) --pdf -I ${top_builddest}/doc -I doc -o doc/mes.pdf $<
ps: ${top_builddest}doc/mes.ps
${top_builddest}doc/mes.ps: doc/mes.texi
$(MAKEINFO) --ps -I ${top_builddest}/doc -I doc -o doc/mes.ps $<
### dist
COMMIT=$(shell test -d .git && (git describe --dirty 2>/dev/null) || cat .tarball-version)
TARBALL_VERSION=$(COMMIT:v%=%)
TARBALL_DIR:=$(PACKAGE)-$(TARBALL_VERSION)
TARBALL:=${top_builddest}$(TARBALL_DIR).tar.gz
${top_builddest}.tarball-version:
echo $(COMMIT) > $@
GIT_ARCHIVE_HEAD:=git archive HEAD --
GIT_LS_FILES:=git ls-files
ifeq ($(wildcard .git),)
GIT_ARCHIVE_HEAD:=tar -cf-
GIT_LS_FILES:=find
endif
dist: $(TARBALL)
tree-clean-p:
test ! -d .git || git diff --exit-code > /dev/null
test ! -d .git || git diff --cached --exit-code > /dev/null
@echo commit:$(COMMIT)
generate-ChangeLog:
$(PERL) build-aux/gitlog-to-changelog --srcdir=${srcdir} > ChangeLog
$(TARBALL): ${top_builddest}.tarball-version | generate-ChangeLog
($(GIT_LS_FILES)\
--exclude=$(TARBALL_DIR);\
echo $^ | tr ' ' '\n')\
| GZIP=-n tar --sort=name --mtime=@0 --owner=0 --group=0 --numeric-owner\
--transform=s,^,$(TARBALL_DIR)/,S -T- -czf $@
git checkout ChangeLog
ifdef GUIX
update-hash: $(TARBALL)
$(GUIX) download file://$(PWD)/$<
sed -i -e 's,(base32 #!mes!# "[^"]*"),(base32 #!mes!# "$(shell $(GUIX) hash $<)"),' guix/git/mes.scm
else
$(warning update-hash: no guix)
endif
release: update-hash
./pre-inst-env $(GUIX) build mes@$(VERSION) --with-source=$(TARBALL)
installdirs: mkinstalldirs
mkdir -p\
$(DESTDIR)$(bindir)\
$(DESTDIR)$(datadir)\
$(DESTDIR)$(libdir)\
$(DESTDIR)$(infodir)\
$(DESTDIR)$(mandir)
install-dvi: dvi
mkdir -p $(DESTDIR)${docdir}
cp ${top_builddest}doc/mes.dvi $(DESTDIR)${docdir}
install-html: html
mkdir -p $(DESTDIR)${docdir}
tar -cf- -C ${top_builddest}doc html | tar -xf- -C $(DESTDIR)${docdir}
install-pdf: pdf
mkdir -p $(DESTDIR)${docdir}
cp ${top_builddest}doc/mes.pdf $(DESTDIR)${docdir}
install-ps: ps
mkdir -p $(DESTDIR)${docdir}
cp ${top_builddest}doc/mes.ps $(DESTDIR)${docdir}
# We do not strip binaries, binutils' strip corrupts M1+hex2-generated ELFs
install-strip: install
define HELP_TOP
Usage: make [OPTION]... [TARGET]...
Main and non-standard targets:
all update everything
all-go update .go files
gcc update src/mes.gcc-out
dist update $(TARBALL)
doc update documentation
mes-gcc update src/mes.mes-gcc-out
mes-tcc update src/mes.mes-tcc-out
mes update src/mes
check run unit tests
clean run git clean -dfx
clean-go clean .go files
info update info documentation
install install in $(prefix)
install-info install info docs in $(prefix)/share/info
release dist and tag
seed update mes-seed in $(MES_SEED)
uninstall uninstall from $(prefix)
endef
export HELP_TOP
help:
@echo "$$HELP_TOP"
include build-aux/export.make

View file

@ -16,8 +16,24 @@
# You should have received a copy of the GNU General Public License
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
SHELL=@BASH@
srcdest=@srcdest@
srcdir=@srcdir@
abs_top_srcdir=@abs_top_srcdir@
abs_top_builddir=@abs_top_builddir@
GUILE_FLAGS:=--no-auto-compile -L . -L module -C . -C module
cleaning-p:=$(filter clean%, $(MAKECMDGOALS))$(filter %clean, $(MAKECMDGOALS))
ifndef cleaning-p
include .config.make
.config.make:
${srcdir}/configure --prefix=$(prefix)
endif
PHONY_TARGETS:=\
${top_builddest}src/mes\
src/mes\
TAGS\
all-go\
all\
@ -58,17 +74,248 @@ PHONY_TARGETS:=\
default: all
cleaning-p:=$(filter clean%, $(MAKECMDGOALS))$(filter %clean, $(MAKECMDGOALS))
all: build doc
ifndef cleaning-p
$(PHONY_TARGETS):
$(MAKE) -C $(srcdir) $@
build:
./build.sh
gcc:
${srcdest}build-aux/build-cc.sh
mes-gcc:
${srcdest}build-aux/build-cc32.sh
mes-tcc:
ifdef TCC
CC32=$(TCC) ${srcdest}build-aux/build-cc32.sh
else
$(warning skipping mes-tcc: no tcc)
endif
mes:
${srcdest}build-aux/build-mes.sh
clean:
git clean -dfx\
-e GNUmakefile\
-e build.sh\
-e check.sh\
-e install.sh\
-e pre-inst-env\
-e uninstall.sh\
#
# Mes does not cache anything on the file system; therefore clean
distclean:
git clean -dfX
mostlyclean: clean
maintainer-clean:
git clean -dfx
TAGS:
etags ${srcdest}lib/*.c ${srcdest}lib/*/*.c ${srcdest}src/*.c ${srcdest}include/*.h ${srcdest}include/sys/*.h
include .config.make
config.make:=$(PWD)/.config.make
include $(srcdir)/build-aux/export.make
all-go:
${srcdest}build-aux/build-guile.sh
clean-go:
rm -f $(shell find . -name '*.go')
check:
./check.sh
# Mes does not feature post-install checks yet, so we're great!
installcheck:
true
install: src/mes
./install.sh
uninstall:
./uninstall.sh
seed: all-go mes-gcc mes-tcc
ifdef TCC
cd $(TINYCC_SEED) && MES_PREFIX=$(PWD) ./refresh.sh
endif
cd $(MES_SEED) && git reset --hard HEAD
MES=$(GUILE) GUILE=$(GUILE) SEED=1 ${srcdest}build-aux/build-mes.sh
cd $(MES_SEED) && MES_PREFIX=$(PWD) ./refresh.sh
MES=$(GUILE) GUILE=$(GUILE) SEED=1 ${srcdest}build-aux/build-mes.sh
cp lib/x86-mes/elf32-header.hex2\
lib/x86-mes/x86.M1\
lib/x86-mes/libc+tcc.S\
lib/x86-mes/libc.S\
lib/x86-mes/crt1.S\
lib/x86-mes/libgetopt.S\
$(MESCC_TOOLS_SEED)/libs
cd $(MESCC_TOOLS_SEED) && MES_PREFIX=$(PWD) ./bootstrap.sh
doc/version.texi: doc/mes.texi GNUmakefile
@mkdir -p $(@D)
(set `LANG= date -r $< +'%d %B %Y'`;\
echo "@set UPDATED $$1 $$2 $$3"; \
echo "@set UPDATED-MONTH $$2 $$3"; \
echo "@set EDITION $(VERSION)"; \
echo "@set VERSION $(VERSION)") > $@
doc: doc/version.texi
ifdef MAKEINFO
doc: info
else
$(warning skipping info: no makeinfo)
endif
ifdef HELP2MAN
doc: man
else
$(warning skipping man: no help2man)
endif
info: doc/mes.info
doc/mes.info: ${srcdest}doc/mes.texi doc/version.texi ${srcdest}doc/images/gcc-mesboot-graph.dot GNUmakefile
$(MAKEINFO) -o $@ -I doc -I doc $<
doc/images/gcc-mesboot-graph.png: ${srcdest}doc/images/gcc-mesboot-graph.dot
ifdef DOT
$(DOT) -T png $< > $@
else
touch $@
$(warning info: graphvis missing: no images)
endif
man: doc/mes.1 doc/mescc.1
src/mes: build
doc/mes.1: src/mes
MES_ARENA=10000000 ./pre-inst-env $(HELP2MAN) $(<F) > $@
doc/mescc.1: src/mes scripts/mescc
MES_ARENA=10000000 ./pre-inst-env $(HELP2MAN) $(<F) > $@
html: doc/html/index.html
doc/html/index.html: ${srcdest}doc/mes.texi doc/version.texi doc/images/gcc-mesboot-graph.png
$(MAKEINFO) --html -o $(@D) -I ${srcdest}doc -I doc $<
dvi: doc/mes.dvi
doc/mes.dvi: ${srcdest}doc/mes.texi
$(MAKEINFO) --dvi -I ${srcdest}doc -I doc -o doc/mes.dvi $<
pdf: doc/mes.pdf
doc/mes.pdf: ${srcdest}doc/mes.texi
$(MAKEINFO) --pdf -I ${srcdest}doc -I doc -o doc/mes.pdf $<
ps: doc/mes.ps
doc/mes.ps: ${srcdest}doc/mes.texi
$(MAKEINFO) --ps -I ${srcdest}doc -I doc -o doc/mes.ps $<
### dist
COMMIT=$(shell test -d ${srcdest}.git && (cd ${srcdir} && git describe --dirty 2>/dev/null) || cat ${srcdest}.tarball-version)
TARBALL_VERSION=$(COMMIT:v%=%)
TARBALL_DIR:=$(PACKAGE)-$(TARBALL_VERSION)
TARBALL:=$(TARBALL_DIR).tar.gz
.tarball-version:
echo $(COMMIT) > $@
GIT_ARCHIVE_HEAD:=git archive HEAD --
GIT_LS_FILES:=git ls-files
ifeq ($(wildcard .git),)
GIT_ARCHIVE_HEAD:=tar -cf-
GIT_LS_FILES:=find
endif
dist: $(TARBALL)
tree-clean-p:
test ! -d .git || git diff --exit-code > /dev/null
test ! -d .git || git diff --cached --exit-code > /dev/null
@echo commit:$(COMMIT)
generate-ChangeLog:
$(PERL) ${srcdest}build-aux/gitlog-to-changelog --srcdir=${srcdir} > ChangeLog
$(TARBALL): .tarball-version | generate-ChangeLog
($(GIT_LS_FILES)\
--exclude=$(TARBALL_DIR);\
echo $^ | tr ' ' '\n')\
| GZIP=-n tar --sort=name --mtime=@0 --owner=0 --group=0 --numeric-owner\
--transform=s,^,$(TARBALL_DIR)/,S -T- -czf $@
git checkout ChangeLog
ifdef GUIX
update-hash: $(TARBALL)
$(GUIX) download file://$(PWD)/$<
sed -i -e 's,(base32 #!mes!# "[^"]*"),(base32 #!mes!# "$(shell $(GUIX) hash $<)"),' guix/git/mes.scm
else
$(warning update-hash: no guix)
endif
release: update-hash
./pre-inst-env $(GUIX) build mes@$(VERSION) --with-source=$(TARBALL)
installdirs: mkinstalldirs
mkdir -p\
$(DESTDIR)$(bindir)\
$(DESTDIR)$(datadir)\
$(DESTDIR)$(libdir)\
$(DESTDIR)$(infodir)\
$(DESTDIR)$(mandir)
install-dvi: dvi
mkdir -p $(DESTDIR)${docdir}
cp doc/mes.dvi $(DESTDIR)${docdir}
install-html: html
mkdir -p $(DESTDIR)${docdir}
tar -cf- -C doc html | tar -xf- -C $(DESTDIR)${docdir}
install-pdf: pdf
mkdir -p $(DESTDIR)${docdir}
cp doc/mes.pdf $(DESTDIR)${docdir}
install-ps: ps
mkdir -p $(DESTDIR)${docdir}
cp doc/mes.ps $(DESTDIR)${docdir}
# We do not strip binaries, binutils' strip corrupts M1+hex2-generated ELFs
install-strip: install
define HELP_TOP
Usage: make [OPTION]... [TARGET]...
Main and non-standard targets:
all update everything
all-go update .go files
gcc update src/mes.gcc-out
dist update $(TARBALL)
doc update documentation
mes-gcc update src/mes.mes-gcc-out
mes-tcc update src/mes.mes-tcc-out
mes update src/mes
check run unit tests
clean run git clean -dfx
clean-go clean .go files
info update info documentation
install install in $(prefix)
install-info install info docs in $(prefix)/share/info
release dist and tag
seed update mes-seed in $(MES_SEED)
uninstall uninstall from $(prefix)
endef
export HELP_TOP
help:
@echo "$$HELP_TOP"
include ${srcdest}build-aux/export.make

View file

@ -20,16 +20,16 @@
set -e
. build-aux/config.sh
. build-aux/trace.sh
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
trace "SNARF gc.c" build-aux/mes-snarf.scm src/gc.c
trace "SNARF lib.c" build-aux/mes-snarf.scm src/lib.c
trace "SNARF math.c" build-aux/mes-snarf.scm src/math.c
trace "SNARF mes.c" build-aux/mes-snarf.scm src/mes.c
trace "SNARF posix.c" build-aux/mes-snarf.scm src/posix.c
trace "SNARF reader.c" build-aux/mes-snarf.scm src/reader.c
trace "SNARF vector.c" build-aux/mes-snarf.scm src/vector.c
trace "SNARF gc.c" ${srcdest}build-aux/mes-snarf.scm src/gc.c
trace "SNARF lib.c" ${srcdest}build-aux/mes-snarf.scm src/lib.c
trace "SNARF math.c" ${srcdest}build-aux/mes-snarf.scm src/math.c
trace "SNARF mes.c" ${srcdest}build-aux/mes-snarf.scm src/mes.c
trace "SNARF posix.c" ${srcdest}build-aux/mes-snarf.scm src/posix.c
trace "SNARF reader.c" ${srcdest}build-aux/mes-snarf.scm src/reader.c
trace "SNARF vector.c" ${srcdest}build-aux/mes-snarf.scm src/vector.c
ARCHDIR=1 NOLINK=1 sh build-aux/cc.sh lib/libmes
sh build-aux/cc.sh src/mes
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc.sh lib/libmes
sh ${srcdest}build-aux/cc.sh src/mes

View file

@ -20,47 +20,47 @@
set -e
. build-aux/config.sh
. build-aux/trace.sh
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
LIBC=${LIBC-c}
##moduledir=${moduledir-${datadir}${datadir:+/}module}
# trace "SNARF gc.c" build-aux/mes-snarf.scm src/gc.c
# trace "SNARF lib.c" build-aux/mes-snarf.scm src/lib.c
# trace "SNARF math.c" build-aux/mes-snarf.scm src/math.c
# trace "SNARF mes.c" build-aux/mes-snarf.scm src/mes.c
# trace "SNARF posix.c" build-aux/mes-snarf.scm src/posix.c
# trace "SNARF reader.c" build-aux/mes-snarf.scm src/reader.c
# trace "SNARF vector.c" build-aux/mes-snarf.scm src/vector.c
# trace "SNARF gc.c" ${srcdest}build-aux/mes-snarf.scm src/gc.c
# trace "SNARF lib.c" ${srcdest}build-aux/mes-snarf.scm src/lib.c
# trace "SNARF math.c" ${srcdest}build-aux/mes-snarf.scm src/math.c
# trace "SNARF mes.c" ${srcdest}build-aux/mes-snarf.scm src/mes.c
# trace "SNARF posix.c" ${srcdest}build-aux/mes-snarf.scm src/posix.c
# trace "SNARF reader.c" ${srcdest}build-aux/mes-snarf.scm src/reader.c
# trace "SNARF vector.c" ${srcdest}build-aux/mes-snarf.scm src/vector.c
trace "MSNARF gc.c" build-aux/mes-snarf.scm --mes src/gc.c
trace "MSNARF lib.c" build-aux/mes-snarf.scm --mes src/lib.c
trace "MSNARF math.c" build-aux/mes-snarf.scm --mes src/math.c
trace "MSNARF mes.c" build-aux/mes-snarf.scm --mes src/mes.c
trace "MSNARF posix.c" build-aux/mes-snarf.scm --mes src/posix.c
trace "MSNARF reader.c" build-aux/mes-snarf.scm --mes src/reader.c
trace "MSNARF vector.c" build-aux/mes-snarf.scm --mes src/vector.c
trace "MSNARF gc.c" ${srcdest}build-aux/mes-snarf.scm --mes src/gc.c
trace "MSNARF lib.c" ${srcdest}build-aux/mes-snarf.scm --mes src/lib.c
trace "MSNARF math.c" ${srcdest}build-aux/mes-snarf.scm --mes src/math.c
trace "MSNARF mes.c" ${srcdest}build-aux/mes-snarf.scm --mes src/mes.c
trace "MSNARF posix.c" ${srcdest}build-aux/mes-snarf.scm --mes src/posix.c
trace "MSNARF reader.c" ${srcdest}build-aux/mes-snarf.scm --mes src/reader.c
trace "MSNARF vector.c" ${srcdest}build-aux/mes-snarf.scm --mes src/vector.c
ARCHDIR=1 NOLINK=1 sh build-aux/cc32-mes.sh lib/linux/crt0
ARCHDIR=1 NOLINK=1 sh build-aux/cc32-mes.sh lib/linux/crt1
ARCHDIR=1 NOLINK=1 sh build-aux/cc32-mes.sh lib/linux/crti
ARCHDIR=1 NOLINK=1 sh build-aux/cc32-mes.sh lib/linux/crtn
ARCHDIR=1 NOLINK=1 sh build-aux/cc32-mes.sh lib/libc-mini
ARCHDIR=1 NOLINK=1 sh build-aux/cc32-mes.sh lib/libc
ARCHDIR=1 NOLINK=1 sh build-aux/cc32-mes.sh lib/libgetopt
ARCHDIR=1 NOLINK=1 sh build-aux/cc32-mes.sh lib/libc+tcc
ARCHDIR=1 NOLINK=1 sh build-aux/cc32-mes.sh lib/libtcc1
ARCHDIR=1 NOLINK=1 sh build-aux/cc32-mes.sh lib/libc+gnu
ARCHDIR=1 NOLINK=1 sh build-aux/cc32-mes.sh lib/libg
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc32-mes.sh lib/linux/crt0
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc32-mes.sh lib/linux/crt1
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc32-mes.sh lib/linux/crti
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc32-mes.sh lib/linux/crtn
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc32-mes.sh lib/libc-mini
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc32-mes.sh lib/libc
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc32-mes.sh lib/libgetopt
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc32-mes.sh lib/libc+tcc
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc32-mes.sh lib/libtcc1
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc32-mes.sh lib/libc+gnu
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc32-mes.sh lib/libg
# sh build-aux/cc32-mes.sh scaffold/main
# sh build-aux/cc32-mes.sh scaffold/hello
# sh build-aux/cc32-mes.sh scaffold/argv
# sh build-aux/cc32-mes.sh scaffold/malloc
# sh build-aux/cc32-mes.sh scaffold/micro-mes
# sh build-aux/cc32-mes.sh scaffold/tiny-mes
# sh build-aux/cc32-mes.sh scaffold/mini-mes
# sh ${srcdest}build-aux/cc32-mes.sh scaffold/main
# sh ${srcdest}build-aux/cc32-mes.sh scaffold/hello
# sh ${srcdest}build-aux/cc32-mes.sh scaffold/argv
# sh ${srcdest}build-aux/cc32-mes.sh scaffold/malloc
# sh ${srcdest}build-aux/cc32-mes.sh scaffold/micro-mes
# sh ${srcdest}build-aux/cc32-mes.sh scaffold/tiny-mes
# sh ${srcdest}build-aux/cc32-mes.sh scaffold/mini-mes
sh build-aux/cc32-mes.sh src/mes
sh ${srcdest}build-aux/cc32-mes.sh src/mes

View file

@ -18,7 +18,7 @@
# You should have received a copy of the GNU General Public License
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
. build-aux/trace.sh
. ${srcdest}build-aux/trace.sh
export GUILE
export GUILE_AUTO_COMPILE
@ -29,37 +29,38 @@ GUILE_AUTO_COMPILE=0
set -e
SCM_FILES="
module/mes/getopt-long.scm
module/mes/guile.scm
module/mes/misc.scm
module/mes/test.scm
module/mescc/M1.scm
module/mescc/as.scm
module/mescc/bytevectors.scm
module/mescc/compile.scm
module/mescc/i386/as.scm
module/mescc/info.scm
module/mescc/mescc.scm
module/mescc/preprocess.scm
${srcdest}module/mes/getopt-long.scm
${srcdest}module/mes/guile.scm
${srcdest}module/mes/misc.scm
${srcdest}module/mes/test.scm
${srcdest}module/mescc/M1.scm
${srcdest}module/mescc/as.scm
${srcdest}module/mescc/bytevectors.scm
${srcdest}module/mescc/compile.scm
${srcdest}module/mescc/i386/as.scm
${srcdest}module/mescc/info.scm
${srcdest}module/mescc/mescc.scm
${srcdest}module/mescc/preprocess.scm
"
SCRIPTS="
build-aux/mes-snarf.scm
scripts/mescc
${srcdest}build-aux/mes-snarf.scm
${srcdest}scripts/mescc
"
export srcdir=.
export host=$($GUILE -c "(display %host-type)")
abs=$srcdest
if [ "$GUILE_EFFECTIVE_VERSION" = "2.0" ]; then
abs=$PWD/
srcdest=$abs_top_srcdir/
fi
GUILE_AUTO_COMPILE=0
for i in $SCM_FILES $SCRIPTS; do
go=${top_builddest}${i%%.scm}.go
b=$(basename $i)
go=${i%%.scm}.go
if [ $i -nt $go ]; then
trace "GUILEC $i" $GUILE_TOOLS compile -L ${abs}module -L ${abs}/build-aux -L ${abs}scripts -o $go $i
trace "GUILEC $b" $GUILE_TOOLS compile -L ${srcdest}module -L ${srcdest}build-aux -L ${srcdest}scripts -o $go $i
fi
done

View file

@ -18,62 +18,63 @@
# You should have received a copy of the GNU General Public License
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
. build-aux/config.sh
. build-aux/trace.sh
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
GUILE=${GUILE-guile}
if [ -z "$GUILE" -o "$GUILE" = "true" ] || ! command -v $GUILE > /dev/null; then
GUILE=src/mes
fi
[ -z "$MESCC" ] && MESCC=${top_builddest}scripts/mescc
[ -z "$MESCC" ] && MESCC=scripts/mescc
MES=${MES-$(command -v mes)}
[ -z "$MES" ] && MES=${top_builddest}src/mes
[ -z "$MES" ] && MES=src/mes
set -e
if [ -d "$MES_SEED" ]; then
mkdir -p lib/x86-mes
trace "M1 crt1.S" $M1\
$M1FLAGS\
-f lib/x86-mes/x86.M1\
-f ${srcdest}lib/x86-mes/x86.M1\
-f $MES_SEED/x86-mes/crt1.S\
-o ${top_builddest}lib/x86-mes/crt1.o
-o lib/x86-mes/crt1.o
trace "M1 libc.S" $M1\
$M1FLAGS\
-f lib/x86-mes/x86.M1\
-f ${srcdest}lib/x86-mes/x86.M1\
-f $MES_SEED/x86-mes/libc.S\
-o ${top_builddest}lib/x86-mes/libc.o
-o lib/x86-mes/libc.o
trace "M1 mes.S" $M1\
--LittleEndian\
--Architecture 1\
-f lib/x86-mes/x86.M1\
-f ${srcdest}lib/x86-mes/x86.M1\
-f $MES_SEED/x86-mes/mes.S\
-o ${top_builddest}src/mes.o
-o src/mes.o
trace "BLOOD_ELF mes.S" $BLOOD_ELF\
-f lib/x86-mes/x86.M1\
-f ${srcdest}lib/x86-mes/x86.M1\
-f $MES_SEED/x86-mes/mes.S\
-f $MES_SEED/x86-mes/libc.S\
-o ${top_builddest}src/mes.S.blood-elf
-o src/mes.S.blood-elf
trace "M1 mes.blood-elf" $M1\
--LittleEndian\
--Architecture 1\
-f ${top_builddest}src/mes.S.blood-elf\
-o ${top_builddest}src/mes.o.blood-elf
-f src/mes.S.blood-elf\
-o src/mes.o.blood-elf
trace "HEX2 mes.o" $HEX2\
$HEX2FLAGS\
-f lib/x86-mes/elf32-header.hex2\
-f ${top_builddest}lib/x86-mes/crt1.o\
-f ${top_builddest}lib/x86-mes/libc.o\
-f ${top_builddest}src/mes.o\
-f ${top_builddest}src/mes.o.blood-elf\
-f ${srcdest}lib/x86-mes/elf32-header.hex2\
-f lib/x86-mes/crt1.o\
-f lib/x86-mes/libc.o\
-f src/mes.o\
-f src/mes.o.blood-elf\
--exec_enable\
-o ${top_builddest}src/mes.seed-out
cp ${top_builddest}src/mes.seed-out ${top_builddest}src/mes
-o src/mes.seed-out
cp src/mes.seed-out src/mes
trace "M1 libc+tcc.S" $M1\
$M1FLAGS\
-f lib/x86-mes/x86.M1\
-f ${srcdest}lib/x86-mes/x86.M1\
-f $MES_SEED/x86-mes/libc+tcc.S\
-o ${top_builddest}lib/x86-mes/libc+tcc.o
-o lib/x86-mes/libc+tcc.o
fi
PREPROCESS=1
@ -85,36 +86,36 @@ if [ ! -d "$MES_SEED" ] \
fi
MES_ARENA=100000000
ARCHDIR=1 NOLINK=1 bash build-aux/cc-mes.sh lib/linux/crt0
ARCHDIR=1 NOLINK=1 bash build-aux/cc-mes.sh lib/linux/crt1
ARCHDIR=1 NOLINK=1 bash build-aux/cc-mes.sh lib/linux/crti
ARCHDIR=1 NOLINK=1 bash build-aux/cc-mes.sh lib/linux/crtn
ARCHDIR=1 NOLINK=1 bash build-aux/cc-mes.sh lib/libc-mini
ARCHDIR=1 NOLINK=1 bash build-aux/cc-mes.sh lib/libc
ARCHDIR=1 NOLINK=1 bash build-aux/cc-mes.sh lib/libgetopt
ARCHDIR=1 NOLINK=1 bash build-aux/cc-mes.sh lib/libc+tcc
ARCHDIR=1 NOLINK=1 bash build-aux/cc-mes.sh lib/libc+gnu
ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-mes.sh lib/linux/crt0
ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-mes.sh lib/linux/crt1
ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-mes.sh lib/linux/crti
ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-mes.sh lib/linux/crtn
ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-mes.sh lib/libc-mini
ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-mes.sh lib/libc
ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-mes.sh lib/libgetopt
ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-mes.sh lib/libc+tcc
ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-mes.sh lib/libc+gnu
[ -n "$SEED" ] && exit 0
MES_ARENA=${MES_ARENA-100000000}
trace "MSNARF gc.c" ${top_builddir}/pre-inst-env bash build-aux/mes-snarf.scm --mes src/gc.c
trace "MSNARF lib.c" ${top_builddir}/pre-inst-env bash build-aux/mes-snarf.scm --mes src/lib.c
trace "MSNARF math.c" ${top_builddir}/pre-inst-env bash build-aux/mes-snarf.scm --mes src/math.c
trace "MSNARF mes.c" ${top_builddir}/pre-inst-env bash build-aux/mes-snarf.scm --mes src/mes.c
trace "MSNARF posix.c" ${top_builddir}/pre-inst-env bash build-aux/mes-snarf.scm --mes src/posix.c
trace "MSNARF reader.c" ${top_builddir}/pre-inst-env bash build-aux/mes-snarf.scm --mes src/reader.c
trace "MSNARF vector.c" ${top_builddir}/pre-inst-env bash build-aux/mes-snarf.scm --mes src/vector.c
trace "MSNARF gc.c" ./pre-inst-env bash ${srcdest}build-aux/mes-snarf.scm --mes src/gc.c
trace "MSNARF lib.c" ./pre-inst-env bash ${srcdest}build-aux/mes-snarf.scm --mes src/lib.c
trace "MSNARF math.c" ./pre-inst-env bash ${srcdest}build-aux/mes-snarf.scm --mes src/math.c
trace "MSNARF mes.c" ./pre-inst-env bash ${srcdest}build-aux/mes-snarf.scm --mes src/mes.c
trace "MSNARF posix.c" ./pre-inst-env bash ${srcdest}build-aux/mes-snarf.scm --mes src/posix.c
trace "MSNARF reader.c" ./pre-inst-env bash ${srcdest}build-aux/mes-snarf.scm --mes src/reader.c
trace "MSNARF vector.c" ./pre-inst-env bash ${srcdest}build-aux/mes-snarf.scm --mes src/vector.c
echo MES_ARENA=$MES_ARENA
bash build-aux/cc-mes.sh scaffold/main
bash ${srcdest}build-aux/cc-mes.sh scaffold/main
bash build-aux/cc-mes.sh scaffold/main
bash build-aux/cc-mes.sh scaffold/hello
bash build-aux/cc-mes.sh scaffold/argv
bash build-aux/cc-mes.sh scaffold/malloc
##sh build-aux/cc-mes.sh scaffold/micro-mes
##sh build-aux/cc-mes.sh scaffold/tiny-mes
# bash build-aux/cc-mes.sh scaffold/mini-mes
bash build-aux/cc-mes.sh src/mes
cp ${top_builddest}src/mes.mes-out ${top_builddest}src/mes
bash ${srcdest}build-aux/cc-mes.sh scaffold/main
bash ${srcdest}build-aux/cc-mes.sh scaffold/hello
bash ${srcdest}build-aux/cc-mes.sh scaffold/argv
bash ${srcdest}build-aux/cc-mes.sh scaffold/malloc
##sh ${srcdest}build-aux/cc-mes.sh scaffold/micro-mes
##sh ${srcdest}build-aux/cc-mes.sh scaffold/tiny-mes
# bash ${srcdest}build-aux/cc-mes.sh scaffold/mini-mes
bash ${srcdest}build-aux/cc-mes.sh src/mes
cp src/mes.mes-out src/mes

View file

@ -1,4 +1,4 @@
#! /bin/sh
#! @BASH@
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
@ -18,30 +18,36 @@
# You should have received a copy of the GNU General Public License
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
. build-aux/config.sh
. build-aux/trace.sh
srcdest="@srcdest@"
srcdir="@srcdir@"
abs_top_srcdir="@abs_top_srcdir@"
abs_top_builddir="@abs_top_builddir@"
prefix=${prefix-@prefix@}
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
MES_SEED=${MES_SEED-../mes-seed}
GUILE=${GUILE-$(command -v guile)}
MES_ARENA=${MES_ARENA-100000000}
if [ -n "$GUILE" -a "$GUILE" != true ]; then
sh build-aux/build-guile.sh
sh ${srcdest}build-aux/build-guile.sh
fi
if [ -n "$CC" ]; then
sh build-aux/build-cc.sh
cp ${top_builddest}src/mes.gcc-out ${top_builddest}src/mes
sh ${srcdest}build-aux/build-cc.sh
cp src/mes.gcc-out src/mes
fi
if [ -n "$CC32" ]; then
sh build-aux/build-cc32.sh
cp ${top_builddest}src/mes.mes-gcc-out ${top_builddest}src/mes
sh ${srcdest}build-aux/build-cc32.sh
cp src/mes.mes-gcc-out src/mes
fi
if [ -n "$TCC" ]; then
CC32=$TCC sh build-aux/build-cc32.sh
cp ${top_builddest}src/mes.mes-tcc-out ${top_builddest}src/mes
CC32=$TCC sh ${srcdest}build-aux/build-cc32.sh
cp src/mes.mes-tcc-out src/mes
fi
sh build-aux/build-mes.sh
sh ${srcdest}build-aux/build-mes.sh

View file

@ -20,13 +20,13 @@
set -e
. build-aux/config.sh
. build-aux/trace.sh
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
MESCC=${MESCC-$(command -v mescc)}
[ -z "$MESCC" ] && MESCC=scripts/mescc
MES=${MES-$(command -v mes)}
[ -z "$MES" ] && MES=${top_builddest}src/mes
[ -z "$MES" ] && MES=src/mes
if [ "$V" = 2 ]; then
MES_CFLAGS="$MES_CFLAGS -v"
@ -37,31 +37,31 @@ c=$1
set -e
if [ -z "$ARCHDIR" ]; then
o="${top_builddest}$c"
d=${top_builddest}${c%%/*}
o="$c"
d=${c%%/*}
p="mes-"
else
b=${c##*/}
d=${top_builddest}${c%%/*}/x86-mes
d=${c%%/*}/x86-mes
o="$d/$b"
fi
mkdir -p $d
if [ -n "$PREPROCESS" ]; then
trace "MESCPP $c.c" ${top_builddir}/pre-inst-env bash $MESCC $MES_CPPFLAGS $MES_CFLAGS -E -o "$o.E" "$c".c
trace "MESCC $c.E" ${top_builddir}/pre-inst-env bash $MESCC $MES_CFLAGS -S "$o".E
trace "MESAS $c.S" ${top_builddir}/pre-inst-env bash $MESCC $MES_CFLAGS -c -o "$o".${p}o "$o".S
trace "MESCPP $c.c" ./pre-inst-env bash $MESCC $MES_CPPFLAGS $MES_CFLAGS -E -o "$o.E" "${srcdest}$c".c
trace "MESCC $c.E" ./pre-inst-env bash $MESCC $MES_CFLAGS -S "$o".E
trace "MESAS $c.S" ./pre-inst-env bash $MESCC $MES_CFLAGS -c -o "$o".${p}o "$o".S
if [ -z "$NOLINK" ]; then
trace "MESLD $c.o" ${top_builddir}/pre-inst-env bash $MESCC $MES_CFLAGS -o "$o".${p}out "$o".${p}o $MES_LIBS
trace "MESLD $c.o" ./pre-inst-env bash $MESCC $MES_CFLAGS -o "$o".${p}out "$o".${p}o $MES_LIBS
fi
elif [ -n "$COMPILE" ]; then
trace "MESCC $c.c" trace "MESCC $c.c" ${top_builddir}/pre-inst-env bash $MESCC $MES_CPPFLAGS $MES_CFLAGS -S -o "$o.S" "$c".c
trace "MESAS $c.S" ${top_builddir}/pre-inst-env bash $MESCC $MES_CFLAGS -c -o "$o".${p}o "$o".S
trace "MESCC $c.c" trace "MESCC $c.c" ./pre-inst-env bash $MESCC $MES_CPPFLAGS $MES_CFLAGS -S -o "$o.S" "${srcdest}$c".c
trace "MESAS $c.S" ./pre-inst-env bash $MESCC $MES_CFLAGS -c -o "$o".${p}o "$o".S
if [ -z "$NOLINK" ]; then
trace "MESLD $c.o" ${top_builddir}/pre-inst-env bash $MESCC $MES_CFLAGS -o "$o".${p}out "$o".${p}o $MES_LIBS
trace "MESLD $c.o" ./pre-inst-env bash $MESCC $MES_CFLAGS -o "$o".${p}out "$o".${p}o $MES_LIBS
fi
elif [ -z "$NOLINK" ]; then
trace "MESLD $c.c" ${top_builddir}/pre-inst-env bash $MESCC $MES_CPPFLAGS $MES_CFLAGS -o "$o".${p}out "$c".c $MES_LIBS
trace "MESLD $c.c" ./pre-inst-env bash $MESCC $MES_CPPFLAGS $MES_CFLAGS -o "$o".${p}out "${srcdest}$c".c $MES_LIBS
else
trace "MESCC $c.c" ${top_builddir}/pre-inst-env bash $MESCC $MES_CPPFLAGS $MES_CFLAGS -c -o "$o".${p}o "$c".c
trace "MESCC $c.c" ./pre-inst-env bash $MESCC $MES_CPPFLAGS $MES_CFLAGS -c -o "$o".${p}o "${srcdest}$c".c
fi

View file

@ -20,18 +20,18 @@
set -e
. build-aux/trace.sh
. build-aux/config.sh
. ${srcdest}build-aux/trace.sh
. ${srcdest}build-aux/config.sh
c=$1
if [ -z "$ARCHDIR" ]; then
o="${top_builddest}$c"
d=${top_builddest}${c%%/*}
o="$c"
d=${c%%/*}
p="gcc-"
else
b=${c##*/}
d=${top_builddest}${c%/*}/gcc
d=${c%/*}/gcc
o="$d/$b"
fi
mkdir -p $d
@ -45,7 +45,7 @@ trace "CC $c.c" $CC\
-D WITH_GLIBC=1\
-D POSIX=1\
-o "$o".${p}o\
"$c".c
"${srcdest}$c".c
if [ -z "$NOLINK" ]; then
trace "CCLD "$o".${p}out" $CC\
@ -55,5 +55,5 @@ if [ -z "$NOLINK" ]; then
$CFLAGS\
-o "$o".${p}out\
"$o".${p}o\
${top_builddest}lib/gcc/libmes.o
lib/gcc/libmes.o
fi

View file

@ -20,8 +20,8 @@
set -e
. build-aux/config.sh
. build-aux/trace.sh
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
a=mes-gcc
if [ "$CC32" = "$TCC" ]; then
@ -31,18 +31,18 @@ fi
arch=x86-$a
if [ -n "$LIBC" ]; then
CC32LIBS="${top_builddest}lib/$arch/lib$LIBC.o"
CC32LIBS="lib/$arch/lib$LIBC.o"
fi
c=$1
if [ -z "$ARCHDIR" ]; then
o="${top_builddest}$c"
d=${top_builddest}${c%%/*}
o="$c"
d=${c%%/*}
p="$a-"
else
b=${c##*/}
d=${top_builddest}${c%%/*}/$arch
d=${c%%/*}/$arch
o="$d/$b"
fi
mkdir -p $d
@ -52,14 +52,14 @@ trace "CC32 $c.c" $CC32\
$CC32_CPPFLAGS\
$CC32_CFLAGS\
-o "$o".${p}o\
"$c".c
"${srcdest}$c".c
if [ -z "$NOLINK" ]; then
trace "CCLD32 $c.c" $CC32\
$CC32_CPPFLAGS\
$CC32_CFLAGS\
-o "$o".${p}out\
${top_builddest}lib/$arch/crt1.o\
lib/$arch/crt1.o\
"$o".${p}o\
$CC32LIBS
fi

View file

@ -20,8 +20,8 @@
set -e
. build-aux/config.sh
. build-aux/trace.sh
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
export GUILE MES
MES=${MES-./src/mes}
@ -118,18 +118,18 @@ for i in $tests; do
echo ' [SKIP]'
continue;
fi
trace "TEST $i.guile" $GUILE -L module -C ${builddest}/module -L . <(echo '(use-modules (mes guile))'; cat scaffold/boot/$i)
trace "TEST $i.guile" $GUILE -L ${srcdest}module -C module -L . <(echo '(use-modules (mes guile))'; cat scaffold/boot/$i)
x=$(
if [ "$MES" = guile ]; then
true
elif [ -z "${i/5[0-9]-*/}" ]; then
cat scaffold/boot/$i | MES_BOOT=${srcdir}/boot-00.scm $MES 2>&1;
cat scaffold/boot/$i | MES_BOOT=${srcdest}boot-00.scm $MES 2>&1;
elif [ -z "${i/6[0-9]-*/}" ]; then
cat scaffold/boot/$i | MES_BOOT=${srcdir}/boot-01.scm $MES 2>&1;
cat scaffold/boot/$i | MES_BOOT=${srcdest}boot-01.scm $MES 2>&1;
else
MES_BOOT=${srcdir}/scaffold/boot/$i $MES 2>&1;
MES_BOOT=${srcdest}scaffold/boot/$i $MES 2>&1;
fi
) \
&& echo ' [PASS]' \
|| (r=$?; echo ' [FAIL]'; echo -e "$x"; echo ${top_builddest}scaffold/boot/$i; exit $r)
|| (r=$?; echo ' [FAIL]'; echo -e "$x"; echo scaffold/boot/$i; exit $r)
done

View file

@ -20,8 +20,8 @@
set -e
. build-aux/config.sh
. build-aux/trace.sh
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
if [ "$MES" = guile ]; then
mes=guile-
@ -60,7 +60,7 @@ tests/match.test
tests/psyntax.test
"
mkdir -p ${top_builddest}tests
mkdir -p tests
set +e
fail=0
total=0
@ -69,7 +69,7 @@ for t in $tests; do
echo $t: [SKIP];
continue
fi
${top_builddir}/pre-inst-env sh "$t" &> ${top_builddest}$t.${mes}log
${top_builddir}/pre-inst-env sh "$t" &> $t.${mes}log
r=$?
total=$((total+1))
if [ $r = 0 ]; then

View file

@ -19,11 +19,11 @@
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
set -e
. build-aux/config.sh
. build-aux/trace.sh
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
MES=${MES-src/mes}
[ -z "$MESCC" ] && MESCC=${top_builddest}scripts/mescc
[ -z "$MESCC" ] && MESCC=scripts/mescc
GUILE=${GUILE-guile}
MES_PREFIX=${MES_PREFIX-mes}
@ -32,9 +32,9 @@ M1=${M1-M1}
BLOOD_ELF=${BLOOD_ELF-blood-elf}
MES_SEED=${MES_SEED-../mes-seed}
MESCC=${MESCC-$(command -v mescc)}
[ -z "$MESCC" ] && MESCC=${top_builddest}scripts/mescc
[ -z "$MESCC" ] && MESCC=scripts/mescc
MES=${MES-$(command -v mes)}
[ -z "$MES" ] && MES=${top_builddest}src/mes
[ -z "$MES" ] && MES=src/mes
if ! command -v $GUILE > /dev/null; then
GUILE=true
@ -152,7 +152,7 @@ expect=$(echo $broken | wc -w)
pass=0
fail=0
total=0
mkdir -p ${top_builddest}scaffold/tests
mkdir -p scaffold/tests
for t in $tests; do
if [ -z "${t/[012][0-9]-*/}" ]; then
LIBC=c-mini
@ -167,7 +167,7 @@ for t in $tests; do
LIBC=c
MES_LIBS=
fi
sh build-aux/test.sh "scaffold/tests/$t" &> ${top_builddest}scaffold/tests/"$t".log
sh ${srcdest}build-aux/test.sh "scaffold/tests/$t" &> scaffold/tests/"$t".log
r=$?
total=$((total+1))
if [ $r = 0 ]; then
@ -280,13 +280,13 @@ MES_LIBS="-l c+gnu"
expect=$(echo $broken | wc -w)
ARGS="arg1 arg2 arg3 arg4 arg5"
export ARGS
mkdir -p ${top_builddest}scaffold/tinycc
mkdir -p scaffold/tinycc
for t in $tests; do
if [ ! -f scaffold/tinycc/"$t.c" ]; then
echo ' [SKIP]'
continue;
fi
sh build-aux/test.sh "scaffold/tinycc/$t" &> ${top_builddest}scaffold/tinycc/"$t".log
sh ${srcdest}build-aux/test.sh "scaffold/tinycc/$t" &> scaffold/tinycc/"$t".log
r=$?
total=$((total+1))
if [ $r = 0 ]; then

View file

@ -20,8 +20,14 @@
set -e
. build-aux/config.sh
. build-aux/trace.sh
srcdest="@srcdest@"
srcdir="@srcdir@"
abs_top_srcdir="@abs_top_srcdir@"
abs_top_builddir="@abs_top_builddir@"
prefix=${prefix-@prefix@}
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
GUILE=${GUILE-guile}
MES=${MES-src/mes}
@ -33,7 +39,7 @@ fi
set -e
[ "$GUILE" != true ] && MES=guile bash build-aux/check-mes.sh
[ "$MES" != guile ] && bash build-aux/check-mes.sh
bash build-aux/check-boot.sh
bash build-aux/check-mescc.sh
[ "$GUILE" != true ] && MES=guile bash ${srcdest}build-aux/check-mes.sh
[ "$MES" != guile ] && bash ${srcdest}build-aux/check-mes.sh
bash ${srcdest}build-aux/check-boot.sh
bash ${srcdest}build-aux/check-mescc.sh

View file

@ -16,11 +16,9 @@
# You should have received a copy of the GNU General Public License
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
top_builddir=${top_builddir-.}
if [ "$V" = 2 ]; then
echo $0
echo top_builddest=${top_builddest}
echo srcdest=${srcdest}
echo top_builddir=${top_builddir}
fi
@ -57,8 +55,8 @@ export abs_top_srcdir
export datadir
export moduledir
export prefix
export srcdest
export srcdir
export top_builddest
export top_builddir
MESCC=${MESCC-mescc}
@ -70,11 +68,10 @@ CC_CPPFLAGS=${CC_CPPFLAGS-"
-D 'VERSION=\"$VERSION\"'
-D 'MODULEDIR=\"$moduledir\"'
-D 'PREFIX=\"$prefix\"'
-D boo
-I ${top_builddest}src
-I src
-I lib
-I include
-I ${srcdest}src
-I ${srcdest}lib
-I ${srcdest}include
"}
CC_CFLAGS=${CC_CFLAGS-"
@ -87,10 +84,10 @@ CC32_CPPFLAGS=${CC32_CPPFLAGS-"
-D 'VERSION=\"$VERSION\"'
-D 'MODULEDIR=\"$moduledir\"'
-D 'PREFIX=\"$prefix\"'
-I ${top_builddest}src
-I src
-I lib
-I include
-I ${srcdest}src
-I ${srcdest}lib
-I ${srcdest}include
"}
CC32_CFLAGS=${CC32_CFLAGS-"
@ -114,10 +111,10 @@ MES_CPPFLAGS=${MES_CPPFLAGS-"
-D 'VERSION=\"$VERSION\"'
-D 'MODULEDIR=\"$moduledir\"'
-D 'PREFIX=\"$prefix\"'
-I ${top_builddest}src
-I src
-I lib
-I include
-I ${srcdest}src
-I ${srcdest}lib
-I ${srcdest}include
"}
MES_CFLAGS=${MES_CFLAGS-"

View file

@ -21,9 +21,9 @@ export VERSION
export abs_top_builddir
export abs_top_srcdir
export top_builddest
export top_builddir
export config.make
export srcdest
export srcdir
export prefix
@ -72,6 +72,10 @@ ifdef M1
export M1
endif
ifdef MES
export MES
endif
ifdef HEX2
export HEX2
endif

View file

@ -19,19 +19,20 @@
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
set -e
srcdest="@srcdest@"
srcdir="@srcdir@"
abs_top_srcdir="@abs_top_srcdir@"
abs_top_builddir="@abs_top_builddir@"
prefix=${prefix-@prefix@}
. build-aux/trace.sh
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
SHELL=${SHELL-$(command -v sh)}
# use bash or lose if pipes fail
[ -n "$BASH" ] && set -o pipefail
SHELL=${SHELL-$(command -v sh)}
prefix=${prefix-/usr/local}
top_builddest=${top_builddest-}
top_builddir=${top_buildir-.}
abs_top_srcdir=${abs_top_srcdir-$PWD}
abs_top_builddir=${abs_top_builddir-$PWD}
MES_PREFIX=${MES_PREFIX-$prefix/share/mes}
MES_SEED=${MES_SEED-../MES-SEED}
TINYCC_SEED=${TINYCC_SEED-../TINYCC-SEED}
@ -52,8 +53,8 @@ guile_site_dir=${guile_site_dir-$prefix/share/guile/site/$GUILE_EFFECTIVE_VERSIO
guile_site_ccache_dir=${guile_site_ccache_dir-$prefix/lib/guile/$GUILE_EFFECTIVE_VERSION/site-ccache}
mkdir -p $DESTDIR$bindir
cp ${top_builddest}src/mes $DESTDIR$bindir/mes
cp ${top_builddest}scripts/mescc $DESTDIR$bindir/mescc
cp src/mes $DESTDIR$bindir/mes
cp scripts/mescc $DESTDIR$bindir/mescc
sed \
-e "s,^#! /bin/sh,#! $SHELL," \
@ -65,7 +66,7 @@ mkdir -p $docdir
if [ -n "$PERL" -a -n "$GIT" ]\
&& $PERL -v > /dev/null\
&& $GIT --status > /dev/null; then
$PERL build-aux/gitlog-to-changelog --srcdir=. > ${top_builddest}ChangeLog
$PERL ${srcdest}build-aux/gitlog-to-changelog --srcdir=. > ChangeLog
fi
cp\
@ -78,42 +79,48 @@ cp\
README\
$DESTDIR$docdir
if [ -f ${top_builddest}ChangeLog ]; then
cp ${top_builddest}ChangeLog $DESTDIR$docdir
if [ -f ChangeLog ]; then
cp ChangeLog $DESTDIR$docdir
else
cp ChangeLog $DESTDIR$docdir
fi
if [ -f ${top_builddest}ChangeLog ]; then
cp ${top_builddest}ChangeLog $docdir
if [ -f ChangeLog ]; then
cp ChangeLog $docdir
else
cp ChangeLog $docdir
fi
mkdir -p $DESTDIR$MES_PREFIX
if [ -z "$srcdest" ]; then
tar -cf- include lib | tar -xf- -C $DESTDIR$MES_PREFIX
tar -cf- scaffold --exclude='*.gcc*' --exclude='*.mes*' | tar -xf- -C $DESTDIR$MES_PREFIX
tar -cf- ${top_builddest}lib | tar -xf- -C $DESTDIR$MES_PREFIX
tar -cf- --exclude='*.go' module | tar -xf- -C $DESTDIR$MES_PREFIX
tar -cf- -C mes module | tar -xf- -C $DESTDIR$MES_PREFIX
tar -cf- scaffold --exclude='*.gcc*' --exclude='*.mes*' | tar -xf- -C $DESTDIR$MES_PREFIX
else
tar -cf- -C ${srcdest} include lib | tar -xf- -C $DESTDIR$MES_PREFIX
tar -cf- -C lib | tar -xf- -C $DESTDIR$MES_PREFIX
tar -cf- -C ${srcdest} module | tar -xf- -C $DESTDIR$MES_PREFIX
tar -cf- -C ${srcdest} scaffold | tar -xf- -C $DESTDIR$MES_PREFIX
fi
tar -cf- -C ${srcdest}mes module | tar -xf- -C $DESTDIR$MES_PREFIX
mkdir -p $DESTDIR$guile_site_dir
mkdir -p $DESTDIR$guile_site_ccache_dir
tar -cf- -C module --exclude='*.go' . | tar -xf- -C $DESTDIR$guile_site_dir
tar -cf- -C ${top_builddest}module --exclude='*.scm' . | tar -xf- -C $DESTDIR$guile_site_ccache_dir
tar -cf- -C ${srcdest}module --exclude='*.go' . | tar -xf- -C $DESTDIR$guile_site_dir
tar -cf- -C module --exclude='*.scm' . | tar -xf- -C $DESTDIR$guile_site_ccache_dir
if [ -f ${top_builddest}doc/mes.info ]; then
if [ -f doc/mes.info ]; then
mkdir -p $DESTDIR$infodir
tar -cf- ${top_builddest}doc/mes.info* doc/images | tar -xf- --strip-components=1 -C $DESTDIR$infodir
install-info --info-dir=$DESTDIR$infodir ${top_builddest}doc/mes.info
tar -cf- doc/mes.info* doc/images | tar -xf- --strip-components=1 -C $DESTDIR$infodir
install-info --info-dir=$DESTDIR$infodir doc/mes.info
fi
if [ -f ${top_builddest}doc/mes.1 ]; then
if [ -f doc/mes.1 ]; then
mkdir -p $DESTDIR$mandir/man1
cp ${top_builddest}doc/mes.1 $DESTDIR$mandir/man1/
cp doc/mes.1 $DESTDIR$mandir/man1/
fi
if [ -f ${top_builddest}doc/mescc.1 ]; then
if [ -f doc/mescc.1 ]; then
mkdir -p $DESTDIR$mandir/man1
cp ${top_builddest}doc/mescc.1 $DESTDIR$mandir/man1/
cp doc/mescc.1 $DESTDIR$mandir/man1/
fi

View file

@ -204,13 +204,14 @@ exec ${GUILE-guile} --no-auto-compile -L $(dirname $0) -C $(dirname $0) -e '(mes
((compose (cut assoc-ref <> 'no-environment) function.annotation) f))
(define (generate-includes file-name)
(let* ((string (with-input-from-file file-name read-string))
(let* ((srcdest (or (getenv "srcdest") ""))
(string (with-input-from-file (string-append srcdest file-name) read-string))
(functions (snarf-functions string))
(functions (delete-duplicates functions (lambda (a b) (equal? (function.name a) (function.name b)))))
(functions (filter (negate internal?) functions))
(symbols (snarf-symbols string))
(base-name (basename file-name ".c"))
(dir (string-append (or (getenv "top_builddest") "") (dirname file-name)))
(dir (string-append (dirname file-name)))
(base-name (string-append dir "/" base-name))
(base-name (if %gcc? base-name
(string-append base-name ".mes")))

View file

@ -18,24 +18,25 @@
# You should have received a copy of the GNU General Public License
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
top_builddest="@top_builddest@"
srcdir="@srcdir@"
abs_top_srcdir="@abs_top_srcdir@"
abs_top_builddir="@abs_top_builddir@"
prefix=${prefix-@prefix@}
MES_PREFIX=mes
MES_PREFIX=${srcdest}mes
export MES_PREFIX
GUILE_LOAD_COMPILED_PATH="$abs_top_builddir/module${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH"
GUILE_LOAD_PATH="$abs_top_srcdir/module:$abs_top_srcdir/guix${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH"
if [ -n "$top_builddest" ]; then
GUILE_LOAD_PATH="$abs_top_buildir/module:$GUILE_LOAD_PATH"
GUILE_LOAD_PATH="module:mes:$abs_top_srcdir/guix${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH"
if [ -n "$srcdest" ]; then
GUILE_LOAD_PATH="${srcdest}module:${srcdest}mes:$GUILE_LOAD_PATH"
fi
export GUILE_LOAD_COMPILED_PATH GUILE_LOAD_PATH
PATH="$abs_top_builddir/scripts:$abs_top_builddir/src:$abs_top_builddir/build-aux:$PATH"
export PATH
MES=${MES-${top_builddest}src/mes}
MES=${MES-src/mes}
export MES
GUIX_PACKAGE_PATH="$abs_top_srcdir/guix${GUIX_PACKAGE_PATH:+:}$GUIX_PACKAGE_PATH"

View file

@ -19,17 +19,17 @@
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
set -e
. build-aux/config.sh
. build-aux/trace.sh
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
MES_ARENA=100000000
GUILE=${GUILE-$MES}
DIFF=${DIFF-$(command -v diff)}
[ -z "$DIFF" ] && DIFF="sh ${top_builddest}scripts/diff.scm"
[ -z "$DIFF" ] && DIFF="sh scripts/diff.scm"
t=${1-scaffold/tests/t}
o="${top_builddest}$t"
o="$t"
rm -f "$o".mes-out
shift
@ -37,7 +37,7 @@ set -e
rm -f "$o".gcc-out
if [ -n "$CC" ]; then
sh build-aux/cc.sh "$t"
sh ${srcdest}build-aux/cc.sh "$t"
r=0
[ -f "$t".exit ] && r=$(cat "$t".exit)
@ -55,7 +55,7 @@ fi
rm -f "$t".mes-gcc-out
if [ -n "$CC32" ]; then
sh build-aux/cc32-mes.sh "$t"
sh ${srcdest}build-aux/cc32-mes.sh "$t"
r=0
[ -f "$t".exit ] && r=$(cat "$t".exit)
@ -72,7 +72,7 @@ if [ -n "$CC32" ]; then
fi
rm -f "$o".mes-out
sh build-aux/cc-mes.sh "$t"
sh ${srcdest}build-aux/cc-mes.sh "$t"
r=0
[ -f "$t".exit ] && r=$(cat "$t".exit)

View file

@ -22,7 +22,7 @@ if [ -z "$V" -o "$V0" = 0 ]; then
shift
eval "$@" $LOG
}
LOG=" >>${top_builddest}build.log 2>&1"
LOG=" >>build.log 2>&1"
fi
if [ "$V" = 1 ]; then
function trace () {
@ -30,7 +30,7 @@ if [ "$V" = 1 ]; then
echo "$@"
eval "$@ $LOG"
}
LOG=" >>${top_builddest}build.log 2>&1"
LOG=" >>build.log 2>&1"
fi
if [ "$V" = 2 ]; then
set -x

View file

@ -20,11 +20,22 @@
#set -e
. build-aux/trace.sh
srcdest="@srcdest@"
srcdir="@srcdir@"
abs_top_srcdir="@abs_top_srcdir@"
abs_top_builddir="@abs_top_builddir@"
prefix=${prefix-@prefix@}
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
GUILE=${GUILE-$(command -v guile)} || true
if [ -z "$GUILE" -o "$GUILE" = true ]; then
GUILE_EFFECTIVE_VERSION=${GUILE_EFFECTIVE_VERSION-2.2}
else
GUILE_EFFECTIVE_VERSION=${GUILE_EFFECTIVE_VERSION-$(guile -c '(display (effective-version))')}
fi
prefix=${prefix-/usr/local}
datadir=${datadir-$prefix/share}
docdir=${docdir-$datadir/doc/mes-$VERSION}
infodir=${infodir-$datadir/info}
@ -34,11 +45,11 @@ guile_site_dir=${guile_site_dir-$prefix/share/guile/site/$GUILE_EFFECTIVE_VERSIO
guile_site_ccache_dir=${guile_site_ccache_dir-$prefix/lib/guile/$GUILE_EFFECTIVE_VERSION/site-ccache}
mkdir -p $DESTDIR$prefix/bin
cp ${top_builddest}src/mes $DESTDIR$prefix/bin/mes
cp src/mes $DESTDIR$prefix/bin/mes
mkdir -p $DESTDIR$prefix/lib
mkdir -p $DESTDIR$MES_PREFIX/lib
cp ${top_builddest}scripts/mescc $DESTDIR$prefix/bin/mescc
cp scripts/mescc $DESTDIR$prefix/bin/mescc
rm $DESTDIR$prefix/bin/mes
rm $DESTDIR$prefix/bin/mescc

49
configure vendored
View file

@ -219,10 +219,12 @@ exec ${guile} -L . --no-auto-compile -e '(configure)' -s "$0" ${1+"$@"}
(srcdir (value #t))
(sysconfdir (value #t))
(verbose (single-char #\v))
(with-cheating)
(with-courage)
(infodir (value #t))
(mandir (value #t))
(disable-silent-rules)
(enable-silent-rules)
(enable-fast-install) ; Ignored for Guix
(includedir (value #t)) ; Ignored for Debian
@ -256,6 +258,7 @@ Options:
--host=HOST cross-compile to build programs to run on HOST [BUILD]
-v, --verbose be verbose
--with-courage assert being courageous to configure for unsupported platform
--with-cheating cheat using Guile instead of Mes
Installation directories:
--prefix=DIR install in prefix DIR [~a]
@ -313,21 +316,19 @@ Some influential environment variables:
(string-append "${prefix}/lib/guile/" guile-effective-version "/site-ccache")))
(srcdir (dirname (car (command-line))))
(srcdest (if (equal? srcdir ".") ""
(string-append srcdir "/")))
(abs-top-srcdir (canonicalize-path srcdir))
(abs-top-builddir (canonicalize-path (getcwd)))
(top-builddir (if (equal? srcdir ".") "."
abs-top-builddir))
(top-builddest (if (equal? srcdir ".") ""
(string-append abs-top-builddir "/")))
(with-cheating? (option-ref options 'with-cheating #f))
(with-courage? (option-ref options 'with-courage #f))
(disable-silent-rules? (option-ref options 'disable-silent-rules #f))
(enable-silent-rules? (option-ref options 'enable-silent-rules #f))
(vars (filter (cut string-index <> #\=) (option-ref options '() '())))
(help? (option-ref options 'help #f)))
(define (srcdir-relative file-name)
(if (equal? srcdir ".") file-name
(string-append srcdir "/" file-name)))
(when help?
(print-help)
(exit 0))
@ -336,11 +337,11 @@ Some influential environment variables:
(stderr "configure args=~s\n" args))
(for-each (lambda (v) (apply setenv (string-split v #\=))) vars)
(let* ((mes-seed (or (getenv "MES_SEED")
(srcdir-relative "../mes-seed")))
(string-append srcdest "../mes-seed")))
(tinycc-seed (or (getenv "TINYCC_SEED")
(srcdir-relative "../tinycc-seed")))
(string-append srcdest "../tinycc-seed")))
(mescc-tools-seed (or (getenv "MESCC_TOOLS_SEED")
(srcdir-relative "../mescc-tools-seed")))
(string-append srcdest "../mescc-tools-seed")))
(deps (fold (lambda (program results)
(cons (check-program-version program) results))
'()
@ -414,11 +415,11 @@ Some influential environment variables:
(stdout "build:=~a\n" build-type)
(stdout "host:=~a\n" host-type)
(stdout "top_builddest:=~a\n" top-builddest)
(stdout "top_builddir:=~a\n" top-builddir)
(stdout "abs_top_builddir:=~a\n" abs-top-builddir)
(stdout "abs_top_srcdir:=~a\n" abs-top-srcdir)
(stdout "srcdest:=~a\n" srcdest)
(stdout "srcdir:=~a\n" srcdir)
(stdout "prefix:=~a\n" (gulp-pipe (string-append "echo " prefix)))
@ -440,7 +441,10 @@ Some influential environment variables:
(stdout "GUILE_EFFECTIVE_VERSION:=~a\n" (effective-version))
(when disable-silent-rules?
(stdout "BUILD_DEBUG:=1\n"))
(stdout "V:=1\n"))
(when with-cheating?
(stdout "MES:=guile\n"))
(for-each (lambda (o)
(stdout "~a:=~a\n" o (or (getenv o) "")))
@ -453,34 +457,39 @@ Some influential environment variables:
"MES_CFLAGS"
))))
(let ((pairs `(("@srcdir@" . ,abs-top-srcdir)
(let ((pairs `(("@srcdest@" . ,srcdest)
("@srcdir@" . ,srcdir)
("@abs_top_srcdir@" . ,abs-top-srcdir)
("@abs_top_builddir@" . ,abs-top-builddir)
("@top_builddir@" . ,top-builddir)
("@top_builddest@" . ,top-builddest)
("@BASH@" . ,(file-name "bash" deps))
("@GUILE@" . ,(file-name "guile" deps))
("@MES@" . ,(file-name "guile" deps))
("@guile_site_dir@" . ,guile-site-dir)
("@guile_site_ccache_dir@" . ,guile-site-ccache-dir)
("@VERSION@" . ,VERSION)
("mes/module/" . ,(string-append moduledir "/")))))
(for-each (lambda (o)
(let* ((src (srcdir-relative o))
(let* ((src (string-append srcdest o))
(target (string-drop-right o 3))
(target (if (not (string-prefix? "build-aux/" target)) target
(string-drop target (string-length "build-aux/")))))
(substitute src pairs #:target target)))
'(
"build-aux/GNUmakefile.in"
"build-aux/build.sh.in"
"build-aux/check.sh.in"
"build-aux/install.sh.in"
"build-aux/pre-inst-env.in"
"build-aux/uninstall.sh.in"
"mes/module/mes/boot-0.scm.in"
"scripts/mescc.in"
))
(when (not (equal? srcdir "."))
(substitute (string-append srcdir "/build-aux/GNUmakefile.in")
pairs
#:target "GNUmakefile")
(system (string-append "cd mes/module/mes && ln -sf " abs-top-srcdir "/mes/module/mes/*.mes ."))))
)))
(chmod "build.sh" #o755)
(chmod "check.sh" #o755)
(chmod "install.sh" #o755)
(chmod "pre-inst-env" #o755)
(chmod "uninstall.sh" #o755)
(chmod "scripts/mescc" #o755)
(let ((make (and=> (file-name "make" deps) basename)))
(format (current-output-port)

View file

@ -27,21 +27,25 @@ cmdline=$(echo "$@")
p=${cmdline##*--prefix=}
p=${p% *}
p=${p% -*}
prefix=${p-${prefix}}
if [ -z "$prefix" ]; then
prefix=/usr/local
if [ -z "$p" ]; then
p=${prefix-/usr/local}
fi
prefix=$p
. build-aux/trace.sh
srcdir=${srcdir-$(dirname $0)}
. ${srcdest}build-aux/trace.sh
BASH=${BASH-$(command -v bash)}
GUILE=${GUILE-$(command -v guile)} || true
srcdir=${srcdir-.}
top_builddest=${top_builddest-}
top_builddir=${top_builddest-.}
abs_top_srcdir=${abs_top_srcdir-$PWD}
abs_top_builddir=${abs_top_srcdir-$abs_top_builddir}
if [ "$srcdir" = . ]; then
top_builddir=.
else
srcdest=${srcdest}
top_builddir=$PWD
fi
abs_top_srcdir=${abs_top_srcdir-$(cd ${srcdir} && pwd)}
abs_top_builddir=$PWD
if [ -z "$GUILE" -o "$GUILE" = true ]; then
GUILE_EFFECTIVE_VERSION=${GUILE_EFFECTIVE_VERSION-2.2}
@ -56,63 +60,38 @@ moduledir=${moduledir-$datadir/mes/module}
guile_site_dir=${guile_site_dir-$prefix/share/guile/site/$GUILE_EFFECTIVE_VERSION}
guile_site_ccache_dir=${guile_site_ccache_dir-$prefix/lib/guile/$GUILE_EFFECTIVE_VERSION/site-ccache}
subst () {
sed \
-e s,"@srcdest@,$srcdest,"\
-e s,"@srcdir@,$srcdir,"\
-e s,"@abs_top_srcdir@,$abs_top_srcdir,"\
-e s,"@abs_top_builddir@,$abs_top_builddir,"\
-e s,"@top_builddir@,$top_builddir,"\
-e s,"@top_builddest@,$top_builddest,"\
-e s,"@BASH@,$BASH,"\
-e s,"@GUILE@,$GUILE,"\
-e s,"@guile_site_dir@,$guile_site_dir,"\
-e s,"@guile_site_ccache_dir@,$guile_site_ccache_dir,"\
-e s,"@VERSION@,$VERSION,"\
-e s,"mes/module/,$moduledir,"\
build-aux/pre-inst-env.in\
> pre-inst-env
$1 > $2
}
subst ${srcdest}build-aux/pre-inst-env.in pre-inst-env
chmod +x pre-inst-env
subst ${srcdest}mes/module/mes/boot-0.scm.in mes/module/mes/boot-0.scm
subst ${srcdest}scripts/mescc.in scripts/mescc
sed \
-e s,"@srcdir@,$srcdir,"\
-e s,"@abs_top_srcdir@,$abs_top_srcdir,"\
-e s,"@abs_top_builddir@,$abs_top_builddir,"\
-e s,"@top_builddir@,$top_builddir,"\
-e s,"@top_builddest@,$top_builddest,"\
-e s,"@BASH@,$BASH,"\
-e s,"@GUILE@,$GUILE,"\
-e s,"@guile_site_dir@,$guile_site_dir,"\
-e s,"@guile_site_ccache_dir@,$guile_site_ccache_dir,"\
-e s,"@VERSION@,$VERSION,"\
-e s,"mes/module/,$moduledir,"\
mes/module/mes/boot-0.scm.in\
> mes/module/mes/boot-0.scm
sed \
-e s,"@srcdir@,$srcdir,"\
-e s,"@abs_top_srcdir@,$abs_top_srcdir,"\
-e s,"@abs_top_builddir@,$abs_top_builddir,"\
-e s,"@top_builddir@,$top_builddir,"\
-e s,"@top_builddest@,$top_builddest,"\
-e s,"@BASH@,$BASH,"\
-e s,"@GUILE@,$GUILE,"\
-e s,"@guile_site_dir@,$guile_site_dir,"\
-e s,"@guile_site_ccache_dir@,$guile_site_ccache_dir,"\
-e s,"@VERSION@,$VERSION,"\
-e s,"mes/module/,$moduledir,"\
scripts/mescc.in\
> scripts/mescc
subst ${srcdest}build-aux/GNUmakefile.in GNUmakefile
subst ${srcdest}build-aux/build.sh.in build.sh
subst ${srcdest}build-aux/check.sh.in check.sh
subst ${srcdest}build-aux/install.sh.in install.sh
subst ${srcdest}build-aux/uninstall.sh.in uninstall.sh
chmod +x scripts/mescc
if [ "$srcdir" != . ]; then
mkdir -p mes/module/mes
{ cd mes/module/mes; ln -sf $abs_top_srcdir/mes/module/mes/*.mes .; }
fi
cat <<EOF
Run:
prefix=$prefix ./build.sh to build mes
prefix=$prefix ./check.sh to check mes
prefix=$prefix ./install.sh to install mes
./build.sh to build mes
./check.sh to check mes
./install.sh to install mes
EOF

View file

@ -210,9 +210,9 @@
(arch-find options (string-append "lib" o ext)))
(define* (arch-find options file-name)
(let* ((top-builddest (or (getenv "top_builddest") ""))
(builddir-lib (string-append top-builddest "lib"))
(path (cons* builddir-lib
(let* ((srcdest (or (getenv "srcdest") ""))
(srcdir-lib (string-append srcdest "lib"))
(path (cons* srcdir-lib
(prefix-file options "lib")
(filter-map (multi-opt 'library-dir) options)))
(arch-file-name (string-append "x86-mes/" file-name))

View file

@ -20,7 +20,7 @@ if [ '(' -z "$mes_p" -a -z "$MES" ')' -o "$MES" = "guile" -o "$MES" = "mes.guile
exec ${GUILE-guile} -L $guile_site_dir -e '(mescc)' -s "$mescc" "$@"
else
MES=${MES-$(dirname $0)/mes}
exec ${MES-${top_builddest}mes} -e '(mescc)' -s "$mescc" "$@"
exec ${MES-mes} -e '(mescc)' -s "$mescc" "$@"
fi
!#

View file

@ -2268,10 +2268,9 @@ load_env (SCM a) ///((internal))
strcpy (prefix, p);
g_stdin = load_boot (prefix, boot, "MODULEDIR");
}
if (g_stdin < 0 && getenv ("top_builddest"))
if (g_stdin < 0)
{
strcpy (prefix, getenv ("top_builddest"));
strcpy (prefix + strlen (prefix), "mes/module/mes/");
strcpy (prefix, "mes/module/mes/");
g_stdin = load_boot (prefix, boot, ".");
}
if (g_stdin < 0)