3 MAKE-SILENT = $(MAKE) --no-print-directory
5 ### first purpose, build and install from setup.py
10 # clean up and recompute
11 redo: redo-static redo-templates
20 build: static templates force
24 python setup.py install \
25 --install-purelib=$(DESTDIR)/$(datadir)/unfold \
26 --install-scripts=$(DESTDIR)/$(datadir)/unfold \
27 --install-data=$(DESTDIR)/$(datadir)/unfold
29 redo-static static: force
31 ./manage.py collectstatic --noinput
35 DATE=$(shell date -u +"%a, %d %b %Y %T")
37 # This is called from the build with the following variables set
38 # (see build/Makefile and target_debian)
43 DEBVERSION=$(RPMVERSION).$(RPMRELEASE)
44 DEBTARBALL=../$(RPMNAME)_$(DEBVERSION).orig.tar.bz2
46 debian: static templates debian/changelog debian.source debian.package
48 debian/changelog: debian/changelog.in
49 sed -e "s|@VERSION@|$(DEBVERSION)|" -e "s|@DATE@|$(DATE)|" debian/changelog.in > debian/changelog
52 rsync -a $(RPMTARBALL) $(DEBTARBALL)
58 $(MAKE) -f debian/rules clean
59 rm -rf build/ MANIFEST ../*.tar.gz ../*.dsc ../*.build
60 find . -name '*.pyc' -delete
63 ### #################### third-party layout is kind of special
64 ### # because we have differents versions, and also we
65 ### # try to preserve the file structure from upstream
66 ### # so let's handle this manually
67 ### THIRD-PARTY-RESOURCES =
68 ### # ignore variants, use the main symlink third-party/bootstrap
69 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/bootstrap/*/*)
70 ### # just the single js as identified with a symlink
71 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/datatables/js/dataTables.js)
72 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/datatables/js/dataTables.bootstrap.js)
73 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/datatables/css/dataTables.bootstrap.css)
75 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery/js/jquery.js)
76 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery/js/jquery.min.js)
77 ### # for storing the visible status of plugins
78 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery-html5storage/jquery.html5storage.js)
79 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery-html5storage/jquery.html5storage.min.js)
80 ### # creating queries uuids on the fly
81 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/uuid/Math.uuid.js)
82 ### # spin comes in plain or min, + the jquery plugin, and our own settings
83 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/spin/*.js)
84 ### # used in QueryCode
85 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/scripts/shCore.js)
86 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/scripts/shAutoloader.js)
87 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/scripts/shBrushPython.js)
88 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/scripts/shBrushRuby.js)
89 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/styles/shCore.css)
90 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/styles/shCoreDefault.css)
91 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/styles/shThemeDefault.css)
93 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/smartwizard-1636c86/js/jquery.smartWizard-2.0.js)
94 ### #THIRD-PARTY-RESOURCES += $(shell ls third-party/smartwizard-1636c86/js/jquery.smartWizard-2.0.min.js)
95 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/smartwizard-1636c86/styles/smart_wizard.css)
97 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery-notify/jquery.notify.js)
98 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery-notify/jquery.notify.min.js)
99 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery-notify/ui.notify.css)
101 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/codemirror-3.15/lib/codemirror.js)
102 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/codemirror-3.15/lib/codemirror.css)
103 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/codemirror-3.15/mode/sql/sql.js)
105 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/mustache/mustache.js)
106 ### # markerclustererplus for the googlemap plugin
107 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/markerclusterer/markerclusterer.js)
108 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/markerclusterer/markerclusterer_packed.js)
111 ### @find $(THIRD-PARTY-RESOURCES) -name '*.js'
113 ### @find $(THIRD-PARTY-RESOURCES) -name '*.css'
115 ### @find $(THIRD-PARTY-RESOURCES) -name '*.png' -o -name '*.ico'
117 ### # we might have any of these as templates - e.g. ./unfold/templates/plugin-init.js
118 ### # so if there's a /templates/ in the path ignore the file
120 ### @find . -type f -name '*.js' | egrep -v '/all-(static|templates)/|/third-party/|/templates/'
122 ### @find . -type f -name '*.css' | egrep -v 'all-(static|templates)/|/third-party/|/templates/'
124 ### @find . -type f -name '*.png' -o -name '*.ico' | egrep -v 'all-(static|templates)/|/third-party/|/templates/'
126 ### list-js: thirdparty-js local-js
127 ### list-css: thirdparty-css local-css
128 ### list-img: thirdparty-img local-img
130 # having templates in a templates/ subdir is fine most of the time except for plugins
131 plugins-templates: force
132 @find plugins -type f -name '*.html'
133 local-templates: force
134 @$(foreach tmpl,$(shell find . -name templates),ls -1 $(tmpl)/*;)
136 list-templates: plugins-templates local-templates
138 ### #################### manage static contents (extract from all the modules into the single all-static location)
139 ### static run-static static-run: force
140 ### mkdir -p ./all-static/js all-static/css all-static/img
141 ### ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-js),../../$(x)) ./all-static/js
142 ### ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-css),../../$(x)) ./all-static/css
143 ### ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-img),../../$(x)) ./all-static/img
145 ### clean-static static-clean: force
146 ### rm -rf ./all-static
148 ### all-static: clean-static run-static
150 #################### manage templates for the plugin area
153 ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-templates),../$(x)) ./templates
155 clean-templates templates-clean: force
158 redo-templates: clean-templates templates
161 ### list-all list-resources: list-templates list-js list-css list-img
163 #################### compute emacs tags
164 # list files under git but exclude third-party stuff like bootstrap and jquery
166 @git ls-files | egrep -v 'insert(_|-)above|third-party/|play/'
168 # in general it's right to rely on the contents as reported by git
170 $(MAKE-SILENT) myfiles | xargs etags
172 # however sometimes we have stuff not yet added, so in this case
174 find . -type f | fgrep -v '/.git/' | xargs etags
176 #################### sync : push current code on a (devel) box running myslice
177 SSHURL:=root@$(MYSLICEBOX):/
178 SSHCOMMAND:=ssh root@$(MYSLICEBOX)
181 # the config file should probably not be overridden ??
182 # --exclude settings.py
183 LOCAL_RSYNC_EXCLUDES := --exclude '*.pyc' --exclude config.py --exclude static --exclude templates --exclude '*.sqlite3' --exclude play/
185 RSYNC_EXCLUDES := --exclude .git --exclude '*~' --exclude TAGS --exclude .DS_Store $(LOCAL_RSYNC_EXCLUDES)
186 # make -n will propagate as rsync -n
187 RSYNC_COND_DRY_RUN := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
188 # putting it together
189 RSYNC := rsync -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
191 ##### convenience for development only, push code on a specific test box
192 # xxx until we come up with a packaging this is going to be a wild guess
193 # on debian04 I have stuff in /usr/share/myslice and a symlink in /root/myslice
194 #INSTALLED=/usr/share/myslice
195 INSTALLED=/root/myslice
198 ifeq (,$(MYSLICEBOX))
199 @echo "you need to set MYSLICEBOX, like in e.g."
200 @echo " $(MAKE) MYSLICEBOX=debian04.pl.sophia.inria.fr "$@""
203 +$(RSYNC) ./ $(SSHURL)/$(INSTALLED)/
206 # xxx likewise until we run this under apache it's probably hard to restart from here
208 ifeq (,$(MYSLICEBOX))
209 @echo "you need to set MYSLICEBOX, like in e.g."
210 @echo " $(MAKE) MYSLICEBOX=debian04.pl.sophia.inria.fr "$@""
213 @echo "$@" target not yet implemented - for an apache based depl it would read ...; exit; @$(SSHCOMMAND) /etc/init.d/apache2 restart