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