Adding website deploy.
This commit is contained in:
@ -5,6 +5,7 @@ WEB = $(OUT)/web
|
|||||||
POSIX = $(OUT)/posix
|
POSIX = $(OUT)/posix
|
||||||
WINDOWS = $(OUT)/windows
|
WINDOWS = $(OUT)/windows
|
||||||
ARDUINO = $(OUT)/arduino/ueforth
|
ARDUINO = $(OUT)/arduino/ueforth
|
||||||
|
DEPLOY = $(OUT)/deploy
|
||||||
|
|
||||||
CFLAGS = -Wall -Werror \
|
CFLAGS = -Wall -Werror \
|
||||||
-O2 \
|
-O2 \
|
||||||
@ -37,7 +38,7 @@ endif
|
|||||||
TARGETS = $(WEB)/terminal.html \
|
TARGETS = $(WEB)/terminal.html \
|
||||||
$(WEB)/ueforth.js \
|
$(WEB)/ueforth.js \
|
||||||
$(POSIX)/ueforth \
|
$(POSIX)/ueforth \
|
||||||
$(ARDUINO)/ueforth.ino
|
$(ARDUINO)/ueforth/ueforth.ino
|
||||||
|
|
||||||
# Selectively enable windows if tools available
|
# Selectively enable windows if tools available
|
||||||
ifneq (, $(shell which $(WIN_ARCH)-w64-mingw32-windres))
|
ifneq (, $(shell which $(WIN_ARCH)-w64-mingw32-windres))
|
||||||
@ -50,7 +51,7 @@ else
|
|||||||
$(warning "Missing $(WIN_ARCH)-w64-mingw32-windres skipping Windows.")
|
$(warning "Missing $(WIN_ARCH)-w64-mingw32-windres skipping Windows.")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
all: $(TARGETS) tests
|
all: $(TARGETS) tests $(DEPLOY)/app.yaml
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(OUT)
|
rm -rf $(OUT)
|
||||||
@ -171,14 +172,34 @@ $(WINDOWS)/uEforth.exe: \
|
|||||||
|
|
||||||
# ---- ARDUINO ----
|
# ---- ARDUINO ----
|
||||||
|
|
||||||
$(ARDUINO):
|
$(ARDUINO)/ueforth:
|
||||||
mkdir -p $@
|
mkdir -p $@
|
||||||
|
|
||||||
$(ARDUINO)/ueforth.ino: \
|
$(ARDUINO)/ueforth/ueforth.ino: \
|
||||||
arduino/fuse_ino.js \
|
arduino/fuse_ino.js \
|
||||||
arduino/arduino.template.ino \
|
arduino/arduino.template.ino \
|
||||||
common/opcodes.h \
|
common/opcodes.h \
|
||||||
common/core.h \
|
common/core.h \
|
||||||
$(GEN)/arduino_boot.h | $(ARDUINO)
|
$(GEN)/arduino_boot.h | $(ARDUINO)/ueforth
|
||||||
$^ >$@
|
$^ >$@
|
||||||
|
|
||||||
|
# ---- PACKAGE ----
|
||||||
|
|
||||||
|
$(ARDUINO)/ueforth-arduino-esp32.zip: $(ARDUINO)/ueforth/ueforth.ino
|
||||||
|
cd $(ARDUINO) && zip -r ueforth-arduino-esp32.zip ueforth
|
||||||
|
|
||||||
|
# ---- DEPLOY ----
|
||||||
|
|
||||||
|
$(DEPLOY):
|
||||||
|
mkdir -p $@
|
||||||
|
|
||||||
|
$(DEPLOY)/app.yaml: $(ARDUINO)/ueforth-arduino-esp32.zip $(TARGETS) | $(DEPLOY)
|
||||||
|
mkdir -p $(DEPLOY)/static
|
||||||
|
cp -r $(ARDUINO)/ueforth-arduino-esp32.zip $(DEPLOY)/static
|
||||||
|
cp -r $(POSIX)/ueforth $(DEPLOY)/static/ueforth.linux
|
||||||
|
cp -r $(WINDOWS)/uEforth.exe $(DEPLOY)/static
|
||||||
|
cp -r $(RES)/eforth.ico $(DEPLOY)/static/favicon.ico
|
||||||
|
cp -r site/* $(DEPLOY)
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
cd $(DEPLOY) && ./deploy.sh
|
||||||
|
|||||||
27
ueforth/site/app.yaml
Normal file
27
ueforth/site/app.yaml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
runtime: go115
|
||||||
|
|
||||||
|
default_expiration: "1m"
|
||||||
|
|
||||||
|
handlers:
|
||||||
|
- url: /robots.txt
|
||||||
|
static_files: static/robots.txt
|
||||||
|
upload: static/robots.txt
|
||||||
|
secure: always
|
||||||
|
|
||||||
|
- url: /favicon(.*)
|
||||||
|
static_files: static/favicon\1
|
||||||
|
upload: static/favicon.*
|
||||||
|
secure: always
|
||||||
|
|
||||||
|
- url: /
|
||||||
|
static_files: static/index.html
|
||||||
|
upload: static/index.html
|
||||||
|
secure: always
|
||||||
|
|
||||||
|
- url: /static
|
||||||
|
static_dir: static
|
||||||
|
secure: always
|
||||||
|
|
||||||
|
- url: /.*
|
||||||
|
script: auto
|
||||||
|
secure: always
|
||||||
3
ueforth/site/deploy.sh
Normal file
3
ueforth/site/deploy.sh
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
export CLOUDSDK_PYTHON=/usr/bin/python
|
||||||
|
gcloud app deploy --project eforth *.yaml
|
||||||
30
ueforth/site/eforth.go
Normal file
30
ueforth/site/eforth.go
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
http.HandleFunc("/test", indexHandler)
|
||||||
|
|
||||||
|
port := os.Getenv("PORT")
|
||||||
|
if port == "" {
|
||||||
|
port = "8080"
|
||||||
|
log.Printf("Defaulting to port %s", port)
|
||||||
|
}
|
||||||
|
log.Printf("Listening on port %s", port)
|
||||||
|
if err := http.ListenAndServe(":"+port, nil); err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func indexHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
if r.URL.Path != "/test" {
|
||||||
|
http.NotFound(w, r)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
fmt.Fprint(w, "Hello")
|
||||||
|
}
|
||||||
55
ueforth/site/static/index.html
Normal file
55
ueforth/site/static/index.html
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<body>
|
||||||
|
<h1>EForth</h1>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
EForth is delightfully minimalist approach to Forth originated by Bill Muench and Dr. C. H. Ting.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
In its original form metacompilation is avoided.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h2>Download</h2>
|
||||||
|
<p>
|
||||||
|
<ul>
|
||||||
|
<li><a href="static/eEforth.exe">uEforth.exe</a> - Window EXE uEforth</li>
|
||||||
|
<li><a href="static/eforth.linux">eforth.linux</a> - Linux Executable uEforth</li>
|
||||||
|
<li><a href="static/ueforth.zip">ueforth-arduino-esp32.zip</a> - Arudino Source Code</li>
|
||||||
|
<li><a href="https://github.com/flagxor/eforth">http://github.com/flagxor/eforth</a>
|
||||||
|
- Complete Source Code (under ueforth)</li>
|
||||||
|
</ul>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h2>EForth Quirks</h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
EForth uses <code>FOR..NEXT</code> in favor of <code>DO..LOOP</code>.
|
||||||
|
<a href="https://github.com/TG9541/stm8ef/wiki/eForth-FOR-..-NEXT">Details</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
This construct has the odd property that it iterates one "extra" time for zero.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
: FOO 10 FOR R@ . NEXT ; FOO
|
||||||
|
10 9 8 7 6 5 4 3 2 1 0 ok
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
To permit a more ordinary loop the <code>AFT</code> word is used in the sequence
|
||||||
|
<code>FOR..AFT..THEN..NEXT</code>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
: FOO 10 FOR ( 1st time only ) AFT R@ . THEN NEXT ; FOO
|
||||||
|
9 8 7 6 5 4 3 2 1 0 ok
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The even more enigmatic <code>FOR..WHILE..NEXT..ELSE..THEN</code>
|
||||||
|
is used in place of <code>DO..LEAVE..LOOP</code>.
|
||||||
|
It allows a while condition to early out of a counted loop.
|
||||||
|
</p>
|
||||||
|
|
||||||
9
ueforth/site/static/robots.txt
Normal file
9
ueforth/site/static/robots.txt
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
User-agent: *
|
||||||
|
Disallow: /haiku-editor
|
||||||
|
Disallow: /haiku-submit
|
||||||
|
Disallow: /haiku-view
|
||||||
|
Disallow: /haiku-print
|
||||||
|
Disallow: /haiku-vote
|
||||||
|
Disallow: /haiku-bare
|
||||||
|
Disallow: /haiku-search
|
||||||
|
Disallow: /haiku-slideshow
|
||||||
Reference in New Issue
Block a user