# vim: set sw=2 ts=2 sts=2 et tw=80 fmr={{{,}}} fdl=0 fdm=marker:
# pgs-cli build.
.PHONY: help dist
# Auto-Documenting Section. Displays a target list with `##` descriptions.
help:
@grep -E '^[a-zA-Z_-]+:.*## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "%-15s %s\n", $$1, $$2}'
dist: ## Create a distribution for live usage
# --- Create Folders ---
@rm -r dist/*
@mkdir -p dist/css dist/js dist/tags
# --- Combine CSS ---
@for file in $$(cat css/app.css | sed "$(CSS_FILES)"); do \
cat css/$$file >> dist/css/app.css; \
done
# --- Combine Javascript ---
@for file in $$(grep "$(JS_TAGS)" index.html | sed "$(JS_FILES)"); do \
cat $$file >> dist/js/app.js; \
done
# --- Combine Riot Tags ---
@for file in $$(grep "$(RIOT_TAGS)" index.html | sed "$(RIOT_FILES)"); do \
cat $$file >> dist/tags/app.tag; \
done
# --- Modify Index Page ---
@# Output is piped/redirected as BSD and GNU `sed -i` differ.
@cp index.html dist/temp.html
@sed "/$(JS_TAGS)/D" dist/temp.html | sed "s|$(APPJS_PH)|$(APPJS_TAG)|" > dist/index.html
@cp dist/index.html dist/temp.html
@sed "/$(RIOT_TAGS)/D" dist/temp.html | sed "s|$(APPTAG_PH)|$(APPTAG_TAG)|" > dist/index.html
@rm dist/temp.html
@echo "All Done!"
CSS_FILES = s|@import.*[\'\"]\(.*\)[\'\"].*|\1|
JS_TAGS =
APPTAG_PH =
APPTAG_TAG =