|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
port = 8081
|
|
|
|
|
output = output
|
|
|
|
|
PORT ?= 8081
|
|
|
|
|
OUTPUT ?= output
|
|
|
|
|
FLAGS ?=
|
|
|
|
|
MAKE = make FLAGS=$(FLAGS)
|
|
|
|
|
|
|
|
|
|
# First goal is the default with `make`.
|
|
|
|
|
|
|
|
|
@ -14,49 +16,47 @@ all: fetch html
|
|
|
|
|
|
|
|
|
|
# Fetch room listing.
|
|
|
|
|
fetch:
|
|
|
|
|
/bin/php php/fetch-servers.php
|
|
|
|
|
|
|
|
|
|
# Fetch room listing with extra verbosity.
|
|
|
|
|
fetch-v:
|
|
|
|
|
/bin/php php/fetch-servers.php --verbose
|
|
|
|
|
/bin/php php/fetch-servers.php $(FLAGS)
|
|
|
|
|
|
|
|
|
|
# Generate HTML from data.
|
|
|
|
|
html:
|
|
|
|
|
/bin/php php/generate-html.php
|
|
|
|
|
|
|
|
|
|
# Last item run in foreground to receive interrupts.
|
|
|
|
|
/bin/php php/generate-html.php $(FLAGS)
|
|
|
|
|
|
|
|
|
|
# Serve a local copy which responds to file changes.
|
|
|
|
|
dev: FLAGS = --verbose
|
|
|
|
|
dev: open
|
|
|
|
|
make server &
|
|
|
|
|
make watchdog
|
|
|
|
|
$(MAKE) server &
|
|
|
|
|
$(MAKE) watchdog
|
|
|
|
|
|
|
|
|
|
# (Last item run in foreground to receive interrupts.)
|
|
|
|
|
|
|
|
|
|
# Serve a local copy on LAN which responds to file changes.
|
|
|
|
|
lan-dev: FLAGS = --verbose
|
|
|
|
|
lan-dev: open
|
|
|
|
|
ip addr | fgrep -e ' 192.' -e ' 10.'
|
|
|
|
|
make lan-server &
|
|
|
|
|
make watchdog
|
|
|
|
|
-which ip 1>/dev/null 2>/dev/null && ip addr | fgrep -e ' 192.' -e ' 10.' || true
|
|
|
|
|
$(MAKE) lan-server &
|
|
|
|
|
$(MAKE) watchdog
|
|
|
|
|
|
|
|
|
|
# Serve a local copy.
|
|
|
|
|
server:
|
|
|
|
|
/bin/php -S localhost:$(port) -t $(output)
|
|
|
|
|
/bin/php -S "localhost:$(PORT)" -t "$(OUTPUT)"
|
|
|
|
|
|
|
|
|
|
# Serve a local copy on all interfaces.
|
|
|
|
|
lan-server:
|
|
|
|
|
/bin/php -S 0.0.0.0:$(port) -t $(output)
|
|
|
|
|
/bin/php -S "0.0.0.0:$(PORT)" -t "$(OUTPUT)"
|
|
|
|
|
|
|
|
|
|
# Open locally served page in browser.
|
|
|
|
|
open:
|
|
|
|
|
xdg-open http://localhost:$(port) >/dev/null 2>/dev/null & disown
|
|
|
|
|
xdg-open "http://localhost:$(PORT)" >/dev/null 2>/dev/null & disown
|
|
|
|
|
|
|
|
|
|
# Update HTML on file change. Doesn't check for new files.
|
|
|
|
|
watchdog:
|
|
|
|
|
find . | entr -n -s "make html"
|
|
|
|
|
find . | grep -v ".git" | entr -n -s "$(MAKE) html"
|
|
|
|
|
|
|
|
|
|
# Remove artefacts
|
|
|
|
|
clean:
|
|
|
|
|
-rm -r cache
|
|
|
|
|
-rm -r output/*.html
|
|
|
|
|
-rm -r cache 2>/dev/null || true
|
|
|
|
|
-rm -r output/*.html 2>/dev/null || true
|
|
|
|
|
|
|
|
|
|
# Build everything from scratch and test functionality.
|
|
|
|
|
test: clean all open server
|
|
|
|
|