Makefile 3.23 KB
Newer Older
1 2
#WWW_UPLOAD_URI = neurodebian@neurodebian.ovgu.de:/home/neurodebian/www
WWW_UPLOAD_URI = ../../www
3
WWW_DIR = build/html/
4

5 6
WWW_UPLOAD_URI_STATIC=$(WWW_UPLOAD_URI)/_static

7
BIGMESS_OPTS = -c neurodebian.cfg
8
BIGMESS_CMD = PYTHONPATH=.:3rd/bigmess:$(PYTHONPATH) 3rd/bigmess/bin/bigmess
Michael Hanke's avatar
Michael Hanke committed
9 10
BIGMESS = $(BIGMESS_CMD) $(BIGMESS_OPTS)

11 12 13 14
# Lentghy one due to updatedb
all: updatedb upload-website mirmon
# Quick one -- just rebuilds html if new changes and adjusts the status of the mirrors
refresh: upload-website-stamp mirmon
Michael Hanke's avatar
Michael Hanke committed
15

16 17
website-build-depends:
	: # Python modules
18
	sudo apt-get install python-sphinx python-argparse python-xdg python-debian python-html5lib
19 20 21
	: # JavaScripts
	sudo apt-get install libjs-jquery-easing libjs-jquery-mousewheel libjs-jquery-fancybox

22

23 24 25 26
pics:
	$(MAKE) -C artwork


27
html: pics source
Yaroslav Halchenko's avatar
Yaroslav Halchenko committed
28
	rsync -rvlhpt sphinx/ build/src
29
	cd artwork;	cp button_w200.png logo_tuned/fmri_w200.png *-logo_h50.png ../build/src/_static; cd ..
30
	cp 3rd/jquery.livetwitter/jquery.livetwitter.min.js build/src/_static
31
	cp neurodebian.cfg build/src/_static
32
	cd build/src && $(MAKE) html BUILDDIR=$(CURDIR)/build 2>&1
33
	ln -fs /usr/share/javascript build/html/
34
	mv $(WWW_DIR)/_static/robots.txt $(WWW_DIR)/
35
	cp -r build/src/lists $(WWW_DIR)/
Michael Hanke's avatar
Michael Hanke committed
36
	cp -r sphinx/survey/2011/figures/* $(WWW_DIR)/_images/
37 38
	@echo "I: extracting header/trailer to be reused in non-sphinx pages"
	sed -ne '1,/<!-- HEADNOTES -->/p' $(WWW_DIR)/index.html >| $(WWW_DIR)/_static/index-header.ihtml
Yaroslav Halchenko's avatar
Yaroslav Halchenko committed
39
	sed -ne '/<h2>Comments<\/h2>/,$$p' $(WWW_DIR)/index.html >| $(WWW_DIR)/_static/index-trailer.ihtml
Michael Hanke's avatar
Michael Hanke committed
40 41

clean:
42
	-rm html-stamp source-stamp upload-website-stamp
43 44
	$(MAKE) -C artwork clean

Michael Hanke's avatar
Michael Hanke committed
45

46
distclean: clean
47
	-rm -rf build
48 49


Michael Hanke's avatar
Michael Hanke committed
50
source: source-stamp
51
source-stamp:
52 53
	mkdir -p build/src/pkgs/
	mkdir -p build/src/lists/
54
	mkdir -p build/src/_static/
55
	mkdir -p build/src/pkglists/
Michael Hanke's avatar
Michael Hanke committed
56 57
	$(BIGMESS) mkpkgs  -d build/src/pkgs/
	$(BIGMESS) mkaptcfgs -d build/src/lists/
58
	$(BIGMESS) mkmirrorsstat -d build/src
Michael Hanke's avatar
Michael Hanke committed
59 60
	$(BIGMESS) mkrepocfg > build/src/sources_lists
	$(BIGMESS) mkpkgtocs -d build/src/pkglists > build/src/pkgs.rst
61 62 63
	cp 3rd/nvd3/*.min.js build/src/_static/
	cp 3rd/nvd3/lib/d3*.min.js build/src/_static/
	cp 3rd/nvd3/src/nv*.css build/src/_static/
Michael Hanke's avatar
Michael Hanke committed
64
	touch $@
65

66
cachefiles:
67
	$(BIGMESS) cachefiles -f
68 69

updatedb: cachefiles
70
	$(BIGMESS) updatedb
71
	-rm source-stamp
72 73

upload-website: html
74
	rsync -rvzlhp --delete \
75
        --exclude=debian --exclude=debian-local --exclude=debian-devel --exclude=debian-custom --exclude=_files \
76
        --chmod=Dg+s,g+rw $(WWW_DIR) $(WWW_UPLOAD_URI)
77
	rsync -rvzlhp --chmod=Dg+s,g+rw tools/neurodebian-travis.sh $(WWW_UPLOAD_URI)/_files/
78 79 80 81 82 83
	: # Touch stamp here so we get it updated on every upload
	touch $@-stamp

# call upload iff .git/index was modified, i.e. new changes got pulled in
upload-website-stamp: .git/index
	$(MAKE) upload-website
84

85 86
mirmon:
	# update and generate mirrors report
87
	[ -x /usr/bin/mirmon ] && mirmon -q -get update -c mirmon-neurodebian.conf 2>&1 \
88
        | grep -v 'date: invalid date.*DOCTYPE' || :
89 90 91 92
	# [ -x $(WWW_UPLOAD_URI_STATIC)/mirrors-check.ihtml ] &&
	# everything must be in place!
	cat $(WWW_UPLOAD_URI_STATIC)/{index-header,mirrors-status,index-trailer}.ihtml \
	 >| $(WWW_UPLOAD_URI)/mirrors-status.html
93

94
.PHONY: removedb removecache cachefiles updatedb upload-website clean distclean pics html mirmon
Michael Hanke's avatar
Michael Hanke committed
95