2018-04-21 03:41:07 +02:00
|
|
|
PREFIX ?= /usr/local
|
|
|
|
DATADIR ?= $(PREFIX)/share/RETRO12
|
|
|
|
DOCSDIR ?= $(PREFIX)/share/doc/RETRO12
|
|
|
|
EXAMPLESDIR ?= $(PREFIX)/share/examples/RETRO12
|
2019-01-22 19:05:02 +01:00
|
|
|
MANDIR ?= $(PREFIX)/man/man1
|
2018-04-21 03:41:07 +02:00
|
|
|
LIBM ?= -lm
|
|
|
|
LIBCURSES ?= -lcurses
|
2018-02-06 02:35:41 +01:00
|
|
|
|
2019-01-16 17:00:19 +01:00
|
|
|
RREIO ?= io/filesystem.o io/floatingpoint.o io/gopher.o io/unix.o
|
|
|
|
RIIO ?= io/filesystem.o io/floatingpoint.o io/gopher.o io/unix.o
|
|
|
|
|
2018-04-21 03:41:07 +02:00
|
|
|
all: build
|
2018-04-19 17:31:30 +02:00
|
|
|
|
2019-02-05 22:50:06 +01:00
|
|
|
help:
|
|
|
|
|
2019-02-22 04:35:28 +01:00
|
|
|
build: dirs toolchain ngaImage bin/retro
|
2019-02-05 22:50:06 +01:00
|
|
|
|
|
|
|
optional: build bin/retro-ri bin/retro-repl
|
2019-02-05 21:22:17 +01:00
|
|
|
|
2019-02-06 22:53:58 +01:00
|
|
|
toolchain: dirs bin/retro-embedimage bin/retro-extend bin/retro-muri bin/retro-unu
|
2018-11-14 17:26:05 +01:00
|
|
|
|
|
|
|
dirs:
|
|
|
|
mkdir -p bin
|
2018-02-03 15:53:33 +01:00
|
|
|
|
|
|
|
clean:
|
2019-01-16 17:00:19 +01:00
|
|
|
rm -f bin/*
|
|
|
|
find . -name "*.o" -type f -delete
|
2018-02-03 15:53:33 +01:00
|
|
|
|
2019-01-22 19:05:02 +01:00
|
|
|
install: build install-data install-docs install-examples install-manpages
|
2018-04-21 03:41:07 +02:00
|
|
|
install -m 755 -d -- $(DESTDIR)$(PREFIX)/bin
|
2018-11-02 16:29:24 +01:00
|
|
|
install -c -m 755 bin/retro-embedimage $(DESTDIR)$(PREFIX)/bin/retro-embedimage
|
|
|
|
install -c -m 755 bin/retro-extend $(DESTDIR)$(PREFIX)/bin/retro-extend
|
2019-02-06 22:53:58 +01:00
|
|
|
# install -c -m 755 bin/retro-injectimage-js $(DESTDIR)$(PREFIX)/bin/retro-injectimage-js
|
2018-11-02 16:29:24 +01:00
|
|
|
install -c -m 755 bin/retro-muri $(DESTDIR)$(PREFIX)/bin/retro-muri
|
2019-02-06 14:20:46 +01:00
|
|
|
# install -c -m 755 bin/retro-repl $(DESTDIR)$(PREFIX)/bin/retro-repl
|
|
|
|
# install -c -m 755 bin/retro-ri $(DESTDIR)$(PREFIX)/bin/retro-ri
|
2018-11-04 22:34:56 +01:00
|
|
|
install -c -m 755 bin/retro $(DESTDIR)$(PREFIX)/bin/retro
|
2018-11-02 16:29:24 +01:00
|
|
|
install -c -m 755 bin/retro-unu $(DESTDIR)$(PREFIX)/bin/retro-unu
|
2018-04-21 03:41:07 +02:00
|
|
|
|
|
|
|
install-strip: build install-data install-docs install-examples
|
|
|
|
install -m 755 -d -- $(DESTDIR)/bin
|
2018-11-02 16:29:24 +01:00
|
|
|
install -c -m 755 -s bin/retro-embedimage $(DESTDIR)$(PREFIX)/bin/retro-embedimage
|
|
|
|
install -c -m 755 -s bin/retro-extend $(DESTDIR)$(PREFIX)/bin/retro-extend
|
2019-02-06 22:53:58 +01:00
|
|
|
# install -c -m 755 -s bin/retro-injectimage-js $(DESTDIR)$(PREFIX)/bin/retro-injectimage-js
|
2018-11-02 16:29:24 +01:00
|
|
|
install -c -m 755 -s bin/retro-muri $(DESTDIR)$(PREFIX)/bin/retro-muri
|
2019-02-06 14:20:46 +01:00
|
|
|
# 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
|
2018-11-04 22:34:56 +01:00
|
|
|
install -c -m 755 -s bin/retro $(DESTDIR)$(PREFIX)/bin/retro
|
2018-11-02 16:29:24 +01:00
|
|
|
install -c -m 755 -s bin/retro-unu $(DESTDIR)$(PREFIX)/bin/retro-unu
|
2018-04-21 03:41:07 +02:00
|
|
|
|
2019-02-06 22:53:58 +01:00
|
|
|
install-data:
|
2018-04-21 03:41:07 +02:00
|
|
|
install -m 755 -d -- $(DESTDIR)$(DATADIR)
|
2019-02-06 22:53:58 +01:00
|
|
|
# install -c -m 644 bin/RETRO12.html $(DESTDIR)$(DATADIR)/RETRO12.html
|
2018-04-21 03:41:07 +02:00
|
|
|
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)
|
2018-02-03 15:53:33 +01:00
|
|
|
|
2019-01-22 19:05:02 +01:00
|
|
|
install-manpages:
|
|
|
|
install -c -m 644 man/retro.1 $(MANDIR)/retro.1
|
2019-02-07 05:44:12 +01:00
|
|
|
install -c -m 644 man/retro-embedimage.1 $(MANDIR)/retro-embedimage.1
|
2019-02-07 05:36:53 +01:00
|
|
|
install -c -m 644 man/retro-extend.1 $(MANDIR)/retro-extend.1
|
2019-01-22 19:05:02 +01:00
|
|
|
install -c -m 644 man/retro-muri.1 $(MANDIR)/retro-muri.1
|
2019-02-07 05:36:53 +01:00
|
|
|
install -c -m 644 man/retro-unu.1 $(MANDIR)/retro-unu.1
|
2019-01-22 19:05:02 +01:00
|
|
|
|
|
|
|
|
2018-11-04 22:34:56 +01:00
|
|
|
test: bin/retro
|
|
|
|
./bin/retro tests/test-core.forth
|
2018-04-19 17:31:30 +02:00
|
|
|
|
|
|
|
# Targets for development/interactive usage
|
|
|
|
|
2019-02-26 15:31:43 +01:00
|
|
|
glossary: doc/Glossary.txt doc/Glossary.html doc/Glossary-Concise.txt doc/Glossary-Names-and-Stack.txt
|
2018-04-19 17:31:30 +02:00
|
|
|
|
|
|
|
image: interfaces/image.c
|
|
|
|
|
|
|
|
js: bin/RETRO12.html
|
|
|
|
|
2018-11-02 16:29:24 +01:00
|
|
|
repl: bin/retro-repl
|
2018-04-19 17:31:30 +02:00
|
|
|
|
2018-11-02 16:29:24 +01:00
|
|
|
ri: bin/retro-ri
|
2018-04-19 17:31:30 +02:00
|
|
|
|
2018-11-02 16:29:24 +01:00
|
|
|
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
|
2018-02-03 15:53:33 +01:00
|
|
|
|
2018-04-19 17:31:30 +02:00
|
|
|
# File targets.
|
|
|
|
|
2019-02-22 04:35:28 +01:00
|
|
|
ngaImage: literate/Rx.md literate/RetroForth.md bin/retro-muri bin/retro-extend
|
|
|
|
./bin/retro-muri literate/Rx.md
|
|
|
|
./bin/retro-extend ngaImage literate/RetroForth.md
|
|
|
|
|
2018-11-02 16:29:24 +01:00
|
|
|
bin/retro-embedimage: tools/embedimage.c
|
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o bin/retro-embedimage tools/embedimage.c
|
2018-04-19 17:31:30 +02:00
|
|
|
|
2018-11-02 16:29:24 +01:00
|
|
|
bin/retro-extend: tools/extend.c
|
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o bin/retro-extend tools/extend.c
|
2018-04-19 17:31:30 +02:00
|
|
|
|
2018-11-02 16:29:24 +01:00
|
|
|
bin/retro-injectimage-js: tools/injectimage-js.c
|
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o bin/retro-injectimage-js tools/injectimage-js.c
|
2018-04-19 17:31:30 +02:00
|
|
|
|
2018-11-02 16:29:24 +01:00
|
|
|
bin/retro-muri: tools/muri.c
|
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o bin/retro-muri tools/muri.c
|
2018-04-19 17:31:30 +02:00
|
|
|
|
2018-11-02 16:29:24 +01:00
|
|
|
bin/RETRO12.html: bin/retro-injectimage-js
|
|
|
|
./bin/retro-injectimage-js >bin/RETRO12.html
|
2018-04-19 17:31:30 +02:00
|
|
|
|
2018-11-02 16:29:24 +01:00
|
|
|
bin/retro-repl: interfaces/repl.c interfaces/image.c
|
|
|
|
cd interfaces && $(CC) $(CFLAGS) $(LDFLAGS) -o ../bin/retro-repl repl.c
|
2018-02-03 15:53:33 +01:00
|
|
|
|
2019-01-19 18:28:17 +01:00
|
|
|
bin/retro-ri: io bin/retro-embedimage bin/retro-extend interfaces/ri_image.c interfaces/ri.c interfaces/ri.forth interfaces/image-functions.o interfaces/io/rng.forth
|
2019-01-10 19:18:27 +01:00
|
|
|
cp ngaImage ri.image
|
2019-01-19 18:28:17 +01:00
|
|
|
./bin/retro-extend ri.image interfaces/io/io_filesystem.forth interfaces/io/io_gopher.forth interfaces/io/io_floatingpoint.forth interfaces/io/io_unix_syscalls.forth interfaces/io/rng.forth interfaces/ri.forth
|
2019-01-10 19:18:27 +01:00
|
|
|
./bin/retro-embedimage ri.image >interfaces/ri_image.c
|
|
|
|
rm ri.image
|
2019-01-16 17:00:19 +01:00
|
|
|
cd interfaces && $(CC) $(CFLAGS) $(LDFLAGS) -o ../bin/retro-ri $(LIBCURSES) $(LIBM) ri.c image-functions.o $(RIIO)
|
2018-04-19 17:31:30 +02:00
|
|
|
|
2019-01-19 18:28:17 +01:00
|
|
|
bin/retro: io bin/retro-embedimage bin/retro-extend interfaces/image.c interfaces/rre.c interfaces/rre.forth interfaces/image-functions.o interfaces/io/rng.forth
|
2019-01-10 19:18:27 +01:00
|
|
|
cp ngaImage rre.image
|
2019-01-19 18:28:17 +01:00
|
|
|
./bin/retro-extend rre.image interfaces/io/io_filesystem.forth interfaces/io/io_gopher.forth interfaces/io/io_floatingpoint.forth interfaces/io/io_unix_syscalls.forth interfaces/io/rng.forth interfaces/rre.forth
|
2019-01-10 19:18:27 +01:00
|
|
|
./bin/retro-embedimage rre.image >interfaces/rre_image.c
|
2019-01-16 17:00:19 +01:00
|
|
|
cd interfaces && $(CC) $(CFLAGS) $(LDFLAGS) -o ../bin/retro $(LIBM) rre.c image-functions.o $(RREIO)
|
2019-02-26 14:47:41 +01:00
|
|
|
cd package && ../bin/retro -f list
|
2019-02-06 14:09:35 +01:00
|
|
|
./bin/retro-embedimage rre.image >interfaces/rre_image.c
|
|
|
|
cd interfaces && $(CC) $(CFLAGS) $(LDFLAGS) -o ../bin/retro $(LIBM) rre.c image-functions.o $(RREIO)
|
|
|
|
rm rre.image
|
2018-04-18 17:45:54 +02:00
|
|
|
|
2019-01-16 17:00:19 +01:00
|
|
|
bin/retro-barebones: bin/retro-embedimage bin/retro-extend interfaces/image.c interfaces/barebones.c interfaces/barebones.forth
|
2019-01-10 19:18:27 +01:00
|
|
|
cp ngaImage barebones.image
|
|
|
|
./bin/retro-extend barebones.image interfaces/barebones.forth
|
|
|
|
./bin/retro-embedimage barebones.image >interfaces/barebones_image.c
|
|
|
|
rm barebones.image
|
2018-11-02 16:29:24 +01:00
|
|
|
cd interfaces && $(CC) $(CFLAGS) $(LDFLAGS) -o ../bin/retro-barebones barebones.c
|
2018-10-01 16:56:49 +02:00
|
|
|
|
2018-11-02 16:29:24 +01:00
|
|
|
bin/retro-unu: tools/unu.c
|
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o bin/retro-unu tools/unu.c
|
2018-02-06 16:36:34 +01:00
|
|
|
|
2018-11-04 22:34:56 +01:00
|
|
|
doc/Glossary.txt: bin/retro words.tsv
|
2018-04-21 03:41:07 +02:00
|
|
|
LC_ALL=C sort -o sorted.tsv words.tsv
|
2018-02-03 15:53:33 +01:00
|
|
|
mv sorted.tsv words.tsv
|
2018-11-04 22:34:56 +01:00
|
|
|
./bin/retro glossary.forth export glossary >doc/Glossary.txt
|
2018-04-19 17:31:30 +02:00
|
|
|
|
2019-01-23 20:13:01 +01:00
|
|
|
doc/Glossary.html: bin/retro words.tsv
|
|
|
|
LC_ALL=C sort -o sorted.tsv words.tsv
|
|
|
|
mv sorted.tsv words.tsv
|
|
|
|
./bin/retro glossary.forth export html >doc/Glossary.html
|
|
|
|
|
2019-02-26 15:31:43 +01:00
|
|
|
doc/Glossary-Concise.txt: bin/retro words.tsv
|
|
|
|
LC_ALL=C sort -o sorted.tsv words.tsv
|
|
|
|
mv sorted.tsv words.tsv
|
|
|
|
./bin/retro glossary.forth export concise >doc/Glossary-Concise.txt
|
|
|
|
|
|
|
|
doc/Glossary-Names-and-Stack.txt: bin/retro words.tsv
|
|
|
|
LC_ALL=C sort -o sorted.tsv words.tsv
|
|
|
|
mv sorted.tsv words.tsv
|
|
|
|
./bin/retro glossary.forth export concise-stack >doc/Glossary-Names-and-Stack.txt
|
|
|
|
|
|
|
|
|
2018-11-02 16:29:24 +01:00
|
|
|
interfaces/image.c: bin/retro-embedimage bin/retro-extend bin/retro-muri literate/RetroForth.md literate/Rx.md
|
|
|
|
./bin/retro-muri literate/Rx.md
|
2019-01-10 19:18:27 +01:00
|
|
|
./bin/retro-extend ngaImage literate/RetroForth.md
|
|
|
|
./bin/retro-embedimage ngaImage > interfaces/image.c
|
2019-01-11 04:51:57 +01:00
|
|
|
|
2019-01-16 17:00:19 +01:00
|
|
|
bin/retro-compiler: io bin/retro-extend interfaces/image.c interfaces/retro-compiler.c interfaces/retro-compiler-runtime.c interfaces/image-functions.o
|
2019-01-11 04:51:57 +01:00
|
|
|
cp ngaImage runtime.image
|
2019-02-14 20:34:03 +01:00
|
|
|
./bin/retro-extend runtime.image interfaces/io/io_filesystem.forth interfaces/io/io_gopher.forth interfaces/io/io_floatingpoint.forth interfaces/io/io_unix_syscalls.forth interfaces/io/rng.forth interfaces/rre.forth
|
|
|
|
cd interfaces && $(CC) $(CFLAGS) $(LDFLAGS) -o ../retro-compiler-runtime $(LIBM) retro-compiler-runtime.c image-functions.c $(RREIO)
|
2019-01-11 04:51:57 +01:00
|
|
|
cd interfaces && $(CC) $(CFLAGS) $(LDFLAGS) -o ../bin/retro-compiler retro-compiler.c
|
|
|
|
objcopy --add-section .ngaImage=runtime.image --set-section-flags .ngaImage=noload,readonly bin/retro-compiler
|
|
|
|
objcopy --add-section .runtime=retro-compiler-runtime --set-section-flags .runtime=noload,readonly bin/retro-compiler
|
|
|
|
rm runtime.image retro-compiler-runtime
|
2019-01-11 22:51:21 +01:00
|
|
|
|
2019-01-16 17:00:19 +01:00
|
|
|
io: interfaces/io/filesystem.o interfaces/io/floatingpoint.o interfaces/io/gopher.o interfaces/io/unix.o
|
|
|
|
|
|
|
|
interfaces/image-functions.o: interfaces/image-functions.c interfaces/image-functions.h
|
|
|
|
cd interfaces && $(CC) $(CFLAGS) -c -o image-functions.o image-functions.c
|
2019-01-11 22:51:21 +01:00
|
|
|
|
2019-01-16 17:00:19 +01:00
|
|
|
interfaces/io/filesystem.o: interfaces/io/io_filesystem.forth interfaces/io/io_filesystem.c
|
2019-01-11 22:51:21 +01:00
|
|
|
cd interfaces/io && $(CC) $(CFLAGS) -c -o filesystem.o io_filesystem.c
|
2019-01-16 17:00:19 +01:00
|
|
|
|
|
|
|
interfaces/io/floatingpoint.o: interfaces/io/io_floatingpoint.forth interfaces/io/io_floatingpoint.c
|
2019-01-11 22:51:21 +01:00
|
|
|
cd interfaces/io && $(CC) $(CFLAGS) -c -o floatingpoint.o io_floatingpoint.c
|
2019-01-16 17:00:19 +01:00
|
|
|
|
|
|
|
interfaces/io/gopher.o: interfaces/io/io_gopher.forth interfaces/io/io_gopher.c
|
2019-01-11 22:51:21 +01:00
|
|
|
cd interfaces/io && $(CC) $(CFLAGS) -c -o gopher.o io_gopher.c
|
2019-01-16 17:00:19 +01:00
|
|
|
|
|
|
|
interfaces/io/unix.o: interfaces/io/io_unix_syscalls.forth interfaces/io/io_unix_syscalls.c
|
2019-01-11 22:51:21 +01:00
|
|
|
cd interfaces/io && $(CC) $(CFLAGS) -c -o unix.o io_unix_syscalls.c
|