From 591799053d20c5d5e3ca5566c55c59a056a5f749 Mon Sep 17 00:00:00 2001 From: Brad Nelson Date: Fri, 12 Feb 2021 14:11:29 -0800 Subject: [PATCH] Refactor --- ueforth/Makefile | 53 ++++++++++++---------------- ueforth/arduino/arduino.template.ino | 5 +++ ueforth/arduino/fuse_ino.js | 16 +++++---- ueforth/site/ESP32forth.html | 2 +- ueforth/site/linux.html | 2 +- ueforth/site/windows.html | 4 +-- 6 files changed, 42 insertions(+), 40 deletions(-) diff --git a/ueforth/Makefile b/ueforth/Makefile index c1f82e4..7991eac 100644 --- a/ueforth/Makefile +++ b/ueforth/Makefile @@ -1,4 +1,5 @@ -VERSION=7.0.1 +VERSION=7.0 +REVISION=$(shell git rev-parse HEAD) OUT = out GEN = $(OUT)/gen @@ -53,7 +54,7 @@ WIN_LFLAGS64 = /LIBPATH:"c:/Program Files (x86)/Microsoft SDKs/Windows/v7.1A/Lib TARGETS = $(WEB)/terminal.html \ $(WEB)/ueforth.js \ $(POSIX)/ueforth \ - $(ARDUINO)/ESP32forth-$(VERSION)/ESP32forth-$(VERSION).ino + $(ARDUINO)/ESP32forth/ESP32forth.ino FINDQ = find 2>/dev/null @@ -241,48 +242,40 @@ $(WINDOWS)/uEf64.exe: \ # ---- ARDUINO ---- -$(ARDUINO)/ESP32forth-$(VERSION): +$(ARDUINO)/ESP32forth: mkdir -p $@ -$(ARDUINO)/ESP32forth-$(VERSION)/ESP32forth-$(VERSION).ino: \ - arduino/fuse_ino.js \ - arduino/arduino.template.ino \ - common/opcodes.h \ - common/calling.h \ - common/core.h \ - common/interp.h \ - $(GEN)/arduino_boot.h | $(ARDUINO)/ESP32forth-$(VERSION) - $^ >$@ +ARDUINO_PARTS = arduino/arduino.template.ino \ + common/opcodes.h \ + common/calling.h \ + common/core.h \ + common/interp.h \ + $(GEN)/arduino_boot.h + +$(ARDUINO)/ESP32forth/ESP32forth.ino: \ + arduino/fuse_ino.js $(ARDUINO_PARTS) | $(ARDUINO)/ESP32forth + $< "$(VERSION)" "$(REVISION)" $(ARDUINO_PARTS) >$@ # ---- PACKAGE ---- -$(ARDUINO)/ESP32forth-$(VERSION).zip: $(ARDUINO)/ESP32forth-$(VERSION)/ESP32forth-$(VERSION).ino - cd $(ARDUINO) && zip -r ESP32forth-$(VERSION).zip ESP32forth-$(VERSION) +$(ARDUINO)/ESP32forth.zip: $(ARDUINO)/ESP32forth/ESP32forth.ino + cd $(ARDUINO) && zip -r ESP32forth.zip ESP32forth # ---- DEPLOY ---- $(DEPLOY): mkdir -p $@ -$(DEPLOY)/app.yaml: $(ARDUINO)/ESP32forth-$(VERSION).zip \ +$(DEPLOY)/app.yaml: $(ARDUINO)/ESP32forth.zip \ $(wildcard site/*.html) \ site/app.yaml \ site/eforth.go \ $(TARGETS) | $(DEPLOY) mkdir -p $(DEPLOY)/static - cp -r $(ARDUINO)/ESP32forth-$(VERSION).zip $(DEPLOY)/static - cp -r $(POSIX)/ueforth $(DEPLOY)/static/ueforth-$(VERSION).linux - cp -r $(WINDOWS)/uEf32.exe $(DEPLOY)/static/uEf32-$(VERSION).exe - cp -r $(WINDOWS)/uEf64.exe $(DEPLOY)/static/uEf64-$(VERSION).exe + cp -r $(ARDUINO)/ESP32forth.zip $(DEPLOY)/static + cp -r $(POSIX)/ueforth $(DEPLOY)/static/ueforth.linux + cp -r $(WINDOWS)/uEf32.exe $(DEPLOY)/static/uEf32.exe + cp -r $(WINDOWS)/uEf64.exe $(DEPLOY)/static/uEf64.exe cp -r $(RES)/eforth.ico $(DEPLOY)/static/favicon.ico - cp -r site/static/* $(DEPLOY)/static/ - cp -r site/*.sh $(DEPLOY) - cp -r site/*.go $(DEPLOY) - cp -r site/*.yaml $(DEPLOY) - sed 's/{{VERSION}}/$(VERSION)/g' site/index.html >$(DEPLOY)/index.html - sed 's/{{VERSION}}/$(VERSION)/g' site/ESP32forth.html >$(DEPLOY)/ESP32forth.html - sed 's/{{VERSION}}/$(VERSION)/g' site/windows.html >$(DEPLOY)/windows.html - sed 's/{{VERSION}}/$(VERSION)/g' site/linux.html >$(DEPLOY)/linux.html - cp site/internals.html $(DEPLOY)/ - cp site/classic.html $(DEPLOY)/ - cp -r site/.gcloudignore $(DEPLOY) + cp -r site/* $(DEPLOY)/ + cp site/.gcloudignore $(DEPLOY) diff --git a/ueforth/arduino/arduino.template.ino b/ueforth/arduino/arduino.template.ino index d441837..2456b7a 100644 --- a/ueforth/arduino/arduino.template.ino +++ b/ueforth/arduino/arduino.template.ino @@ -1,3 +1,8 @@ +/* + * ESP32forth v{{VERSION}} + * Revision: {{REVISON}} + */ + {{opcodes}} {{calling}} diff --git a/ueforth/arduino/fuse_ino.js b/ueforth/arduino/fuse_ino.js index 21b7aa2..bb51166 100755 --- a/ueforth/arduino/fuse_ino.js +++ b/ueforth/arduino/fuse_ino.js @@ -2,13 +2,17 @@ var fs = require('fs'); -var code = fs.readFileSync(process.argv[2]).toString(); -var opcodes = fs.readFileSync(process.argv[3]).toString(); -var calling = fs.readFileSync(process.argv[4]).toString(); -var core = fs.readFileSync(process.argv[5]).toString(); -var interp = fs.readFileSync(process.argv[6]).toString(); -var boot = fs.readFileSync(process.argv[7]).toString(); +var version = process.argv[2]; +var revision = process.argv[3]; +var code = fs.readFileSync(process.argv[4]).toString(); +var opcodes = fs.readFileSync(process.argv[5]).toString(); +var calling = fs.readFileSync(process.argv[6]).toString(); +var core = fs.readFileSync(process.argv[7]).toString(); +var interp = fs.readFileSync(process.argv[8]).toString(); +var boot = fs.readFileSync(process.argv[9]).toString(); +code = code.replace('{{version}}', function() { return version; }); +code = code.replace('{{revision}}', function() { return revision; }); code = code.replace('{{opcodes}}', function() { return opcodes; }); code = code.replace('{{calling}}', function() { return calling; }); code = code.replace('{{boot}}', function() { return boot; }); diff --git a/ueforth/site/ESP32forth.html b/ueforth/site/ESP32forth.html index c55cafd..cc6abac 100644 --- a/ueforth/site/ESP32forth.html +++ b/ueforth/site/ESP32forth.html @@ -19,7 +19,7 @@

Download

-ESP32forth-{{VERSION}}.zip +ESP32forth.zip - Single .ino file ready for installation

diff --git a/ueforth/site/linux.html b/ueforth/site/linux.html index 6d364d4..e47af8d 100644 --- a/ueforth/site/linux.html +++ b/ueforth/site/linux.html @@ -18,7 +18,7 @@

Download

-ueforth-{{VERSION}}.linux +ueforth.linux - Linux 64-bit Executable µEforth

diff --git a/ueforth/site/windows.html b/ueforth/site/windows.html index 52af41e..2c610a7 100644 --- a/ueforth/site/windows.html +++ b/ueforth/site/windows.html @@ -18,12 +18,12 @@

Download

-uEf32-{{VERSION}}.exe +uEf32.exe - Window 32-bit EXE µEforth

-uEf64-{{VERSION}}.exe +uEf64.exe - Window 64-bit EXE µEforth