2018-11-09 04:22:51 +01:00
|
|
|
PREFIX ?= /usr/local
|
|
|
|
DATADIR ?= $(PREFIX)/share/RETRO12
|
|
|
|
DOCSDIR ?= $(PREFIX)/share/doc/RETRO12
|
|
|
|
EXAMPLESDIR ?= $(PREFIX)/share/examples/RETRO12
|
2019-02-20 17:15:30 +01:00
|
|
|
MANDIR ?= $(PREFIX)/man/man1
|
2018-11-09 04:22:51 +01:00
|
|
|
LIBM ?= -lm
|
|
|
|
|
2019-02-20 17:15:30 +01:00
|
|
|
RREIO ?= io/filesystem.o io/floatingpoint.o io/gopher.o io/unix.o io/strl.o
|
|
|
|
|
2018-11-09 04:22:51 +01:00
|
|
|
all: build
|
|
|
|
|
2019-02-20 17:15:30 +01:00
|
|
|
help:
|
|
|
|
|
2019-04-24 16:24:20 +02:00
|
|
|
build: dirs toolchain ngaImage bin/retro bin/retro-describe
|
2019-02-20 17:15:30 +01:00
|
|
|
|
2019-03-29 19:46:22 +01:00
|
|
|
optional: build bin/retro-repl
|
2019-02-20 17:15:30 +01:00
|
|
|
|
|
|
|
toolchain: dirs bin/retro-embedimage bin/retro-extend bin/retro-muri bin/retro-unu
|
2018-11-14 23:56:30 +01:00
|
|
|
|
|
|
|
dirs:
|
|
|
|
mkdir -p bin
|
2018-11-09 04:22:51 +01:00
|
|
|
|
|
|
|
clean:
|
2019-02-20 17:15:30 +01:00
|
|
|
rm -f bin/*
|
|
|
|
find . -name "*.o" -type f -delete
|
2018-11-09 04:22:51 +01:00
|
|
|
|
2019-04-24 16:24:20 +02:00
|
|
|
install: build install-data install-docs install-examples install-manpages
|
|
|
|
install -m 755 -d -- $(DESTDIR)$(PREFIX)/bin
|
|
|
|
install -c -m 755 bin/retro-embedimage $(DESTDIR)$(PREFIX)/bin/retro-embedimage
|
|
|
|
install -c -m 755 bin/retro-extend $(DESTDIR)$(PREFIX)/bin/retro-extend
|
|
|
|
install -c -m 755 bin/retro-muri $(DESTDIR)$(PREFIX)/bin/retro-muri
|
|
|
|
install -c -m 755 bin/retro $(DESTDIR)$(PREFIX)/bin/retro
|
|
|
|
install -c -m 755 bin/retro-unu $(DESTDIR)$(PREFIX)/bin/retro-unu
|
|
|
|
install -c -m 755 bin/retro-describe $(DESTDIR)$(PREFIX)/bin/retro-describe
|
|
|
|
|
|
|
|
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/retro-embedimage
|
|
|
|
install -c -m 755 -s bin/retro-extend $(DESTDIR)$(PREFIX)/bin/retro-extend
|
|
|
|
install -c -m 755 -s bin/retro-muri $(DESTDIR)$(PREFIX)/bin/retro-muri
|
|
|
|
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:
|
|
|
|
install -m 755 -d -- $(DESTDIR)$(DATADIR)
|
|
|
|
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)
|
|
|
|
|
|
|
|
install-manpages:
|
|
|
|
install -c -m 644 man/retro.1 $(MANDIR)/retro.1
|
|
|
|
install -c -m 644 man/retro-embedimage.1 $(MANDIR)/retro-embedimage.1
|
|
|
|
install -c -m 644 man/retro-extend.1 $(MANDIR)/retro-extend.1
|
|
|
|
install -c -m 644 man/retro-describe.1 $(MANDIR)/retro-describe.1
|
|
|
|
install -c -m 644 man/retro-muri.1 $(MANDIR)/retro-muri.1
|
|
|
|
install -c -m 644 man/retro-unu.1 $(MANDIR)/retro-unu.1
|
|
|
|
|
2018-11-09 04:22:51 +01:00
|
|
|
test: bin/retro
|
|
|
|
./bin/retro tests/test-core.forth
|
|
|
|
|
|
|
|
# Targets for development/interactive usage
|
|
|
|
|
2019-04-24 16:24:20 +02:00
|
|
|
glossary: doc/Glossary.txt doc/Glossary.html doc/Glossary-Concise.txt doc/Glossary-Names-and-Stack.txt
|
2018-11-09 04:22:51 +01:00
|
|
|
|
|
|
|
image: interfaces/image.c
|
|
|
|
|
|
|
|
js: bin/RETRO12.html
|
|
|
|
|
|
|
|
repl: bin/retro-repl
|
|
|
|
|
2019-04-24 16:24:20 +02:00
|
|
|
retro-describe: bin/retro-describe
|
|
|
|
|
2018-11-09 04:22:51 +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
|
|
|
|
|
|
|
|
# File targets.
|
|
|
|
|
2019-04-24 16:24:20 +02: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
|
|
|
|
|
|
|
|
bin/retro-describe: retro-describe.forth words.tsv
|
|
|
|
cat retro-describe.forth words.tsv >bin/retro-describe
|
|
|
|
|
2018-11-09 04:22:51 +01:00
|
|
|
bin/retro-embedimage: tools/embedimage.c
|
2019-02-20 17:15:30 +01:00
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o bin/retro-embedimage tools/embedimage.c
|
2018-11-09 04:22:51 +01:00
|
|
|
|
|
|
|
bin/retro-extend: tools/extend.c
|
2019-02-20 17:15:30 +01:00
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o bin/retro-extend tools/extend.c
|
2018-11-09 04:22:51 +01:00
|
|
|
|
|
|
|
bin/retro-injectimage-js: tools/injectimage-js.c
|
2019-02-20 17:15:30 +01:00
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o bin/retro-injectimage-js tools/injectimage-js.c
|
2018-11-09 04:22:51 +01:00
|
|
|
|
|
|
|
bin/retro-muri: tools/muri.c
|
2019-02-20 17:15:30 +01:00
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o bin/retro-muri tools/muri.c
|
2018-11-09 04:22:51 +01:00
|
|
|
|
|
|
|
bin/RETRO12.html: bin/retro-injectimage-js
|
|
|
|
./bin/retro-injectimage-js >bin/RETRO12.html
|
|
|
|
|
2019-04-24 16:24:20 +02:00
|
|
|
bin/retro-repl: interfaces/repl.c interfaces/image.c
|
|
|
|
cd interfaces && $(CC) $(CFLAGS) $(LDFLAGS) -o ../bin/retro-repl repl.c
|
|
|
|
|
2019-02-20 17:15:30 +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
|
|
|
|
cp ngaImage rre.image
|
2019-03-27 20:12:44 +01:00
|
|
|
./bin/retro-extend rre.image interfaces/io/filesystem.forth interfaces/io/gopher.forth interfaces/io/floatingpoint.forth interfaces/io/unix.forth interfaces/io/rng.forth interfaces/rre.forth
|
2019-02-20 17:15:30 +01:00
|
|
|
./bin/retro-embedimage rre.image >interfaces/rre_image.c
|
|
|
|
cd interfaces && $(CC) $(CFLAGS) $(LDFLAGS) -o ../bin/retro rre.c image-functions.o $(RREIO) $(LIBM)
|
2019-03-20 17:45:44 +01:00
|
|
|
cd package && ../bin/retro -f list
|
2019-02-20 17:15:30 +01:00
|
|
|
./bin/retro-embedimage rre.image >interfaces/rre_image.c
|
|
|
|
cd interfaces && $(CC) $(CFLAGS) $(LDFLAGS) -o ../bin/retro rre.c image-functions.o $(RREIO) $(LIBM)
|
|
|
|
rm rre.image
|
2018-11-09 04:22:51 +01:00
|
|
|
|
2019-04-24 16:24:20 +02:00
|
|
|
bin/retro-barebones: bin/retro-embedimage bin/retro-extend interfaces/image.c interfaces/barebones.c interfaces/barebones.forth
|
|
|
|
cp ngaImage barebones.image
|
|
|
|
./bin/retro-extend barebones.image interfaces/barebones.forth
|
|
|
|
./bin/retro-embedimage barebones.image >interfaces/barebones_image.c
|
|
|
|
rm barebones.image
|
|
|
|
cd interfaces && $(CC) $(CFLAGS) $(LDFLAGS) -o ../bin/retro-barebones barebones.c
|
|
|
|
|
|
|
|
bin/retro-unu: tools/unu.c
|
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o bin/retro-unu tools/unu.c
|
|
|
|
|
2018-11-09 04:22:51 +01:00
|
|
|
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
|
|
|
|
|
2019-02-20 17:15:30 +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-04-24 16:24:20 +02: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-09 04:22:51 +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-02-20 17:15:30 +01:00
|
|
|
./bin/retro-extend ngaImage literate/RetroForth.md
|
|
|
|
./bin/retro-embedimage ngaImage > interfaces/image.c
|
|
|
|
|
2019-04-24 16:24:20 +02:00
|
|
|
bin/retro-compiler: io bin/retro-extend interfaces/image.c interfaces/retro-compiler.c interfaces/retro-compiler-runtime.c interfaces/image-functions.o
|
|
|
|
cp ngaImage runtime.image
|
|
|
|
./bin/retro-extend runtime.image interfaces/io/filesystem.forth interfaces/io/gopher.forth interfaces/io/floatingpoint.forth interfaces/io/unix.forth interfaces/io/rng.forth interfaces/rre.forth
|
|
|
|
cd interfaces && $(CC) $(CFLAGS) $(LDFLAGS) -o ../retro-compiler-runtime retro-compiler-runtime.c image-functions.c $(RREIO) $(LIBM)
|
|
|
|
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-02-20 17:15:30 +01:00
|
|
|
io: interfaces/io/filesystem.o interfaces/io/floatingpoint.o interfaces/io/gopher.o interfaces/io/unix.o interfaces/io/strl.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-03-27 20:12:44 +01:00
|
|
|
interfaces/io/filesystem.o: interfaces/io/filesystem.forth interfaces/io/filesystem.c
|
|
|
|
cd interfaces/io && $(CC) $(CFLAGS) -c -o filesystem.o filesystem.c
|
2019-02-20 17:15:30 +01:00
|
|
|
|
2019-03-27 20:12:44 +01:00
|
|
|
interfaces/io/floatingpoint.o: interfaces/io/floatingpoint.forth interfaces/io/floatingpoint.c
|
|
|
|
cd interfaces/io && $(CC) $(CFLAGS) -c -o floatingpoint.o floatingpoint.c
|
2019-02-20 17:15:30 +01:00
|
|
|
|
2019-03-27 20:12:44 +01:00
|
|
|
interfaces/io/gopher.o: interfaces/io/gopher.forth interfaces/io/gopher.c
|
|
|
|
cd interfaces/io && $(CC) $(CFLAGS) -c -o gopher.o gopher.c
|
2019-02-20 17:15:30 +01:00
|
|
|
|
2019-03-27 20:12:44 +01:00
|
|
|
interfaces/io/unix.o: interfaces/io/unix.forth interfaces/io/unix.c
|
|
|
|
cd interfaces/io && $(CC) $(CFLAGS) -c -o unix.o unix.c
|
2019-02-20 17:15:30 +01:00
|
|
|
|
2019-04-24 16:24:20 +02:00
|
|
|
interfaces/io/strl.o: interfaces/io/strl.h interfaces/io/strl.c
|
2019-02-20 17:15:30 +01:00
|
|
|
cd interfaces/io && $(CC) $(CFLAGS) -c -o strl.o strl.c
|