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