1 MAKE-SILENT = $(MAKE) --no-print-directory
3 ### first purpose, build and install from the specfile
14 build: static templates
18 python setup.py install \
19 --install-purelib=$(DESTDIR)/$(datadir)/myslice \
20 --install-scripts=$(DESTDIR)/$(datadir)/myslice \
21 --install-data=$(DESTDIR)/$(datadir)/myslice
24 #################### third-party layout is kind of special
25 # because we have differents versions, and also we
26 # try to preserve the file structure from upstream
27 # so let's handle this manually
28 THIRD-PARTY-RESOURCES =
29 # ignore variants, use the main symlink third-party/bootstrap
30 THIRD-PARTY-RESOURCES += $(shell ls third-party/bootstrap/*/*)
31 # just the single js as identified with a symlink
32 THIRD-PARTY-RESOURCES += $(shell ls third-party/datatables/js/dataTables.js)
34 THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery/js/jquery.js)
35 # spin comes in plain or min, + the jquery plugin, and our own settings
36 THIRD-PARTY-RESOURCES += $(shell ls third-party/spin/*.js)
39 @find $(THIRD-PARTY-RESOURCES) -name '*.js'
41 @find $(THIRD-PARTY-RESOURCES) -name '*.css'
43 @find $(THIRD-PARTY-RESOURCES) -name '*.png'
45 # we might have any of these as templates - e.g. ./engine/templates/plugin-setenv.js
46 # so if there's a /templates/ in the path ignore the file
48 @find . -type f -name '*.js' | egrep -v '/all-(static|templates)/|/third-party/|/templates/'
50 @find . -type f -name '*.css' | egrep -v 'all-(static|templates)/|/third-party/|/templates/'
52 @find . -type f -name '*.png' | egrep -v 'all-(static|templates)/|/third-party/|/templates/'
54 list-js: thirdparty-js local-js
55 list-css: thirdparty-css local-css
56 list-img: thirdparty-img local-img
58 # having templates in a templates/ subdir is fine most of the time except for plugins
59 plugins-templates: force
60 @find plugins -type f -name '*.html'
61 local-templates: force
62 @$(foreach tmpl,$(shell find . -name templates),ls -1 $(tmpl)/*;)
64 list-templates: plugins-templates local-templates
66 #################### manage static contents (extract from all the modules into the single all-static location)
67 static run-static static-run: force
68 mkdir -p ./all-static/js all-static/css all-static/img
69 ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-js),../../$(x)) ./all-static/js
70 ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-css),../../$(x)) ./all-static/css
71 ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-img),../../$(x)) ./all-static/img
73 clean-static static-clean: force
76 all-static: clean-static run-static
78 #################### manage templates for the plugin area
79 templates run-templates templates-run: force
80 mkdir -p all-templates
81 ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-templates),../$(x)) ./all-templates
83 clean-templates templates-clean: force
84 rm -rf ./all-templates
86 all-templates: clean-templates run-templates
89 list-all list-resources: list-templates list-js list-css list-img
91 #################### compute emacs tags
92 # list files under git but exclude third-party stuff like bootstrap and jquery
94 @git ls-files | egrep -v 'insert(_|-)above|/third-party/|/play/'
96 # in general it's right to rely on the contents as reported by git
98 $(MAKE-SILENT) myfiles | xargs etags
100 # however sometimes we have stuff not yet added, so in this case
102 find . -type f | fgrep -v '/.git/' | xargs etags
104 #################### sync : push current code on a (devel) box running myslice
105 SSHURL:=root@$(MYSLICEBOX):/
106 SSHCOMMAND:=ssh root@$(MYSLICEBOX)
109 # the config file should probably not be overridden ??
110 # --exclude settings.py
111 LOCAL_RSYNC_EXCLUDES := --exclude '*.pyc' --exclude config.py --exclude all-static --exclude all-templates --exclude '*.sqlite3'
113 RSYNC_EXCLUDES := --exclude .git --exclude '*~' --exclude TAGS --exclude .DS_Store $(LOCAL_RSYNC_EXCLUDES)
114 # make -n will propagate as rsync -n
115 RSYNC_COND_DRY_RUN := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
116 # putting it together
117 RSYNC := rsync -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
119 # xxx until we come up with a packaging this is going to be a wild guess
120 # on debian04 I have stuff in /usr/share/myslice and a symlink in /root/myslice
121 #INSTALLED=/usr/share/myslice
122 INSTALLED=/root/myslice
125 ifeq (,$(MYSLICEBOX))
126 @echo "you need to set MYSLICEBOX, like in e.g."
127 @echo " $(MAKE) MYSLICEBOX=debian04.pl.sophia.inria.fr "$@""
130 +$(RSYNC) ./ $(SSHURL)/$(INSTALLED)/
133 # xxx likewise until we run this under apache it's probably hard to restart from here
135 ifeq (,$(MYSLICEBOX))
136 @echo "you need to set MYSLICEBOX, like in e.g."
137 @echo " $(MAKE) MYSLICEBOX=debian04.pl.sophia.inria.fr "$@""
140 @echo "$@" target not yet implemented - for an apache based depl it would read ...; exit; @$(SSHCOMMAND) /etc/init.d/apache2 restart