From a2ab26fc642f117161253b291912394b7210385b Mon Sep 17 00:00:00 2001 From: crc Date: Fri, 9 Nov 2018 03:22:51 +0000 Subject: [PATCH] add Linux Makefile FossilOrigin-Name: ce9a54a1cd49c8cdee43662d2af8e8717ee2b6aea47b8662d958b8750e6bed0e --- Makefile.linux | 131 +++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 6 +-- 2 files changed, 134 insertions(+), 3 deletions(-) create mode 100644 Makefile.linux diff --git a/Makefile.linux b/Makefile.linux new file mode 100644 index 0000000..5c057dc --- /dev/null +++ b/Makefile.linux @@ -0,0 +1,131 @@ +PREFIX ?= /usr/local +DATADIR ?= $(PREFIX)/share/RETRO12 +DOCSDIR ?= $(PREFIX)/share/doc/RETRO12 +EXAMPLESDIR ?= $(PREFIX)/share/examples/RETRO12 +LIBM ?= -lm +LIBCURSES ?= -lcurses + +all: build + +build: bin/retro-embedimage bin/retro-extend bin/retro-injectimage-js bin/retro-muri bin/RETRO12.html bin/retro bin/retro-repl bin/retro-unu + +clean: + rm -f bin/retro-embedimage + rm -f bin/retro-extend + rm -f bin/retro-injectimage-js + rm -f bin/retro-muri + rm -f bin/RETRO12.html + rm -f bin/retro-repl + rm -f bin/retro-ri + rm -f bin/retro + rm -f bin/retro-unu + +install: build install-data install-docs install-examples + install -m 755 -d -- $(DESTDIR)$(PREFIX)/bin + install -c -m 755 bin/retro-embedimage $(DESTDIR)$(PREFIX)/bin/embedimage + install -c -m 755 bin/retro-extend $(DESTDIR)$(PREFIX)/bin/extend + install -c -m 755 bin/retro-injectimage-js $(DESTDIR)$(PREFIX)/bin/injectimage-js + install -c -m 755 bin/retro-muri $(DESTDIR)$(PREFIX)/bin/retro-muri + install -c -m 755 bin/retro-repl $(DESTDIR)$(PREFIX)/bin/retro-repl + install -c -m 755 bin/retro-ri $(DESTDIR)$(PREFIX)/bin/retro-ri + install -c -m 755 bin/retro $(DESTDIR)$(PREFIX)/bin/retro + install -c -m 755 bin/retro-unu $(DESTDIR)$(PREFIX)/bin/retro-unu + +install-strip: build install-data install-docs install-examples + install -m 755 -d -- $(DESTDIR)/bin + install -c -m 755 -s bin/retro-embedimage $(DESTDIR)$(PREFIX)/bin/embedimage + install -c -m 755 -s bin/retro-extend $(DESTDIR)$(PREFIX)/bin/extend + install -c -m 755 -s bin/retro-injectimage-js $(DESTDIR)$(PREFIX)/bin/injectimage-js + install -c -m 755 -s bin/retro-muri $(DESTDIR)$(PREFIX)/bin/retro-muri + install -c -m 755 -s bin/retro-repl $(DESTDIR)$(PREFIX)/bin/retro-repl + install -c -m 755 -s bin/retro-ri $(DESTDIR)$(PREFIX)/bin/retro-ri + install -c -m 755 -s bin/retro $(DESTDIR)$(PREFIX)/bin/retro + install -c -m 755 -s bin/retro-unu $(DESTDIR)$(PREFIX)/bin/retro-unu + +install-data: bin/RETRO12.html + install -m 755 -d -- $(DESTDIR)$(DATADIR) + install -c -m 644 bin/RETRO12.html $(DESTDIR)$(DATADIR)/RETRO12.html + install -c -m 644 glossary.forth $(DESTDIR)$(DATADIR)/glossary.forth + install -c -m 644 ngaImage $(DESTDIR)$(DATADIR)/ngaImage + cp -fpR tests $(DESTDIR)$(DATADIR)/ + install -c -m 644 words.tsv $(DESTDIR)$(DATADIR)/words.tsv + +install-docs: + install -m 755 -d -- $(DESTDIR)$(DOCSDIR) + cp -fpR doc $(DESTDIR)$(DOCSDIR) + cp -fpR literate $(DESTDIR)$(DOCSDIR) + install -c -m 644 README.md $(DESTDIR)$(DOCSDIR)/README.md + install -c -m 644 RELEASE_NOTES.md $(DESTDIR)$(DOCSDIR)/RELEASE_NOTES.md + +install-examples: + install -m 755 -d -- $(DESTDIR)$(EXAMPLESDIR) + cp -fpR example $(DESTDIR)$(EXAMPLESDIR) + +test: bin/retro + ./bin/retro tests/test-core.forth + +# Targets for development/interactive usage + +glossary: doc/Glossary.txt + +image: interfaces/image.c + +js: bin/RETRO12.html + +repl: bin/retro-repl + +ri: bin/retro-ri + +update: bin/retro-unu literate/Unu.md literate/Muri.md + ./bin/retro-unu literate/Unu.md >tools/unu.c + ./bin/retro-unu literate/Muri.md >tools/muri.c + +# File targets. + +bin/retro-embedimage: tools/embedimage.c + $(CC) $(CFLAGS) $(LDFLAGS) -o bin/retro-embedimage tools/embedimage.c + +bin/retro-extend: tools/extend.c + $(CC) $(CFLAGS) $(LDFLAGS) -o bin/retro-extend tools/extend.c + +bin/retro-injectimage-js: tools/injectimage-js.c + $(CC) $(CFLAGS) $(LDFLAGS) -o bin/retro-injectimage-js tools/injectimage-js.c + +bin/retro-muri: tools/muri.c + $(CC) $(CFLAGS) $(LDFLAGS) -o bin/retro-muri tools/muri.c + +bin/RETRO12.html: bin/retro-injectimage-js + ./bin/retro-injectimage-js >bin/RETRO12.html + +bin/retro-repl: interfaces/repl.c interfaces/image.c + cd interfaces && $(CC) $(CFLAGS) $(LDFLAGS) -o ../bin/retro-repl repl.c + +bin/retro-ri: interfaces/ri.c interfaces/image.c + cd interfaces && $(CC) $(CFLAGS) $(LDFLAGS) -o ../bin/retro-ri $(LIBCURSES) ri.c + +bin/retro: bin/retro-embedimage bin/retro-extend interfaces/image.c interfaces/rre.c interfaces/rre.forth + cp ngaImage cleanImage + ./bin/retro-extend interfaces/rre.forth + ./bin/retro-embedimage >interfaces/rre_image_unix.c + mv cleanImage ngaImage + cd interfaces && $(CC) $(CFLAGS) $(LDFLAGS) -o ../bin/retro rre.c $(LIBM) + +bin/barebones: bin/retro-embedimage bin/retro-extend interfaces/image.c interfaces/barebones.c interfaces/barebones.forth + cp ngaImage cleanImage + ./bin/retro-extend interfaces/barebones.forth + ./bin/retro-embedimage >interfaces/barebones_image.c + mv cleanImage ngaImage + cd interfaces && $(CC) $(CFLAGS) $(LDFLAGS) -o ../bin/barebones barebones.c + +bin/retro-unu: tools/unu.c + $(CC) $(CFLAGS) $(LDFLAGS) -o bin/retro-unu tools/unu.c + +doc/Glossary.txt: bin/retro words.tsv + LC_ALL=C sort -o sorted.tsv words.tsv + mv sorted.tsv words.tsv + ./bin/retro glossary.forth export glossary >doc/Glossary.txt + +interfaces/image.c: bin/retro-embedimage bin/retro-extend bin/retro-muri literate/RetroForth.md literate/Rx.md + ./bin/retro-muri literate/Rx.md + ./bin/retro-extend literate/RetroForth.md + ./bin/retro-embedimage > interfaces/image.c diff --git a/README.md b/README.md index 557e169..5613a91 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,9 @@ For most systems (FreeBSD, NetBSD, macOS, Linux): make -You will need a standard C compiler and `make`. The `ri` binary -requires (n)curses, but you can ignore any build/link errors by -doing: +You will need a standard C compiler and `make`. The `retro-ri` +binary requires (n)curses, but you can ignore any build/link +errors by doing: make -kis