3 MAKE-SILENT = $(MAKE) --no-print-directory
5 ### first purpose, build and install from the specfile
16 build: static templates
20 python setup.py install \
21 --install-purelib=$(DESTDIR)/$(datadir)/myslice \
22 --install-scripts=$(DESTDIR)/$(datadir)/myslice \
23 --install-data=$(DESTDIR)/$(datadir)/myslice
26 #################### third-party layout is kind of special
27 # because we have differents versions, and also we
28 # try to preserve the file structure from upstream
29 # so let's handle this manually
30 THIRD-PARTY-RESOURCES =
31 # ignore variants, use the main symlink third-party/bootstrap
32 THIRD-PARTY-RESOURCES += $(shell ls third-party/bootstrap/*/*)
33 # just the single js as identified with a symlink
34 THIRD-PARTY-RESOURCES += $(shell ls third-party/datatables/js/dataTables.js)
35 THIRD-PARTY-RESOURCES += $(shell ls third-party/datatables/js/dataTables.bootstrap.js)
36 THIRD-PARTY-RESOURCES += $(shell ls third-party/datatables/css/dataTables.bootstrap.css)
38 THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery/js/jquery.js)
39 THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery/js/jquery.min.js)
40 # for storing the visible status of plugins
41 THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery-html5storage/jquery.html5storage.js)
42 THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery-html5storage/jquery.html5storage.min.js)
43 # creating queries uuids on the fly
44 THIRD-PARTY-RESOURCES += $(shell ls third-party/uuid/Math.uuid.js)
45 # spin comes in plain or min, + the jquery plugin, and our own settings
46 THIRD-PARTY-RESOURCES += $(shell ls third-party/spin/*.js)
48 THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/scripts/shCore.js)
49 THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/scripts/shAutoloader.js)
50 THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/scripts/shBrushPython.js)
51 THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/scripts/shBrushRuby.js)
52 THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/styles/shCore.css)
53 THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/styles/shCoreDefault.css)
54 THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/styles/shThemeDefault.css)
58 @find $(THIRD-PARTY-RESOURCES) -name '*.js'
60 @find $(THIRD-PARTY-RESOURCES) -name '*.css'
62 @find $(THIRD-PARTY-RESOURCES) -name '*.png' -o -name '*.ico'
64 # we might have any of these as templates - e.g. ./unfold/templates/plugin-init.js
65 # so if there's a /templates/ in the path ignore the file
67 @find . -type f -name '*.js' | egrep -v '/all-(static|templates)/|/third-party/|/templates/'
69 @find . -type f -name '*.css' | egrep -v 'all-(static|templates)/|/third-party/|/templates/'
71 @find . -type f -name '*.png' -o -name '*.ico' | egrep -v 'all-(static|templates)/|/third-party/|/templates/'
73 list-js: thirdparty-js local-js
74 list-css: thirdparty-css local-css
75 list-img: thirdparty-img local-img
77 # having templates in a templates/ subdir is fine most of the time except for plugins
78 plugins-templates: force
79 @find plugins -type f -name '*.html'
80 local-templates: force
81 @$(foreach tmpl,$(shell find . -name templates),ls -1 $(tmpl)/*;)
83 list-templates: plugins-templates local-templates
85 #################### manage static contents (extract from all the modules into the single all-static location)
86 static run-static static-run: force
87 mkdir -p ./all-static/js all-static/css all-static/img
88 ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-js),../../$(x)) ./all-static/js
89 ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-css),../../$(x)) ./all-static/css
90 ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-img),../../$(x)) ./all-static/img
92 clean-static static-clean: force
95 all-static: clean-static run-static
97 #################### manage templates for the plugin area
98 templates run-templates templates-run: force
99 mkdir -p all-templates
100 ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-templates),../$(x)) ./all-templates
102 clean-templates templates-clean: force
103 rm -rf ./all-templates
105 all-templates: clean-templates run-templates
108 list-all list-resources: list-templates list-js list-css list-img
110 #################### compute emacs tags
111 # list files under git but exclude third-party stuff like bootstrap and jquery
113 @git ls-files | egrep -v 'insert(_|-)above|third-party/|play/'
115 # in general it's right to rely on the contents as reported by git
117 $(MAKE-SILENT) myfiles | xargs etags
119 # however sometimes we have stuff not yet added, so in this case
121 find . -type f | fgrep -v '/.git/' | xargs etags
123 #################### sync : push current code on a (devel) box running myslice
124 SSHURL:=root@$(MYSLICEBOX):/
125 SSHCOMMAND:=ssh root@$(MYSLICEBOX)
128 # the config file should probably not be overridden ??
129 # --exclude settings.py
130 LOCAL_RSYNC_EXCLUDES := --exclude '*.pyc' --exclude config.py --exclude all-static --exclude all-templates --exclude '*.sqlite3' --exclude play/
132 RSYNC_EXCLUDES := --exclude .git --exclude '*~' --exclude TAGS --exclude .DS_Store $(LOCAL_RSYNC_EXCLUDES)
133 # make -n will propagate as rsync -n
134 RSYNC_COND_DRY_RUN := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
135 # putting it together
136 RSYNC := rsync -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
138 # xxx until we come up with a packaging this is going to be a wild guess
139 # on debian04 I have stuff in /usr/share/myslice and a symlink in /root/myslice
140 #INSTALLED=/usr/share/myslice
141 INSTALLED=/root/myslice
144 ifeq (,$(MYSLICEBOX))
145 @echo "you need to set MYSLICEBOX, like in e.g."
146 @echo " $(MAKE) MYSLICEBOX=debian04.pl.sophia.inria.fr "$@""
149 +$(RSYNC) ./ $(SSHURL)/$(INSTALLED)/
152 # xxx likewise until we run this under apache it's probably hard to restart from here
154 ifeq (,$(MYSLICEBOX))
155 @echo "you need to set MYSLICEBOX, like in e.g."
156 @echo " $(MAKE) MYSLICEBOX=debian04.pl.sophia.inria.fr "$@""
159 @echo "$@" target not yet implemented - for an apache based depl it would read ...; exit; @$(SSHCOMMAND) /etc/init.d/apache2 restart