-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
76 lines (63 loc) · 2.56 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
DREDGE_WWW ?= /run/user/1001/gvfs/smb-share:server=web.bio.unc.edu,share=dredge
DREDGE_REPOSITORY ?= /home/ptgolden/Code/projects/dredge
DREDGE_SHARED_DATA ?= /home/ptgolden/Dropbox/dredge
DREDGE_VERSION := dredge-$(subst v,,$(shell git --git-dir $(DREDGE_REPOSITORY)/.git describe --tags))
DREDGE_CODE := staging/$(DREDGE_VERSION)
DREDGE_ZIP := $(DREDGE_REPOSITORY)/dist/$(DREDGE_VERSION).zip
PROJECTS := $(shell find $(DREDGE_SHARED_DATA) -maxdepth 1 -type d -name project_*)
RSYNC_FLAGS := -rtv --progress
PROJECT_RSYNC_FLAGS := --delete --exclude extra
ifndef UPLOAD_PAIRWISE_FILES
PROJECT_RSYNC_FLAGS += --exclude *pairwise*
endif
.PHONY: all clean help homepage $(PROJECTS)
help:
@echo
@echo " Upload all projects in a shared directory to a Web server."
@echo
@echo " Usage: make upload"
@echo
@echo " Any folders in the shared directory starting with \"project_\" will be"
@echo " treated as a project to be uploaded. On the server, they will be copied"
@echo " without the project_prefix"
@echo
@echo " By default, projects will be searched for in the directory:"
@echo " - $(DREDGE_SHARED_DATA)"
@echo
@echo " They will be uploaded to:"
@echo " - $(DREDGE_WWW)"
@echo
@echo " They will be deployed with the latest tag in the git repository:"
@echo " - $(DREDGE_REPOSITORY)"
@echo
@echo " These can be configured with the following environment variables, respectively:"
@echo " - DREDGE_SHARED_DATA"
@echo " - DREDGE_WWW"
@echo " - DREDGE_REPOSITORY"
@echo
@echo " For example, to upload to the directory /var/lib/www/dredge, run the command:"
@echo " - DREDGE_WWW=/var/lib/www/dredge make upload"
@echo
@echo " To save time, by default, the folder of pairwise comparisons are not uploaded."
@echo " To change, this setting, set the environment variable UPLOAD_PAIRWISE_FILES"
@echo
upload: $(PROJECTS) homepage
clean:
rm -rf staging
$(DREDGE_ZIP):
cd $(DREDGE_REPOSITORY) && make zip
$(DREDGE_CODE): $(DREDGE_ZIP)
unzip -d staging $<
touch $@
homepage: index.html $(DREDGE_ZIP)
cp $< $<.tmp
sed -i -e 's/%%UPDATED%%/$(shell date +'%B %Y')/' $<.tmp
sed -i -e 's/%%VERSION%%/$(DREDGE_VERSION)/g' $<.tmp
rsync $(RSYNC_FLAGS) $<.tmp $(DREDGE_WWW)/$<
rm -f $<.tmp
rsync $(RSYNC_FLAGS) dredge*.png $(DREDGE_WWW)/
rsync $(RSYNC_FLAGS) $(DREDGE_ZIP) $(DREDGE_WWW)
$(PROJECTS): $(DREDGE_SHARED_DATA)/project_%: $(DREDGE_CODE)
rsync $(RSYNC_FLAGS) $(PROJECT_RSYNC_FLAGS) $@/ $(DREDGE_WWW)/$*
rsync $(RSYNC_FLAGS) $</ $(DREDGE_WWW)/$*
rsync $(RSYNC_FLAGS) $(DREDGE_ZIP) $(DREDGE_WWW)/$*