1 # Mes --- Maxwell Equations of Software
2 # Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
4 # This file is part of Mes.
6 # Mes is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or (at
9 # your option) any later version.
11 # Mes is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with Mes. If not, see <http://www.gnu.org/licenses/>.
19 GUILE_FLAGS:=--no-auto-compile -L . -L module -C . -C module
21 cleaning_p:=$(filter clean%, $(MAKECMDGOALS))
25 config.make:=.config.make
26 include $(config.make)
28 ./configure --prefix=$(prefix)
32 PHONY_TARGETS:= all all-go build check clean clean-go default dist doc help install\
33 install-info man gcc mes ${top_builddest}src/mes mes-gcc mes-tcc generate-ChangeLog
35 .PHONY: $(PHONY_TARGETS)
48 build-aux/build-cc32.sh
52 CC32=$(TCC) build-aux/build-cc32.sh
55 $(warning skipping mes-tcc: no tcc)
59 build-aux/build-mes.sh
65 build-aux/build-guile.sh
68 rm -f $(shell find . -name '*.go')
73 install: ${top_builddest}src/mes
76 $(config.make): configure
78 seed: all-go mes-gcc mes-tcc
80 cd $(TINYCC_SEED) && MES_PREFIX=$(PWD) ./refresh.sh
82 cd $(MES_SEED) && git reset --hard HEAD
83 MES=$(GUILE) GUILE=$(GUILE) SEED=1 build-aux/build-mes.sh
84 cd $(MES_SEED) && MES_PREFIX=$(PWD) ./refresh.sh
85 MES=$(GUILE) GUILE=$(GUILE) SEED=1 build-aux/build-mes.sh
86 cp lib/x86-mes/elf32-header.hex2\
88 lib/x86-mes/libc+tcc.S\
91 lib/x86-mes/libgetopt.S\
92 $(MESCC_TOOLS_SEED)/libs
93 cd $(MESCC_TOOLS_SEED) && MES_PREFIX=$(PWD) ./bootstrap.sh
95 ${top_builddest}doc/version.texi: doc/mes.texi GNUmakefile
97 (set `LANG= date -r $< +'%d %B %Y'`;\
98 echo "@set UPDATED $$1 $$2 $$3"; \
99 echo "@set UPDATED-MONTH $$2 $$3"; \
100 echo "@set EDITION $(VERSION)"; \
101 echo "@set VERSION $(VERSION)") > $@
103 doc: ${top_builddest}doc/version.texi
107 $(warning skipping info: no makeinfo)
113 $(warning skipping man: no help2man)
116 info: ${top_builddest}doc/mes.info
118 ${top_builddest}doc/mes.info: doc/mes.texi ${top_builddest}doc/version.texi GNUmakefile
119 $(MAKEINFO) -o $@ -I ${top_builddest}doc -I doc $<
123 man: ${top_builddest}doc/mes.1 ${top_builddest}doc/mescc.1
125 ${top_builddest}src/mes: build
127 ${top_builddest}doc/mes.1: ${top_builddest}src/mes
128 MES_ARENA=10000000 ${top_builddir}/pre-inst-env $(HELP2MAN) $(<F) > $@
130 ${top_builddest}doc/mescc.1: ${top_builddest}src/mes ${top_builddest}scripts/mescc
131 MES_ARENA=10000000 ${top_builddir}/pre-inst-env $(HELP2MAN) $(<F) > $@
133 html: ${top_builddest}mes/index.html
135 ${top_builddest}mes/index.html: doc/mes.texi
136 $(MAKEINFO) --html -o ${top_builddest}doc/mes $<
138 pdf: ${top_builddest}doc/mes.pdf
140 ${top_builddest}doc/mes.pdf: doc/mes.texi
141 $(MAKEINFO) --pdf -I ${top_builddest}/doc -o doc/mes.pdf $<
144 COMMIT=$(shell test -d .git && (git describe --dirty 2>/dev/null) || cat .tarball-version)
145 TARBALL_VERSION=$(COMMIT:v%=%)
146 TARBALL_DIR:=$(PACKAGE)-$(TARBALL_VERSION)
147 TARBALL:=${top_builddest}$(TARBALL_DIR).tar.gz
149 ${top_builddest}.tarball-version:
152 GIT_ARCHIVE_HEAD:=git archive HEAD --
153 GIT_LS_FILES:=git ls-files
154 ifeq ($(wildcard .git),)
155 GIT_ARCHIVE_HEAD:=tar -cf-
162 test ! -d .git || git diff --exit-code > /dev/null
163 test ! -d .git || git diff --cached --exit-code > /dev/null
164 @echo commit:$(COMMIT)
167 $(PERL) build-aux/gitlog-to-changelog --srcdir=${srcdir} > ChangeLog
169 $(TARBALL): ${top_builddest}.tarball-version | generate-ChangeLog
171 --exclude=$(TARBALL_DIR);\
172 echo $^ | tr ' ' '\n')\
173 | GZIP=-n tar --sort=name --mtime=@0 --owner=0 --group=0 --numeric-owner\
174 --transform=s,^,$(TARBALL_DIR)/,S -T- -czf $@
175 git checkout ChangeLog
178 Usage: make [OPTION]... [TARGET]...
181 all update everything
182 all-go update .go files
183 gcc update src/mes.gcc-out
184 dist update $(TARBALL)
185 doc update documentation
186 mes-gcc update src/mes.mes-gcc-out
187 mes-tcc update src/mes.mes-tcc-out
190 clean run git clean -dfx
191 clean-go clean .go files
192 info update info documentation
193 install install in $(prefix)
194 install-info install info docs in $(prefix)/share/info
195 seed update mes-seed in $(MES_SEED)
201 include build-aux/export.make