about summary refs log tree commit diff
path: root/webdeploy.mk
blob: 6a0b3c11b486ad001f0165046ede966f99268cce (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
SRC_DIR ?= .
DEPLOY_HOST ?=
DEPLOY_DIR ?= /var/www/

webdeploy:
	@ test -n "${DEPLOY_DIR}"
	rsync -vhhh --delete -Ccrzl $(SRC_DIR) $(DEPLOY_HOST):$(DEPLOY_DIR)/

webdeploy-test:
	@ ${MAKE} webdeploy DEPLOY_DIR=${DEPLOY_DIR_test}

webdeploy-live:
	@ ${MAKE} webdeploy DEPLOY_DIR=${DEPLOY_DIR_live}

webdeploy-register-hook:
	@ echo '#!/bin/sh' > .git/hooks/pre-push
	@ echo '[ $1 != origin ] && exit 0' >> .git/hooks/pre-push
	@ echo 'makesgen' >> .git/hooks/pre-push
	@ echo 'make webdeploy-live' >> .git/hooks/pre-push
	@ echo 'exit 0' >> .git/hooks/pre-push

.PHONY: webdeploy webdeploy-test webdeploy-live webdeploy-register-hook