hubl/Makefile
2018-10-05 13:07:14 +02:00

64 lines
1.4 KiB
Makefile

DIST_DIR := www
SCRIPT_SRC := $(wildcard src/scripts/*.js)
SCRIPT_DEST := $(SCRIPT_SRC:src/%=$(DIST_DIR)/%)
default: build
clean:
git clean -fXd
install: node_modules copy_lib copy_samples submodules
submodules:
git submodule init
git submodule update
build: $(DIST_DIR)/index.html $(DIST_DIR)/styles/index.css $(SCRIPT_DEST)
watch:
@echo 'watching for change'
@echo 'press Ctrl+C to stop'
@while true; do \
$(MAKE) --silent build; \
sleep 0.5; \
done
serve:
node server
# npm
node_modules:
npm install
# vendor lib
copy_lib:
@node copy_lib.js
# sample
copy_samples:
@cp -n src/config.sample.pug src/config.pug
@cp -n www/oidc-client-config.sample.json www/oidc-client-config.json
# pug
$(DIST_DIR)/index.html: src/index.pug $(wildcard src/*.pug src/*/*.pug)
@echo pug: $< ➜ $@
@node_modules/.bin/pug --pretty $< --out $(dir $@) || touch $@
# sass
$(DIST_DIR)/styles/index.css: src/styles/index.scss $(wildcard src/*.scss src/*/*.scss)
@echo sass: $< ➜ $@
@node_modules/.bin/node-sass $< $@ --source-map true --source-map-contents || touch $@
# babel
$(DIST_DIR)/%.js: src/%.js
@echo babel: $< ➜ $@
@mkdir -p $(dir $@)
@node_modules/.bin/babel $< --out-file $@ --source-maps || touch $@
sync:
rsync -rv www/* staging-app@ssh-staging-app.happy-dev.fr:~/staging-app.happy-dev.fr/
.PHONY: default install submodules copy_lib copy_samples build watch serve clean