hubl/Makefile

86 lines
2.8 KiB
Makefile
Raw Normal View History

2018-10-05 09:37:48 +00:00
DIST_DIR := www
2018-09-28 19:20:15 +00:00
SCRIPT_SRC := $(wildcard src/scripts/*.js)
2018-10-05 09:37:48 +00:00
SCRIPT_DEST := $(SCRIPT_SRC:src/%=$(DIST_DIR)/%)
2018-09-28 19:20:15 +00:00
default: build
2018-10-05 09:37:48 +00:00
build: $(DIST_DIR)/index.html $(DIST_DIR)/styles/index.css $(SCRIPT_DEST)
2018-09-28 19:20:15 +00:00
watch:
@echo 'watching for change'
@echo 'press Ctrl+C to stop'
@while true; do \
$(MAKE) --silent build; \
sleep 0.5; \
done
# pug
2018-12-17 14:20:36 +00:00
$(DIST_DIR)/index.html: src/index.pug src/config.json $(wildcard src/*.pug src/*/*.pug)
@echo pug: $< ➜ $@
@export ENV="dev"; \
node_modules/.bin/pug --pretty $< --out $(dir $@) -O src/config.json || touch $@
# pug (alpha)
$(DIST_DIR)/index.alpha.html: src/index.pug src/config.json $(wildcard src/*.pug src/*/*.pug)
2018-09-28 19:20:15 +00:00
@echo pug: $< ➜ $@
2019-04-18 08:01:35 +00:00
@export ENV="alpha"; \
node_modules/.bin/pug --pretty $< --out $(dir $@) -E alpha.html -O src/config.json || touch $@
2018-09-28 19:20:15 +00:00
# pug (paris)
$(DIST_DIR)/index.paris.html: src/index.pug src/config.json $(wildcard src/*.pug src/*/*.pug)
2019-04-18 08:01:35 +00:00
@echo pug: $< ➜ $@
@export ENV="paris"; \
node_modules/.bin/pug --pretty $< --out $(dir $@) -E paris.html -O src/config.json || touch $@
# pug (nantes)
$(DIST_DIR)/index.nantes.html: src/index.pug src/config.json $(wildcard src/*.pug src/*/*.pug)
@echo pug: $< ➜ $@
@export ENV="nantes"; \
node_modules/.bin/pug --pretty $< --out $(dir $@) -E nantes.html -O src/config.json || touch $@
2019-04-18 08:01:35 +00:00
2018-09-28 19:20:15 +00:00
# sass
2019-05-13 16:50:34 +00:00
$(DIST_DIR)/styles/index.css: src/styles/_index.scss $(wildcard src/*.scss src/*/*.scss src/*/*/*.scss src/*/*/*/*.scss)
2018-09-28 19:20:15 +00:00
@echo sass: $< ➜ $@
2018-10-05 09:37:48 +00:00
@node_modules/.bin/node-sass $< $@ --source-map true --source-map-contents || touch $@
2018-09-28 19:20:15 +00:00
# babel
2018-10-22 15:03:00 +00:00
$(DIST_DIR)/%.js: src/%.js .babelrc
2018-09-28 19:20:15 +00:00
@echo babel: $< ➜ $@
@mkdir -p $(dir $@)
@node_modules/.bin/babel $< --out-file $@ --source-maps || touch $@
buildparis: build
$(MAKE) $(DIST_DIR)/index.paris.html
syncparis: buildparis
rsync -rv --exclude '*.html' www/* test-paris@ssh-test-paris.happy-dev.fr:~/www/
rsync --no-R --no-implied-dirs www/index.paris.html test-paris@ssh-test-paris.happy-dev.fr:~/www/index.html
rsync -v www/.htaccess test-paris@ssh-test-paris.happy-dev.fr:~/www/
2019-04-23 08:42:53 +00:00
buildnantes: build
$(MAKE) $(DIST_DIR)/index.nantes.html
2018-10-12 17:11:13 +00:00
syncnantes: buildnantes
rsync -rv --exclude '*.html' www/* test-nantes@ssh-test-nantes.happy-dev.fr:~/www/
rsync --no-R --no-implied-dirs www/index.nantes.html test-nantes@ssh-test-nantes.happy-dev.fr:~/www/index.html
rsync -v www/.htaccess test-nantes@ssh-test-nantes.happy-dev.fr:~/www/
2018-09-28 19:20:15 +00:00
buildalpha: build
$(MAKE) $(DIST_DIR)/index.alpha.html
syncalpha: buildalpha
rsync -rv --exclude '*.html' www/* alpha@ssh-alpha.happy-dev.fr:~/www/
rsync --no-R --no-implied-dirs www/index.alpha.html alpha@ssh-alpha.happy-dev.fr:~/www/index.html
2019-04-18 08:01:35 +00:00
rsync -v www/.htaccess alpha@ssh-alpha.happy-dev.fr:~/www/
sync: syncnantes syncparis
syncprod: syncalpha
.PHONY: default build watch sync syncprod