BUCKET=rndm-www S3_HOST="${BUCKET}.s3-website.fr-par.scw.cloud" URL="https://random.sh" SITE_NAME=random.sh LAYOUT=includes/layout.tpl.html STYLE=src/site.css STYLE_LIBS=includes/css/modern-normalize.min.css MARKDOWNFILES!=find src/ -type f -name '*.md' ASSETS!=find src/ -type f -not -name '*.md' -not -name "site.css" .export SITE_NAME BUCKET S3_HOST URL LAYOUT .MAIN: all all: sync build: .build sync: .published resync: -rm .published ${MAKE} sync clean: -rm -r build/* .PHONY: all build sync resync clean # -- CSS ${STYLE:S/^src/build/}: ${STYLE} ${STYLE_LIBS} cat ${STYLE_LIBS} ${STYLE} > ${.TARGET} BUILDS+=${STYLE:S/^src/build/} # -- MD .for __md in ${MARKDOWNFILES} #.info "(markdown) ${__md} => ${__md:S/^src/build/:S/.md$/.html/}" ${__md:S/^src/build/:S/.md$/.html/}: ${__md} bin/render-markdown ${LAYOUT} ${STYLE:S/^src/build/} @mkdir -p "${.TARGET:H}" bin/render-markdown "${LAYOUT}" "${__md}" > "${.TARGET}" BUILDS+=${__md:S/^src/build/:S/.md$/.html/} .endfor # -- Assets .for __s in ${ASSETS} #.info "(static) ${__s} => ${__s:S/^src/build/}" ${__s:S/^src/build/}: ${__s} @mkdir -p "${.TARGET:H}" ln -s ${__s:tA} ${.TARGET} BUILDS+=${__s:S/^src/build/} .endfor .build: $(BUILDS) @touch ${.TARGET} .published: .build aws s3 sync --delete "build/" "s3://${BUCKET}/" varnishadm -S /var/db/varnish.secret -T front.stairway.internal.random.sh:8081 ban "req.http.host ~ ${BUCKET}" @touch ${.TARGET}