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