mostly all the resources (templates/static) should be at their right
[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: force
27         @find . -type f -name '*.png' | grep -v '/all-static/'
28
29 list-all list-resources: list-html list-js list-css list-img
30
31 #################### manage static contents (extract from all the modules into the single all-static location)
32 static: force
33         ./manage.py collectstatic --noinput 
34
35 clean-static: force
36         rm -rf ./all-static/
37
38 allst: clean-static static
39
40 #################### sync : push current code on a (devel) box running myslice
41 SSHURL:=root@$(MYSLICEBOX):/
42 SSHCOMMAND:=ssh root@$(MYSLICEBOX)
43
44 ### rsync options
45 # the config file should probably not be overridden ??
46 # --exclude settings.py 
47 LOCAL_RSYNC_EXCLUDES    := --exclude '*.pyc' --exclude devel --exclude DataTables-1.9.4
48 # usual excludes
49 RSYNC_EXCLUDES          := --exclude .git --exclude '*~' --exclude TAGS --exclude .DS_Store $(LOCAL_RSYNC_EXCLUDES) 
50 # make -n will propagate as rsync -n 
51 RSYNC_COND_DRY_RUN      := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
52 # putting it together
53 RSYNC                   := rsync -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
54
55 # xxx until we come up with a packaging this is going to be a wild guess
56 #INSTALLED=/usr/share/myslice
57 INSTALLED=/root/myslice
58
59 sync:
60 ifeq (,$(MYSLICEBOX))
61         @echo "you need to set MYSLICEBOX, like in e.g."
62         @echo "  $(MAKE) MYSLICEBOX=debian04.pl.sophia.inria.fr "$@""
63         @exit 1
64 else
65         +$(RSYNC) ./ $(SSHURL)/$(INSTALLED)/
66 endif
67
68 # xxx likewise until we run this under apache it's probably hard to restart from here
69 restart:
70 ifeq (,$(MYSLICEBOX))
71         @echo "you need to set MYSLICEBOX, like in e.g."
72         @echo "  $(MAKE) MYSLICEBOX=debian04.pl.sophia.inria.fr "$@""
73         @exit 1
74 else
75         @echo "$@" target not yet implemented - for an apache based depl it would read ...; exit; @$(SSHCOMMAND) /etc/init.d/apache2 restart
76 endif