From f81a0adc30d50d9c1a41c32d3ecb1c5675183545 Mon Sep 17 00:00:00 2001 From: nsensfel Date: Mon, 9 Apr 2018 13:15:53 +0200 Subject: Adds preprocessing. --- Makefile | 19 +++++++++++++++++-- conf/constants.conf.example | 3 +++ src/battlemap/src/Constants/IO.elm | 17 ----------------- src/battlemap/src/Constants/IO.elm.m4 | 16 ++++++++++++++++ www/index.html | 24 ------------------------ www/index.html.m4 | 24 ++++++++++++++++++++++++ 6 files changed, 60 insertions(+), 43 deletions(-) create mode 100644 conf/constants.conf.example delete mode 100644 src/battlemap/src/Constants/IO.elm create mode 100644 src/battlemap/src/Constants/IO.elm.m4 delete mode 100644 www/index.html create mode 100644 www/index.html.m4 diff --git a/Makefile b/Makefile index 1e9d569..09436b2 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,25 @@ -MODULES = battlemap global asset +MODULES ?= battlemap global asset +CONFIG_FILE ?= ${CURDIR}/conf/constants.conf + SRC_DIR = ${CURDIR}/src WWW_DIR = ${CURDIR}/www MODULES_SRC = $(addprefix $(SRC_DIR)/,$(MODULES)) MODULES_WWW = $(addprefix $(WWW_DIR)/,$(MODULES)) -all: build $(WWW_DIR) $(MODULES_WWW) +PREPROCESSOR_FILES = $(shell find ${CURDIR} -name "*.m4") +PREPROCESSED_FILES = $(patsubst %.m4,%,$(PREPROCESSOR_FILES)) + +ifeq ($(wildcard $(CONFIG_FILE)),) +$(error "Missing CONFIG_FILE ($(CONFIG_FILE)), use the example to make one.") +endif + +export + +all: $(PREPROCESSED_FILES) build $(WWW_DIR) $(MODULES_WWW) + +$(PREPROCESSED_FILES): %: $(CONFIG_FILE) %.m4 + m4 $^ > $@ upload_demo: scp -r $(WWW_DIR)/* dreamhost:~/tacticians.online/ @@ -19,6 +33,7 @@ clean: for module in $(MODULES_SRC) ; do \ $(MAKE) -C $$module clean ; \ done + rm $(PREPROCESSED_FILES) reset: for module in $(MODULES_SRC) ; do \ diff --git a/conf/constants.conf.example b/conf/constants.conf.example new file mode 100644 index 0000000..57df17f --- /dev/null +++ b/conf/constants.conf.example @@ -0,0 +1,3 @@ +define(`__CONF_SERVER_NAME', `LOCAL SERVER')dnl +define(`__CONF_SERVER_URL', `http://127.0.0.1')dnl +define(`__CONF_AUTHOR_NAME', `localuser')dnl diff --git a/src/battlemap/src/Constants/IO.elm b/src/battlemap/src/Constants/IO.elm deleted file mode 100644 index fe62a6f..0000000 --- a/src/battlemap/src/Constants/IO.elm +++ /dev/null @@ -1,17 +0,0 @@ -module Constants.IO exposing (..) - -base_url : String ---base_url = "https://tacticians.online" -base_url = "http://127.0.0.1" - -battlemap_handler_url : String -battlemap_handler_url = (base_url ++ "/handler/battlemap") - -character_turn_handler : String -character_turn_handler = (battlemap_handler_url ++ "/character_turn") - -battlemap_loading_handler : String -battlemap_loading_handler = (battlemap_handler_url ++ "/load_state") - -tile_assets_url : String -tile_assets_url = (base_url ++ "/asset/svg/tile/") diff --git a/src/battlemap/src/Constants/IO.elm.m4 b/src/battlemap/src/Constants/IO.elm.m4 new file mode 100644 index 0000000..b5f0a0d --- /dev/null +++ b/src/battlemap/src/Constants/IO.elm.m4 @@ -0,0 +1,16 @@ +module Constants.IO exposing (..) + +base_url : String +base_url = "__CONF_SERVER_URL" + +battlemap_handler_url : String +battlemap_handler_url = (base_url ++ "/handler/battlemap") + +character_turn_handler : String +character_turn_handler = (battlemap_handler_url ++ "/character_turn") + +battlemap_loading_handler : String +battlemap_loading_handler = (battlemap_handler_url ++ "/load_state") + +tile_assets_url : String +tile_assets_url = (base_url ++ "/asset/svg/tile/") diff --git a/www/index.html b/www/index.html deleted file mode 100644 index 3b91a97..0000000 --- a/www/index.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - <SERVER NAME> - Landing Page - - - - - - -

-

Currently running: Latest Dev. Build

-

This website lets you play the game even during its development phase. As a result, there is a lot missing.

-

- Having accounts at that stage would needlessly slow us down, so access to - the game's battle system is done without login in. -

-

You can access the source code for the game this website is running, under the Apache 2.0 License:

- - - diff --git a/www/index.html.m4 b/www/index.html.m4 new file mode 100644 index 0000000..c396fef --- /dev/null +++ b/www/index.html.m4 @@ -0,0 +1,24 @@ + + + + __CONF_SERVER_NAME - Landing Page + + + + + + +

__CONF_SERVER_NAME

+

Currently running: Latest Dev. Build

+

This website lets you play the game even during its development phase. As a result, there is a lot missing.

+

+ Having accounts at that stage would needlessly slow us down, so access to + the game's battle system is done without login in. +

+

You can access the source code for the game this website is running, under the Apache 2.0 License:

+ + + -- cgit v1.2.3-70-g09d2