3 MAKE-SILENT = $(MAKE) --no-print-directory
5 ### first purpose, build and install from the specfile
16 # as of sept. 2013, we collect static files using manage.py
21 python setup.py install \
22 --install-purelib=$(DESTDIR)/$(datadir)/unfold \
23 --install-scripts=$(DESTDIR)/$(datadir)/unfold \
24 --install-data=$(DESTDIR)/$(datadir)/unfold
28 DATE=$(shell date -u +"%a, %d %b %Y %T")
30 # This is called from the build with the following variables set
31 # (see build/Makefile and target_debian)
36 DEBVERSION=$(RPMVERSION).$(RPMRELEASE)
37 DEBTARBALL=../$(RPMNAME)_$(DEBVERSION).orig.tar.bz2
39 debian: static templates debian/changelog debian.source debian.package
41 debian/changelog: debian/changelog.in
42 sed -e "s|@VERSION@|$(DEBVERSION)|" -e "s|@DATE@|$(DATE)|" debian/changelog.in > debian/changelog
45 rsync -a $(RPMTARBALL) $(DEBTARBALL)
51 $(MAKE) -f debian/rules clean
52 rm -rf build/ MANIFEST ../*.tar.gz ../*.dsc ../*.build
53 find . -name '*.pyc' -delete
56 ### #################### third-party layout is kind of special
57 ### # because we have differents versions, and also we
58 ### # try to preserve the file structure from upstream
59 ### # so let's handle this manually
60 ### THIRD-PARTY-RESOURCES =
61 ### # ignore variants, use the main symlink third-party/bootstrap
62 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/bootstrap/*/*)
63 ### # just the single js as identified with a symlink
64 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/datatables/js/dataTables.js)
65 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/datatables/js/dataTables.bootstrap.js)
66 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/datatables/css/dataTables.bootstrap.css)
68 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery/js/jquery.js)
69 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery/js/jquery.min.js)
70 ### # for storing the visible status of plugins
71 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery-html5storage/jquery.html5storage.js)
72 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery-html5storage/jquery.html5storage.min.js)
73 ### # creating queries uuids on the fly
74 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/uuid/Math.uuid.js)
75 ### # spin comes in plain or min, + the jquery plugin, and our own settings
76 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/spin/*.js)
77 ### # used in QueryCode
78 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/scripts/shCore.js)
79 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/scripts/shAutoloader.js)
80 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/scripts/shBrushPython.js)
81 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/scripts/shBrushRuby.js)
82 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/styles/shCore.css)
83 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/styles/shCoreDefault.css)
84 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/styles/shThemeDefault.css)
86 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/smartwizard-1636c86/js/jquery.smartWizard-2.0.js)
87 ### #THIRD-PARTY-RESOURCES += $(shell ls third-party/smartwizard-1636c86/js/jquery.smartWizard-2.0.min.js)
88 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/smartwizard-1636c86/styles/smart_wizard.css)
90 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery-notify/jquery.notify.js)
91 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery-notify/jquery.notify.min.js)
92 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery-notify/ui.notify.css)
94 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/codemirror-3.15/lib/codemirror.js)
95 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/codemirror-3.15/lib/codemirror.css)
96 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/codemirror-3.15/mode/sql/sql.js)
98 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/mustache/mustache.js)
99 ### # markerclustererplus for the googlemap plugin
100 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/markerclusterer/markerclusterer.js)
101 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/markerclusterer/markerclusterer_packed.js)
104 ### @find $(THIRD-PARTY-RESOURCES) -name '*.js'
106 ### @find $(THIRD-PARTY-RESOURCES) -name '*.css'
108 ### @find $(THIRD-PARTY-RESOURCES) -name '*.png' -o -name '*.ico'
110 ### # we might have any of these as templates - e.g. ./unfold/templates/plugin-init.js
111 ### # so if there's a /templates/ in the path ignore the file
113 ### @find . -type f -name '*.js' | egrep -v '/all-(static|templates)/|/third-party/|/templates/'
115 ### @find . -type f -name '*.css' | egrep -v 'all-(static|templates)/|/third-party/|/templates/'
117 ### @find . -type f -name '*.png' -o -name '*.ico' | egrep -v 'all-(static|templates)/|/third-party/|/templates/'
119 ### list-js: thirdparty-js local-js
120 ### list-css: thirdparty-css local-css
121 ### list-img: thirdparty-img local-img
123 # having templates in a templates/ subdir is fine most of the time except for plugins
124 plugins-templates: force
125 @find plugins -type f -name '*.html'
126 local-templates: force
127 @$(foreach tmpl,$(shell find . -name templates),ls -1 $(tmpl)/*;)
129 list-templates: plugins-templates local-templates
131 ### #################### manage static contents (extract from all the modules into the single all-static location)
132 ### static run-static static-run: force
133 ### mkdir -p ./all-static/js all-static/css all-static/img
134 ### ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-js),../../$(x)) ./all-static/js
135 ### ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-css),../../$(x)) ./all-static/css
136 ### ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-img),../../$(x)) ./all-static/img
138 ### clean-static static-clean: force
139 ### rm -rf ./all-static
141 ### all-static: clean-static run-static
143 #################### manage templates for the plugin area
144 templates run-templates templates-run: force
145 mkdir -p all-templates
146 ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-templates),../$(x)) ./all-templates
148 clean-templates templates-clean: force
149 rm -rf ./all-templates
151 all-templates: clean-templates run-templates
154 ### list-all list-resources: list-templates list-js list-css list-img
156 #################### compute emacs tags
157 # list files under git but exclude third-party stuff like bootstrap and jquery
159 @git ls-files | egrep -v 'insert(_|-)above|third-party/|play/'
161 # in general it's right to rely on the contents as reported by git
163 $(MAKE-SILENT) myfiles | xargs etags
165 # however sometimes we have stuff not yet added, so in this case
167 find . -type f | fgrep -v '/.git/' | xargs etags
169 #################### sync : push current code on a (devel) box running myslice
170 SSHURL:=root@$(MYSLICEBOX):/
171 SSHCOMMAND:=ssh root@$(MYSLICEBOX)
174 # the config file should probably not be overridden ??
175 # --exclude settings.py
176 LOCAL_RSYNC_EXCLUDES := --exclude '*.pyc' --exclude config.py --exclude all-static --exclude all-templates --exclude '*.sqlite3' --exclude play/
178 RSYNC_EXCLUDES := --exclude .git --exclude '*~' --exclude TAGS --exclude .DS_Store $(LOCAL_RSYNC_EXCLUDES)
179 # make -n will propagate as rsync -n
180 RSYNC_COND_DRY_RUN := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
181 # putting it together
182 RSYNC := rsync -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
184 ##### convenience for development only, push code on a specific test box
185 # xxx until we come up with a packaging this is going to be a wild guess
186 # on debian04 I have stuff in /usr/share/myslice and a symlink in /root/myslice
187 #INSTALLED=/usr/share/myslice
188 INSTALLED=/root/myslice
191 ifeq (,$(MYSLICEBOX))
192 @echo "you need to set MYSLICEBOX, like in e.g."
193 @echo " $(MAKE) MYSLICEBOX=debian04.pl.sophia.inria.fr "$@""
196 +$(RSYNC) ./ $(SSHURL)/$(INSTALLED)/
199 # xxx likewise until we run this under apache it's probably hard to restart from here
201 ifeq (,$(MYSLICEBOX))
202 @echo "you need to set MYSLICEBOX, like in e.g."
203 @echo " $(MAKE) MYSLICEBOX=debian04.pl.sophia.inria.fr "$@""
206 @echo "$@" target not yet implemented - for an apache based depl it would read ...; exit; @$(SSHCOMMAND) /etc/init.d/apache2 restart