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
114 # Mes does not cache anything on the file system; therefore clean
124 etags ${srcdest}lib/*.c ${srcdest}lib/*/*.c ${srcdest}src/*.c ${srcdest}include/*.h ${srcdest}include/sys/*.h
127 ${srcdest}build-aux/build-guile.sh
130 rm -f $(shell find . -name '*.go')
135 # Mes does not feature post-install checks yet, so we're great!
145 seed: all-go mes-gcc mes-tcc
147 cd $(TINYCC_SEED) && MES_PREFIX=$(PWD) ./refresh.sh
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 doc/version.texi: ${srcdest}doc/mes.texi GNUmakefile
164 (set `LANG= date -r $< +'%d %B %Y'`;\
165 echo "@set UPDATED $$1 $$2 $$3"; \
166 echo "@set UPDATED-MONTH $$2 $$3"; \
167 echo "@set EDITION $(VERSION)"; \
168 echo "@set VERSION $(VERSION)") > $@
170 doc: doc/version.texi
174 $(warning skipping info: no makeinfo)
180 $(warning skipping man: no help2man)
185 doc/mes.info: ${srcdest}doc/mes.texi doc/version.texi ${srcdest}doc/images/gcc-mesboot-graph.dot GNUmakefile
186 $(MAKEINFO) -o $@ -I doc -I doc $<
188 doc/images/%.eps: ${srcdest}doc/images/%.dot
190 $(DOT) -T eps $< > $@
195 doc/images/%.pdf: ${srcdest}doc/images/%.dot
197 $(DOT) -T pdf $< > $@
202 doc/images/%.png: ${srcdest}doc/images/%.dot
204 $(DOT) -T png $< > $@
207 $(warning info: graphvis missing: no images)
210 man: doc/mes.1 doc/mescc.1
212 # disable builtin-rules
221 doc/mes.1: src/mes | build
222 MES_ARENA=10000000 ./pre-inst-env $(HELP2MAN) $(<F) > $@
224 doc/mescc.1: src/mes scripts/mescc | build
225 MES_ARENA=10000000 ./pre-inst-env $(HELP2MAN) $(<F) > $@
227 html: doc/html/index.html
229 doc/html/index.html: ${srcdest}doc/mes.texi doc/version.texi doc/images/gcc-mesboot-graph.png
230 $(MAKEINFO) --html -o $(@D) -I ${srcdest}doc -I doc $<
234 doc/mes.dvi: ${srcdest}doc/mes.texi
235 $(MAKEINFO) --dvi -I ${srcdest}doc -I doc -o doc/mes.dvi $<
239 doc/mes.pdf: ${srcdest}doc/mes.texi
240 $(MAKEINFO) --pdf -I ${srcdest}doc -I doc -o doc/mes.pdf $<
244 doc/mes.ps: ${srcdest}doc/mes.texi
245 $(MAKEINFO) --ps -I ${srcdest}doc -I doc -o doc/mes.ps $<
248 doc/images/gcc-mesboot-graph.eps\
249 doc/images/gcc-mesboot-graph.pdf\
250 doc/images/gcc-mesboot-graph.png
252 web: info $(WEB_IMAGES)
253 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"
256 COMMIT=$(shell test -d ${srcdest}.git && (cd ${srcdir} && git describe --dirty 2>/dev/null) || cat ${srcdest}.tarball-version)
257 TARBALL_VERSION=$(COMMIT:v%=%)
258 TARBALL_DIR:=$(PACKAGE)-$(TARBALL_VERSION)
259 TARBALL:=$(TARBALL_DIR).tar.gz
264 GIT_ARCHIVE_HEAD:=git archive HEAD --
265 GIT_LS_FILES:=git ls-files
266 ifeq ($(wildcard .git),)
267 GIT_ARCHIVE_HEAD:=tar -cf-
277 test ! -d .git || git diff --exit-code > /dev/null
278 test ! -d .git || git diff --cached --exit-code > /dev/null
279 @echo commit:$(COMMIT)
282 $(PERL) ${srcdest}build-aux/gitlog-to-changelog --srcdir=${srcdir} > $@
283 cat ChangeLog >> generate-ChangeLog
284 mv generate-ChangeLog ChangeLog
286 $(TARBALL): .tarball-version | generate-ChangeLog
288 --exclude=$(TARBALL_DIR);\
289 echo $^ | tr ' ' '\n')\
290 | GZIP=-n tar --sort=name --mtime=@0 --owner=0 --group=0 --numeric-owner\
291 --transform=s,^,$(TARBALL_DIR)/,S -T- -czf $@
292 git checkout ChangeLog
295 update-hash: $(TARBALL)
296 $(GUIX) download file://$(PWD)/$<
297 sed -i -e 's,(base32 #!mes!# "[^"]*"),(base32 #!mes!# "$(shell $(GUIX) hash $<)"),' guix/git/mes.scm
300 $(warning update-hash: no guix)
304 ./pre-inst-env $(GUIX) build mes@$(VERSION) --with-source=$(TARBALL)
306 GPG_KEY_ID:=1A858392E331EAFDB8C27FFBF3C1A0D9C1D65273
308 ../gnulib/build-aux/announce-gen\
309 --release-type=alpha\
311 --previous-version='0.16 '\
312 --current-version=$(VERSION)\
313 --gpg-key-id=$(GPG_KEY_ID)\
314 --url-directory=https://alpha.gnu.org/gnu/mes\
316 > doc/announce/ANNOUNCE-$(VERSION)-
319 installdirs: mkinstalldirs
322 $(DESTDIR)$(datadir)\
324 $(DESTDIR)$(infodir)\
328 mkdir -p $(DESTDIR)${docdir}
329 cp doc/mes.dvi $(DESTDIR)${docdir}
332 mkdir -p $(DESTDIR)${docdir}
333 tar -cf- -C doc html | tar -xf- -C $(DESTDIR)${docdir}
336 mkdir -p $(DESTDIR)${docdir}
337 cp doc/mes.pdf $(DESTDIR)${docdir}
340 mkdir -p $(DESTDIR)${docdir}
341 cp doc/mes.ps $(DESTDIR)${docdir}
343 # We do not strip binaries, binutils' strip corrupts M1+hex2-generated ELFs
344 install-strip: install
348 Usage: make [OPTION]... [TARGET]...
350 Main and non-standard targets:
351 all update everything
352 all-go update .go files
353 gcc update src/mes.gcc-out
354 dist update $(TARBALL)
355 doc update documentation
356 mes-gcc update src/mes.mes-gcc-out
357 mes-tcc update src/mes.mes-tcc-out
360 clean run git clean -dfx
361 clean-go clean .go files
362 info update info documentation
363 install install in $(prefix)
364 install-info install info docs in $(prefix)/share/info
366 seed update mes-seed in $(MES_SEED)
367 uninstall uninstall from $(prefix)
373 include ${srcdest}build-aux/export.make