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)
36 THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery-ui/themes/base/jquery-ui.css)
37 # spin comes in plain or min, + the jquery plugin, and our own settings
38 THIRD-PARTY-RESOURCES += $(shell ls third-party/spin/*.js)
40 THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/scripts/sh{Core,Autoloader,BrushPython,BrushRuby}.js)
41 THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/styles/sh{Core,CoreDefault,ThemeDefault}.css)
45 @find $(THIRD-PARTY-RESOURCES) -name '*.js'
47 @find $(THIRD-PARTY-RESOURCES) -name '*.css'
49 @find $(THIRD-PARTY-RESOURCES) -name '*.png' -o -name '*.ico'
51 # we might have any of these as templates - e.g. ./unfold/templates/plugin-init.js
52 # so if there's a /templates/ in the path ignore the file
54 @find . -type f -name '*.js' | egrep -v '/all-(static|templates)/|/third-party/|/templates/'
56 @find . -type f -name '*.css' | egrep -v 'all-(static|templates)/|/third-party/|/templates/'
58 @find . -type f -name '*.png' -o -name '*.ico' | egrep -v 'all-(static|templates)/|/third-party/|/templates/'
60 list-js: thirdparty-js local-js
61 list-css: thirdparty-css local-css
62 list-img: thirdparty-img local-img
64 # having templates in a templates/ subdir is fine most of the time except for plugins
65 plugins-templates: force
66 @find plugins -type f -name '*.html'
67 local-templates: force
68 @$(foreach tmpl,$(shell find . -name templates),ls -1 $(tmpl)/*;)
70 list-templates: plugins-templates local-templates
72 #################### manage static contents (extract from all the modules into the single all-static location)
73 static run-static static-run: force
74 mkdir -p ./all-static/js all-static/css all-static/img
75 ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-js),../../$(x)) ./all-static/js
76 ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-css),../../$(x)) ./all-static/css
77 ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-img),../../$(x)) ./all-static/img
79 clean-static static-clean: force
82 all-static: clean-static run-static
84 #################### manage templates for the plugin area
85 templates run-templates templates-run: force
86 mkdir -p all-templates
87 ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-templates),../$(x)) ./all-templates
89 clean-templates templates-clean: force
90 rm -rf ./all-templates
92 all-templates: clean-templates run-templates
95 list-all list-resources: list-templates list-js list-css list-img
97 #################### compute emacs tags
98 # list files under git but exclude third-party stuff like bootstrap and jquery
100 @git ls-files | egrep -v 'insert(_|-)above|third-party/|play/'
102 # in general it's right to rely on the contents as reported by git
104 $(MAKE-SILENT) myfiles | xargs etags
106 # however sometimes we have stuff not yet added, so in this case
108 find . -type f | fgrep -v '/.git/' | xargs etags
110 #################### sync : push current code on a (devel) box running myslice
111 SSHURL:=root@$(MYSLICEBOX):/
112 SSHCOMMAND:=ssh root@$(MYSLICEBOX)
115 # the config file should probably not be overridden ??
116 # --exclude settings.py
117 LOCAL_RSYNC_EXCLUDES := --exclude '*.pyc' --exclude config.py --exclude all-static --exclude all-templates --exclude '*.sqlite3' --exclude play/
119 RSYNC_EXCLUDES := --exclude .git --exclude '*~' --exclude TAGS --exclude .DS_Store $(LOCAL_RSYNC_EXCLUDES)
120 # make -n will propagate as rsync -n
121 RSYNC_COND_DRY_RUN := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
122 # putting it together
123 RSYNC := rsync -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
125 # xxx until we come up with a packaging this is going to be a wild guess
126 # on debian04 I have stuff in /usr/share/myslice and a symlink in /root/myslice
127 #INSTALLED=/usr/share/myslice
128 INSTALLED=/root/myslice
131 ifeq (,$(MYSLICEBOX))
132 @echo "you need to set MYSLICEBOX, like in e.g."
133 @echo " $(MAKE) MYSLICEBOX=debian04.pl.sophia.inria.fr "$@""
136 +$(RSYNC) ./ $(SSHURL)/$(INSTALLED)/
139 # xxx likewise until we run this under apache it's probably hard to restart from here
141 ifeq (,$(MYSLICEBOX))
142 @echo "you need to set MYSLICEBOX, like in e.g."
143 @echo " $(MAKE) MYSLICEBOX=debian04.pl.sophia.inria.fr "$@""
146 @echo "$@" target not yet implemented - for an apache based depl it would read ...; exit; @$(SSHCOMMAND) /etc/init.d/apache2 restart