2018-07-22 12:24:36 +00:00
|
|
|
|
# GNU Mes --- Maxwell Equations of Software
|
2018-06-28 21:10:14 +00:00
|
|
|
|
# Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
|
|
|
|
#
|
2018-07-22 12:24:36 +00:00
|
|
|
|
# This file is part of GNU Mes.
|
2018-06-28 21:10:14 +00:00
|
|
|
|
#
|
2018-07-22 12:24:36 +00:00
|
|
|
|
# GNU Mes is free software; you can redistribute it and/or modify it
|
2018-06-28 21:10:14 +00:00
|
|
|
|
# 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.
|
|
|
|
|
#
|
2018-07-22 12:24:36 +00:00
|
|
|
|
# GNU Mes is distributed in the hope that it will be useful, but
|
2018-06-28 21:10:14 +00:00
|
|
|
|
# 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
|
2018-07-22 12:24:36 +00:00
|
|
|
|
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
2018-06-27 11:42:47 +00:00
|
|
|
|
|
2018-07-21 05:15:52 +00:00
|
|
|
|
GUILE_FLAGS:=--no-auto-compile -L . -L module -C . -C module
|
2017-04-02 16:50:07 +00:00
|
|
|
|
|
2018-07-23 18:03:57 +00:00
|
|
|
|
cleaning-p:=$(filter clean%, $(MAKECMDGOALS))$(filter %clean, $(MAKECMDGOALS))
|
2016-10-15 22:34:23 +00:00
|
|
|
|
|
2018-07-23 18:03:57 +00:00
|
|
|
|
ifndef cleaning-p
|
2018-07-21 22:43:39 +00:00
|
|
|
|
ifndef config.make
|
|
|
|
|
config.make:=.config.make
|
|
|
|
|
include $(config.make)
|
|
|
|
|
$(config.make):
|
2018-07-09 08:46:28 +00:00
|
|
|
|
./configure --prefix=$(prefix)
|
2018-07-21 22:43:39 +00:00
|
|
|
|
endif
|
|
|
|
|
endif
|
2018-06-28 21:10:14 +00:00
|
|
|
|
|
2018-07-23 18:03:57 +00:00
|
|
|
|
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\
|
|
|
|
|
#
|
2018-06-02 09:41:06 +00:00
|
|
|
|
|
2017-07-02 10:03:29 +00:00
|
|
|
|
.PHONY: $(PHONY_TARGETS)
|
2016-07-09 21:12:25 +00:00
|
|
|
|
|
2018-04-29 16:38:57 +00:00
|
|
|
|
default: all
|
2017-07-19 12:12:29 +00:00
|
|
|
|
|
2018-06-27 11:42:47 +00:00
|
|
|
|
all: build doc
|
|
|
|
|
|
|
|
|
|
build:
|
2018-04-29 16:38:57 +00:00
|
|
|
|
./build.sh
|
|
|
|
|
|
2018-07-21 10:02:43 +00:00
|
|
|
|
gcc:
|
2018-05-27 04:59:36 +00:00
|
|
|
|
build-aux/build-cc.sh
|
|
|
|
|
|
2018-05-29 18:07:46 +00:00
|
|
|
|
mes-gcc:
|
2018-06-24 07:28:23 +00:00
|
|
|
|
build-aux/build-cc32.sh
|
|
|
|
|
|
|
|
|
|
mes-tcc:
|
2018-06-28 21:10:14 +00:00
|
|
|
|
ifdef TCC
|
2018-06-24 07:28:23 +00:00
|
|
|
|
CC32=$(TCC) build-aux/build-cc32.sh
|
2018-06-28 21:10:14 +00:00
|
|
|
|
else
|
|
|
|
|
|
|
|
|
|
$(warning skipping mes-tcc: no tcc)
|
|
|
|
|
endif
|
2018-05-27 04:59:36 +00:00
|
|
|
|
|
|
|
|
|
mes:
|
|
|
|
|
build-aux/build-mes.sh
|
|
|
|
|
|
2018-04-29 16:38:57 +00:00
|
|
|
|
clean:
|
2018-05-27 04:59:36 +00:00
|
|
|
|
git clean -dfx
|
2018-04-29 16:38:57 +00:00
|
|
|
|
|
2018-07-23 18:03:57 +00:00
|
|
|
|
# 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
|
|
|
|
|
|
2018-04-29 16:38:57 +00:00
|
|
|
|
all-go:
|
|
|
|
|
build-aux/build-guile.sh
|
|
|
|
|
|
|
|
|
|
clean-go:
|
|
|
|
|
rm -f $(shell find . -name '*.go')
|
|
|
|
|
|
|
|
|
|
check:
|
|
|
|
|
./check.sh
|
|
|
|
|
|
2018-07-23 18:03:57 +00:00
|
|
|
|
# Mes does not feature post-install checks yet, so we're great!
|
|
|
|
|
installcheck:
|
|
|
|
|
true
|
|
|
|
|
|
2018-07-21 22:43:39 +00:00
|
|
|
|
install: ${top_builddest}src/mes
|
2018-04-29 16:38:57 +00:00
|
|
|
|
./install.sh
|
2017-07-19 17:53:21 +00:00
|
|
|
|
|
2018-07-22 15:00:22 +00:00
|
|
|
|
uninstall:
|
|
|
|
|
./uninstall.sh
|
|
|
|
|
|
2018-07-21 22:43:39 +00:00
|
|
|
|
$(config.make): configure
|
2018-04-29 16:38:57 +00:00
|
|
|
|
|
2018-06-24 07:28:23 +00:00
|
|
|
|
seed: all-go mes-gcc mes-tcc
|
2018-06-28 21:10:14 +00:00
|
|
|
|
ifdef TCC
|
2018-06-03 16:54:26 +00:00
|
|
|
|
cd $(TINYCC_SEED) && MES_PREFIX=$(PWD) ./refresh.sh
|
2018-06-28 21:10:14 +00:00
|
|
|
|
endif
|
2018-05-27 04:59:36 +00:00
|
|
|
|
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
|
2018-06-16 04:37:20 +00:00
|
|
|
|
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
|
2018-05-27 04:59:36 +00:00
|
|
|
|
|
2018-07-21 22:43:39 +00:00
|
|
|
|
${top_builddest}doc/version.texi: doc/mes.texi GNUmakefile
|
|
|
|
|
@mkdir -p $(@D)
|
2018-06-27 11:42:47 +00:00
|
|
|
|
(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)") > $@
|
|
|
|
|
|
2018-07-21 22:43:39 +00:00
|
|
|
|
doc: ${top_builddest}doc/version.texi
|
2018-06-28 21:10:14 +00:00
|
|
|
|
ifdef MAKEINFO
|
2018-06-27 11:42:47 +00:00
|
|
|
|
doc: info
|
2018-06-28 21:10:14 +00:00
|
|
|
|
else
|
|
|
|
|
$(warning skipping info: no makeinfo)
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
ifdef HELP2MAN
|
|
|
|
|
doc: man
|
|
|
|
|
else
|
|
|
|
|
$(warning skipping man: no help2man)
|
|
|
|
|
endif
|
2018-06-27 11:42:47 +00:00
|
|
|
|
|
2018-07-21 22:43:39 +00:00
|
|
|
|
info: ${top_builddest}doc/mes.info
|
2018-06-27 11:42:47 +00:00
|
|
|
|
|
2018-07-22 20:27:24 +00:00
|
|
|
|
${top_builddest}doc/mes.info: doc/mes.texi ${top_builddest}doc/version.texi doc/images/gcc-mesboot-graph.dot GNUmakefile
|
2018-07-21 22:43:39 +00:00
|
|
|
|
$(MAKEINFO) -o $@ -I ${top_builddest}doc -I doc $<
|
2018-06-27 11:42:47 +00:00
|
|
|
|
|
2018-07-22 20:27:24 +00:00
|
|
|
|
${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
|
|
|
|
|
|
2018-07-21 22:43:39 +00:00
|
|
|
|
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) > $@
|
2018-06-28 21:10:14 +00:00
|
|
|
|
|
2018-07-23 18:03:57 +00:00
|
|
|
|
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 $<
|
2018-06-28 21:10:14 +00:00
|
|
|
|
|
2018-07-23 18:03:57 +00:00
|
|
|
|
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 $<
|
2018-06-28 21:10:14 +00:00
|
|
|
|
|
2018-07-21 22:43:39 +00:00
|
|
|
|
pdf: ${top_builddest}doc/mes.pdf
|
|
|
|
|
|
|
|
|
|
${top_builddest}doc/mes.pdf: doc/mes.texi
|
2018-07-23 18:03:57 +00:00
|
|
|
|
$(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 $<
|
2018-07-21 22:43:39 +00:00
|
|
|
|
|
|
|
|
|
### 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
|
2018-06-28 21:10:14 +00:00
|
|
|
|
|
2018-07-21 22:43:39 +00:00
|
|
|
|
dist: $(TARBALL)
|
2018-07-09 18:07:38 +00:00
|
|
|
|
|
2018-07-21 22:43:39 +00:00
|
|
|
|
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)
|
2018-07-09 18:07:38 +00:00
|
|
|
|
|
2018-07-21 22:43:39 +00:00
|
|
|
|
generate-ChangeLog:
|
|
|
|
|
$(PERL) build-aux/gitlog-to-changelog --srcdir=${srcdir} > ChangeLog
|
2018-07-09 18:07:38 +00:00
|
|
|
|
|
2018-07-21 22:43:39 +00:00
|
|
|
|
$(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
|
2018-07-09 18:07:38 +00:00
|
|
|
|
|
2018-07-22 06:41:48 +00:00
|
|
|
|
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)
|
|
|
|
|
|
2018-07-23 18:03:57 +00:00
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
2018-05-27 04:59:36 +00:00
|
|
|
|
define HELP_TOP
|
|
|
|
|
Usage: make [OPTION]... [TARGET]...
|
|
|
|
|
|
2018-07-23 18:03:57 +00:00
|
|
|
|
Main and non-standard targets:
|
2018-05-27 04:59:36 +00:00
|
|
|
|
all update everything
|
|
|
|
|
all-go update .go files
|
2018-07-21 22:43:39 +00:00
|
|
|
|
gcc update src/mes.gcc-out
|
|
|
|
|
dist update $(TARBALL)
|
2018-06-27 11:42:47 +00:00
|
|
|
|
doc update documentation
|
2018-05-29 18:07:46 +00:00
|
|
|
|
mes-gcc update src/mes.mes-gcc-out
|
2018-06-24 07:28:23 +00:00
|
|
|
|
mes-tcc update src/mes.mes-tcc-out
|
2018-05-27 04:59:36 +00:00
|
|
|
|
mes update src/mes
|
|
|
|
|
check run unit tests
|
|
|
|
|
clean run git clean -dfx
|
|
|
|
|
clean-go clean .go files
|
2018-06-27 11:42:47 +00:00
|
|
|
|
info update info documentation
|
2018-07-09 08:46:28 +00:00
|
|
|
|
install install in $(prefix)
|
|
|
|
|
install-info install info docs in $(prefix)/share/info
|
2018-07-23 18:03:57 +00:00
|
|
|
|
release dist and tag
|
2018-05-27 04:59:36 +00:00
|
|
|
|
seed update mes-seed in $(MES_SEED)
|
2018-07-22 15:00:22 +00:00
|
|
|
|
uninstall uninstall from $(prefix)
|
2018-05-27 04:59:36 +00:00
|
|
|
|
endef
|
|
|
|
|
export HELP_TOP
|
|
|
|
|
help:
|
|
|
|
|
@echo "$$HELP_TOP"
|
2018-05-03 18:32:06 +00:00
|
|
|
|
|
2018-06-28 21:10:14 +00:00
|
|
|
|
include build-aux/export.make
|