diff --git a/ueforth/Makefile b/ueforth/Makefile index 9334fd5..da789f5 100644 --- a/ueforth/Makefile +++ b/ueforth/Makefile @@ -1,74 +1,104 @@ -CFLAGS=-O2 -Wall -Werror -I./ -I./out +OUT = out +GEN = $(OUT)/gen +RES = $(OUT)/resources +WEB = $(OUT)/web +POSIX = $(OUT)/posix +ARDUINO = $(OUT)/arduino + +CFLAGS=-O2 -Wall -Werror -I ./ -I $(OUT) LIBS=-ldl -TARGETS = out/web/terminal.html \ - out/web/ueforth.js \ - out/posix/ueforth \ - out/arduino/ueforth.ino +TARGETS = $(WEB)/terminal.html \ + $(WEB)/ueforth.js \ + $(POSIX)/ueforth \ + $(ARDUINO)/ueforth.ino -all: $(TARGETS) tests +all: $(TARGETS) $(RES)/eforth.ico tests tests: core_test -core_test: out/posix/ueforth common/core_test.fs \ +core_test: $(POSIX)/ueforth common/core_test.fs \ common/core_test.fs.golden echo "include common/core_test.fs" | $< | \ diff - common/core_test.fs.golden -out/gen: - mkdir -p out/gen +$(GEN): + mkdir -p $@ POSIX_BOOT = common/boot.fs posix/posix.fs -out/gen/posix_boot.h: common/source_to_string.js $(POSIX_BOOT) | out/gen +$(GEN)/posix_boot.h: common/source_to_string.js $(POSIX_BOOT) | $(GEN) echo "ok" | cat $(POSIX_BOOT) - | $< boot >$@ ARDUINO_BOOT = common/boot.fs -out/gen/arduino_boot.h: common/source_to_string.js $(ARDUINO_BOOT) | out/gen +$(GEN)/arduino_boot.h: common/source_to_string.js $(ARDUINO_BOOT) | $(GEN) echo "ok" | cat $(ARDUINO_BOOT) - | $< boot >$@ -out/gen/dump_web_opcodes: web/dump_web_opcodes.c common/opcodes.h | out/gen +$(GEN)/dump_web_opcodes: web/dump_web_opcodes.c common/opcodes.h | $(GEN) $(CC) $(CFLAGS) $< -o $@ -out/gen/web_cases.js: out/gen/dump_web_opcodes | out/gen +$(GEN)/web_cases.js: $(GEN)/dump_web_opcodes | $(GEN) $< cases >$@ -out/gen/web_dict.js: out/gen/dump_web_opcodes | out/gen +$(GEN)/web_dict.js: $(GEN)/dump_web_opcodes | $(GEN) $< dict >$@ -out/web: - mkdir -p out/web +$(RES): + mkdir -p $@ -out/web/terminal.html: web/terminal.html | out/web +$(RES)/eforth16x16.png: images/eforth.png | $(RES) + convert -resize 16x16 $< $@ + +$(RES)/eforth32x32.png: images/eforth.png | $(RES) + convert -resize 32x32 $< $@ + +$(RES)/eforth48x48.png: images/eforth.png | $(RES) + convert -resize 48x48 $< $@ + +$(RES)/eforth256x256.png: images/eforth.png | $(RES) + convert -resize 256x256 $< $@ + +ICON_SIZES = $(RES)/eforth256x256.png \ + $(RES)/eforth48x48.png \ + $(RES)/eforth32x32.png \ + $(RES)/eforth16x16.png + +$(RES)/eforth.ico: $(ICON_SIZES) + convert $^ $< $@ + +$(WEB): + mkdir -p $(WEB) + +$(WEB)/terminal.html: web/terminal.html | $(WEB) cp $< $@ -out/web/ueforth.js: \ +$(WEB)/ueforth.js: \ web/fuse_web.js \ web/web.template.js \ common/boot.fs \ - out/gen/web_dict.js \ - out/gen/web_cases.js | out/web + $(GEN)/web_dict.js \ + $(GEN)/web_cases.js | $(WEB) $^ >$@ -out/posix: - mkdir -p out/posix +$(POSIX): + mkdir -p $@ -out/posix/ueforth: \ +$(POSIX)/ueforth: \ posix/posix_main.c \ common/opcodes.h \ common/core.h \ - out/gen/posix_boot.h | out/posix + $(GEN)/posix_boot.h | $(POSIX) $(CC) $(CFLAGS) $< -o $@ $(LIBS) -out/arduino: - mkdir -p out/arduino +$(ARDUINO): + mkdir -p $@ -out/arduino/ueforth.ino: \ +$(ARDUINO)/ueforth.ino: \ arduino/fuse_ino.js \ arduino/arduino.template.ino \ common/opcodes.h \ common/core.h \ - out/gen/arduino_boot.h | out/arduino + $(GEN)/arduino_boot.h | $(ARDUINO) $^ >$@ clean: - rm -rf out/ + rm -rf $(OUT) diff --git a/ueforth/images/eforth.png b/ueforth/images/eforth.png new file mode 100755 index 0000000..9ffa13c Binary files /dev/null and b/ueforth/images/eforth.png differ