1 # GNU Mes --- Maxwell Equations of Software
2 # Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
4 # This file is part of GNU Mes.
6 # GNU 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 # GNU 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 GNU Mes. If not, see <http://www.gnu.org/licenses/>.
22 abs_top_srcdir=@abs_top_srcdir@
23 abs_top_builddir=@abs_top_builddir@
25 GUILE_FLAGS:=--no-auto-compile -L . -L module -C . -C module
27 cleaning-p:=$(filter clean%, $(MAKECMDGOALS))$(filter %clean, $(MAKECMDGOALS))
32 ${srcdir}/configure --prefix=$(prefix)
74 .PHONY: $(PHONY_TARGETS)
88 ${srcdest}build-aux/build-cc.sh
91 ${srcdest}build-aux/build-cc32.sh
95 CC32=$(TCC) ${srcdest}build-aux/build-cc32.sh
98 $(warning skipping mes-tcc: no tcc)
102 ${srcdest}build-aux/build-mes.sh
105 ${srcdest}build-aux/build-x86_64-mes.sh
117 # Mes does not cache anything on the file system; therefore clean
127 etags ${srcdest}lib/*.c ${srcdest}lib/*/*.c ${srcdest}src/*.c ${srcdest}include/*.h ${srcdest}include/sys/*.h
130 ${srcdest}build-aux/build-guile.sh
133 rm -f $(shell find . -name '*.go')
138 # Mes does not feature post-install checks yet, so we're great!
148 seed: all-go gcc mes-gcc mes-tcc
149 cd $(MES_SEED) && git reset --hard HEAD
150 MES=$(GUILE) GUILE=$(GUILE) SEED=1 ${srcdest}build-aux/build-mes.sh
151 cd $(MES_SEED) && MES_PREFIX=$(PWD) ./refresh.sh
152 MES=$(GUILE) GUILE=$(GUILE) SEED=1 ${srcdest}build-aux/build-mes.sh
153 cp lib/x86-mes/elf32-header.hex2\
155 lib/x86-mes/libc+tcc.S\
158 lib/x86-mes/libgetopt.S\
159 $(MESCC_TOOLS_SEED)/libs
160 cd $(MESCC_TOOLS_SEED) && MES_PREFIX=$(PWD) ./bootstrap.sh
162 cd $(TINYCC_SEED) && MES_PREFIX=$(PWD) ./refresh.sh
165 doc/version.texi: ${srcdest}doc/mes.texi GNUmakefile
167 (set `LANG= date -r $< +'%d %B %Y'`;\
168 echo "@set UPDATED $$1 $$2 $$3"; \
169 echo "@set UPDATED-MONTH $$2 $$3"; \
170 echo "@set EDITION $(VERSION)"; \
171 echo "@set VERSION $(VERSION)") > $@
173 doc: doc/version.texi
177 $(warning skipping info: no makeinfo)
183 $(warning skipping man: no help2man)
188 doc/mes.info: ${srcdest}doc/mes.texi doc/version.texi ${srcdest}doc/images/gcc-mesboot-graph.dot GNUmakefile
189 $(MAKEINFO) -o $@ -I doc -I doc $<
191 doc/images/%.eps: ${srcdest}doc/images/%.dot
193 $(DOT) -T eps $< > $@
198 doc/images/%.pdf: ${srcdest}doc/images/%.dot
200 $(DOT) -T pdf $< > $@
205 doc/images/%.png: ${srcdest}doc/images/%.dot
207 $(DOT) -T png $< > $@
210 $(warning info: graphvis missing: no images)
213 man: doc/mes.1 doc/mescc.1
215 # disable builtin-rules
224 doc/mes.1: src/mes | build
225 MES_ARENA=10000000 ./pre-inst-env $(HELP2MAN) $(<F) > $@
227 doc/mescc.1: scripts/mescc src/mes | build
228 MES_ARENA=10000000 ./pre-inst-env $(HELP2MAN) $(<F) > $@
230 html: doc/html/index.html
232 doc/html/index.html: ${srcdest}doc/mes.texi doc/version.texi doc/images/gcc-mesboot-graph.png
233 $(MAKEINFO) --html -o $(@D) -I ${srcdest}doc -I doc $<
237 doc/mes.dvi: ${srcdest}doc/mes.texi
238 $(MAKEINFO) --dvi -I ${srcdest}doc -I doc -o doc/mes.dvi $<
242 doc/mes.pdf: ${srcdest}doc/mes.texi
243 $(MAKEINFO) --pdf -I ${srcdest}doc -I doc -o doc/mes.pdf $<
247 doc/mes.ps: ${srcdest}doc/mes.texi
248 $(MAKEINFO) --ps -I ${srcdest}doc -I doc -o doc/mes.ps $<
251 doc/images/gcc-mesboot-graph.eps\
252 doc/images/gcc-mesboot-graph.pdf\
253 doc/images/gcc-mesboot-graph.png
255 web: info $(WEB_IMAGES)
256 GENDOCS_TEMPLATE_DIR=doc build-aux/gendocs.sh -I doc -s ${srcdest}doc/mes.texi -o doc/web/manual --email bug-mes@gnu.org mes "GNU Mes manual"
259 COMMIT=$(shell test -d ${srcdest}.git && (cd ${srcdir} && git describe --dirty 2>/dev/null) || cat ${srcdest}.tarball-version)
260 TARBALL_VERSION=$(COMMIT:v%=%)
261 TARBALL_DIR:=$(PACKAGE)-$(TARBALL_VERSION)
262 TARBALL:=$(TARBALL_DIR).tar.gz
267 GIT_ARCHIVE_HEAD:=git archive HEAD --
268 GIT_LS_FILES:=git ls-files
269 ifeq ($(wildcard .git),)
270 GIT_ARCHIVE_HEAD:=tar -cf-
280 test ! -d .git || git diff --exit-code > /dev/null
281 test ! -d .git || git diff --cached --exit-code > /dev/null
282 @echo commit:$(COMMIT)
285 $(PERL) ${srcdest}build-aux/gitlog-to-changelog --srcdir=${srcdir} > $@
286 cat ChangeLog >> generate-ChangeLog
287 mv generate-ChangeLog ChangeLog
289 $(TARBALL): .tarball-version | generate-ChangeLog
291 --exclude=$(TARBALL_DIR);\
292 echo $^ | tr ' ' '\n')\
293 | GZIP=-n tar --sort=name --mtime=@0 --owner=0 --group=0 --numeric-owner\
294 --transform=s,^,$(TARBALL_DIR)/,S -T- -czf $@
295 git checkout ChangeLog
298 update-hash: $(TARBALL)
299 $(GUIX) download file://$(PWD)/$<
300 sed -i -e 's,(base32 #!mes!# "[^"]*"),(base32 #!mes!# "$(shell $(GUIX) hash $<)"),' guix/git/mes.scm
303 $(warning update-hash: no guix)
307 git tag -s v$(VERSION) -m "GNU Mes $(VERSION)."
310 # 0. doc: Release update, Release commit, make seed, test guix bootstrap
316 ./pre-inst-env $(GUIX) build mes@$(VERSION) --with-source=$(TARBALL)
318 release: update-hash | gen-announce guix-build
320 GPG_KEY_ID:=1A858392E331EAFDB8C27FFBF3C1A0D9C1D65273
322 ../gnulib/build-aux/announce-gen\
323 --release-type=alpha\
325 --previous-version='0.16 '\
326 --current-version=$(VERSION)\
327 --gpg-key-id=$(GPG_KEY_ID)\
328 --url-directory=https://alpha.gnu.org/gnu/mes\
330 > doc/announce/ANNOUNCE-$(VERSION)-
333 installdirs: mkinstalldirs
336 $(DESTDIR)$(datadir)\
338 $(DESTDIR)$(infodir)\
342 mkdir -p $(DESTDIR)${docdir}
343 cp doc/mes.dvi $(DESTDIR)${docdir}
346 mkdir -p $(DESTDIR)${docdir}
347 tar -cf- -C doc html | tar -xf- -C $(DESTDIR)${docdir}
350 mkdir -p $(DESTDIR)${docdir}
351 cp doc/mes.pdf $(DESTDIR)${docdir}
354 mkdir -p $(DESTDIR)${docdir}
355 cp doc/mes.ps $(DESTDIR)${docdir}
357 # We do not strip binaries, binutils' strip corrupts M1+hex2-generated ELFs
358 install-strip: install
362 Usage: make [OPTION]... [TARGET]...
364 Main and non-standard targets:
365 all update everything
366 all-go update .go files
367 gcc update src/mes.gcc-out
368 dist update $(TARBALL)
369 doc update documentation
370 mes-gcc update src/mes.mes-gcc-out
371 mes-tcc update src/mes.mes-tcc-out
374 clean run git clean -dfx
375 clean-go clean .go files
376 info update info documentation
377 install install in $(prefix)
378 install-info install info docs in $(prefix)/share/info
380 seed update mes-seed in $(MES_SEED)
381 uninstall uninstall from $(prefix)
387 include ${srcdest}build-aux/export.make