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
|
|
|
|
LIBCURSES ?= -lcurses
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
build: dirs toolchain bin/retro
|
|
|
|
|
|
|
|
optional: build bin/retro-ri bin/retro-repl
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
test: bin/retro
|
|
|
|
./bin/retro tests/test-core.forth
|
|
|
|
|
|
|
|
# Targets for development/interactive usage
|
|
|
|
|
2019-02-20 17:15:30 +01:00
|
|
|
glossary: doc/Glossary.txt doc/Glossary.html
|
2018-11-09 04:22:51 +01:00
|
|
|
|
|
|
|
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
|
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-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
|
|
|
|
./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
|
|
|
|
./bin/retro-embedimage rre.image >interfaces/rre_image.c
|
|
|
|
cd interfaces && $(CC) $(CFLAGS) $(LDFLAGS) -o ../bin/retro rre.c image-functions.o $(RREIO) $(LIBM)
|
|
|
|
cd packages && ../bin/retro -f list
|
|
|
|
./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
|
|
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
interfaces/io/filesystem.o: interfaces/io/io_filesystem.forth interfaces/io/io_filesystem.c
|
|
|
|
cd interfaces/io && $(CC) $(CFLAGS) -c -o filesystem.o io_filesystem.c
|
|
|
|
|
|
|
|
interfaces/io/floatingpoint.o: interfaces/io/io_floatingpoint.forth interfaces/io/io_floatingpoint.c
|
|
|
|
cd interfaces/io && $(CC) $(CFLAGS) -c -o floatingpoint.o io_floatingpoint.c
|
|
|
|
|
|
|
|
interfaces/io/gopher.o: interfaces/io/io_gopher.forth interfaces/io/io_gopher.c
|
|
|
|
cd interfaces/io && $(CC) $(CFLAGS) -c -o gopher.o io_gopher.c
|
|
|
|
|
|
|
|
interfaces/io/unix.o: interfaces/io/io_unix_syscalls.forth interfaces/io/io_unix_syscalls.c
|
|
|
|
cd interfaces/io && $(CC) $(CFLAGS) -c -o unix.o io_unix_syscalls.c
|
|
|
|
|
|
|
|
interfaces/io/strl.o: interfaces/io/strl.c
|
|
|
|
cd interfaces/io && $(CC) $(CFLAGS) -c -o strl.o strl.c
|