renamed template() into template_file()
[myslice.git] / Makefile
1 ### 
2 all: 
3         @echo no default target
4
5 force:
6
7 #################### compute emacs tags
8 # list files under git but exclude third-party stuff like bootstrap and jquery
9 myfiles: force
10         @git ls-files | egrep -v 'insert(_|-)above|/bootstrap/|/jquery/|datatables/'
11
12 # in general it's right to rely on the contents as reported by git
13 tags: force
14         $(MAKE) myfiles | xargs etags
15
16 # however sometimes we have stuff not yet added, so in this case
17 ftags: force
18         find . -type f | fgrep -v '/.git/' | xargs etags
19
20 list-html: force
21         @find . -type f -name '*.html'
22 list-js: force
23         @find . -type f -name '*.js' | grep -v '/all-static/'
24 list-css: force
25         @find . -type f -name '*.css' | grep -v '/all-static/'
26 list-img:
27         @find . -type f -name '*.png' | grep -v '/all-static/'
28
29 #################### manage static contents (extract from all the modules into the single all-static location)
30 static: force
31         ./manage.py collectstatic --noinput 
32
33 clean-static: force
34         rm -rf ./all-static/
35
36 allst: clean-static static
37
38 #################### sync : push current code on a (devel) box running myslice
39 SSHURL:=root@$(MYSLICEBOX):/
40 SSHCOMMAND:=ssh root@$(MYSLICEBOX)
41
42 ### rsync options
43 # the config file should probably not be overridden ??
44 # --exclude settings.py 
45 LOCAL_RSYNC_EXCLUDES    := --exclude '*.pyc' --exclude devel --exclude DataTables-1.9.4
46 # usual excludes
47 RSYNC_EXCLUDES          := --exclude .git --exclude '*~' --exclude TAGS --exclude .DS_Store $(LOCAL_RSYNC_EXCLUDES) 
48 # make -n will propagate as rsync -n 
49 RSYNC_COND_DRY_RUN      := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
50 # putting it together
51 RSYNC                   := rsync -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
52
53 # xxx until we come up with a packaging this is going to be a wild guess
54 #INSTALLED=/usr/share/myslice
55 INSTALLED=/root/myslice
56
57 sync:
58 ifeq (,$(MYSLICEBOX))
59         @echo "you need to set MYSLICEBOX, like in e.g."
60         @echo "  $(MAKE) MYSLICEBOX=debian04.pl.sophia.inria.fr "$@""
61         @exit 1
62 else
63         +$(RSYNC) ./ $(SSHURL)/$(INSTALLED)/
64 endif
65
66 # xxx likewise until we run this under apache it's probably hard to restart from here
67 restart:
68 ifeq (,$(MYSLICEBOX))
69         @echo "you need to set MYSLICEBOX, like in e.g."
70         @echo "  $(MAKE) MYSLICEBOX=debian04.pl.sophia.inria.fr "$@""
71         @exit 1
72 else
73         @echo "$@" target not yet implemented - for an apache based depl it would read ...; exit; @$(SSHCOMMAND) /etc/init.d/apache2 restart
74 endif