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