Fixed bug: select columns all checked in filters, autocomplete based on query_all...
[myslice.git] / Makefile
1 SHELL = /bin/bash
2
3 MAKE-SILENT = $(MAKE) --no-print-directory
4
5 all: static templates
6
7 # clean up and recompute
8 redo: clean-oldies redo-static redo-templates 
9
10 clean-oldies:
11         rm -rf all-static all-templates django-static 
12
13 force:
14
15 DESTDIR := /
16 datadir := /usr/share
17 bindir := /usr/bin
18
19 PWD := $(shell pwd)
20
21
22 build: static templates force
23         python setup.py build
24
25 install: 
26         python setup.py install \
27             --install-purelib=$(DESTDIR)/$(datadir)/unfold \
28             --install-scripts=$(DESTDIR)/$(datadir)/unfold \
29             --install-data=$(DESTDIR)/$(datadir)/unfold
30
31 static: force
32         ./manage.py collectstatic --noinput
33
34 clean-static:
35         rm -rf static/
36
37 redo-static: clean-static static
38
39 ####################
40 # general stuff
41 DATE=$(shell date -u +"%a, %d %b %Y %T")
42
43 # This is called from the build with the following variables set 
44 # (see build/Makefile and target_debian)
45 # (.) RPMTARBALL
46 # (.) RPMVERSION
47 # (.) RPMRELEASE
48 # (.) RPMNAME
49 DEBVERSION=$(RPMVERSION).$(RPMRELEASE)
50 DEBTARBALL=../$(RPMNAME)_$(DEBVERSION).orig.tar.bz2
51
52 debian: static templates debian/changelog debian.source debian.package
53
54 debian/changelog: debian/changelog.in
55         sed -e "s|@VERSION@|$(DEBVERSION)|" -e "s|@DATE@|$(DATE)|" debian/changelog.in > debian/changelog
56
57 debian.source: force 
58         rsync -a $(RPMTARBALL) $(DEBTARBALL)
59
60 debian.package:
61         debuild -uc -us -b 
62
63 debian.clean:
64         $(MAKE) -f debian/rules clean
65         rm -rf build/ MANIFEST ../*.tar.gz ../*.dsc ../*.build
66         find . -name '*.pyc' -delete
67
68
69 ### #################### third-party layout is kind of special 
70 ### # because we have differents versions, and also we 
71 ### # try to preserve the file structure from upstream
72 ### # so let's handle this manually
73 ### THIRD-PARTY-RESOURCES =
74 ### # ignore variants, use the main symlink     third-party/bootstrap
75 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/bootstrap/*/*)
76 ### # just the single js as identified with a symlink
77 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/datatables/js/dataTables.js)
78 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/datatables/js/dataTables.bootstrap.js)
79 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/datatables/css/dataTables.bootstrap.css)
80 ### # likewise
81 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery/js/jquery.js)
82 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery/js/jquery.min.js)
83 ### # for storing the visible status of plugins
84 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery-html5storage/jquery.html5storage.js)
85 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery-html5storage/jquery.html5storage.min.js)
86 ### # creating queries uuids on the fly
87 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/uuid/Math.uuid.js)
88 ### # spin comes in plain or min, + the jquery plugin, and our own settings
89 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/spin/*.js)
90 ### # used in QueryCode
91 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/scripts/shCore.js)
92 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/scripts/shAutoloader.js)
93 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/scripts/shBrushPython.js)
94 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/scripts/shBrushRuby.js)
95 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/styles/shCore.css)
96 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/styles/shCoreDefault.css)
97 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/styles/shThemeDefault.css)
98 ### # wizard plugin
99 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/smartwizard-1636c86/js/jquery.smartWizard-2.0.js)
100 ### #THIRD-PARTY-RESOURCES += $(shell ls third-party/smartwizard-1636c86/js/jquery.smartWizard-2.0.min.js)
101 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/smartwizard-1636c86/styles/smart_wizard.css)
102 ### # jquery.notify
103 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery-notify/jquery.notify.js)
104 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery-notify/jquery.notify.min.js)
105 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery-notify/ui.notify.css)
106 ### # CodeMirror
107 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/codemirror-3.15/lib/codemirror.js) 
108 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/codemirror-3.15/lib/codemirror.css) 
109 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/codemirror-3.15/mode/sql/sql.js)
110 ### # Mustache.js
111 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/mustache/mustache.js)
112 ### # markerclustererplus for the googlemap plugin
113 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/markerclusterer/markerclusterer.js)
114 ### THIRD-PARTY-RESOURCES += $(shell ls third-party/markerclusterer/markerclusterer_packed.js)
115 ### 
116 ### thirdparty-js:
117 ###     @find $(THIRD-PARTY-RESOURCES) -name '*.js'
118 ### thirdparty-css:
119 ###     @find $(THIRD-PARTY-RESOURCES) -name '*.css'
120 ### thirdparty-img:
121 ###     @find $(THIRD-PARTY-RESOURCES) -name '*.png' -o -name '*.ico'
122 ### 
123 ### # we might have any of these as templates - e.g. ./unfold/templates/plugin-init.js
124 ### # so if there's a /templates/ in the path ignore the file
125 ### local-js: force
126 ###     @find . -type f -name '*.js' | egrep -v '/all-(static|templates)/|/third-party/|/templates/'
127 ### local-css: force
128 ###     @find . -type f -name '*.css' | egrep -v 'all-(static|templates)/|/third-party/|/templates/'
129 ### local-img: force
130 ###     @find . -type f -name '*.png' -o -name '*.ico' | egrep -v 'all-(static|templates)/|/third-party/|/templates/'
131 ### 
132 ### list-js: thirdparty-js local-js
133 ### list-css: thirdparty-css local-css
134 ### list-img: thirdparty-img local-img
135
136 # having templates in a templates/ subdir is fine most of the time except for plugins
137 plugins-templates: force
138         @find plugins -type f -name '*.html' 
139 local-templates: force
140         @$(foreach tmpl,$(shell find . -name templates | grep -v '^\./templates$$'),ls -1 $(tmpl)/*;)
141
142 list-templates: plugins-templates local-templates
143
144 #################### manage templates for the plugin area
145 templates: force
146         mkdir -p templates
147         ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-templates),../$(x)) ./templates
148
149 clean-templates templates-clean: force
150         rm -rf ./templates
151
152 redo-templates: clean-templates templates
153
154 ####################
155 ### list-all list-resources: list-templates list-js list-css list-img
156
157 #################### compute emacs tags
158 # list files under git but exclude third-party stuff like bootstrap and jquery
159 myfiles: force
160         @git ls-files | egrep -v 'insert(_|-)above|third-party/|play/'
161
162 # in general it's right to rely on the contents as reported by git
163 tags: force
164         $(MAKE-SILENT) myfiles | xargs etags
165
166 # however sometimes we have stuff not yet added, so in this case
167 ftags: force
168         find . -type f | fgrep -v '/.git/' | xargs etags
169
170 #################### sync : push current code on a (devel) box running myslice
171 SSHURL:=root@$(MYSLICEBOX):/
172 SSHCOMMAND:=ssh root@$(MYSLICEBOX)
173
174 ### rsync options
175 # the config file should probably not be overridden ??
176 # --exclude settings.py 
177 LOCAL_RSYNC_EXCLUDES    := --exclude '*.pyc' --exclude config.py --exclude static --exclude templates --exclude '*.sqlite3'  --exclude play/ 
178 # usual excludes
179 RSYNC_EXCLUDES          := --exclude .git --exclude '*~' --exclude TAGS --exclude .DS_Store $(LOCAL_RSYNC_EXCLUDES) 
180 # make -n will propagate as rsync -n 
181 RSYNC_COND_DRY_RUN      := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
182 # putting it together
183 RSYNC                   := rsync -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
184
185 ##### convenience for development only, push code on a specific test box
186 # xxx until we come up with a packaging this is going to be a wild guess
187 # on debian04 I have stuff in /usr/share/myslice and a symlink in /root/myslice
188 #INSTALLED=/usr/share/myslice
189 INSTALLED=/root/myslice
190
191 sync:
192 ifeq (,$(MYSLICEBOX))
193         @echo "you need to set MYSLICEBOX, like in e.g."
194         @echo "  $(MAKE) MYSLICEBOX=debian04.pl.sophia.inria.fr "$@""
195         @exit 1
196 else
197         +$(RSYNC) ./ $(SSHURL)/$(INSTALLED)/
198 endif
199
200 # xxx likewise until we run this under apache it's probably hard to restart from here
201 restart:
202 ifeq (,$(MYSLICEBOX))
203         @echo "you need to set MYSLICEBOX, like in e.g."
204         @echo "  $(MAKE) MYSLICEBOX=debian04.pl.sophia.inria.fr "$@""
205         @exit 1
206 else
207         @echo "$@" target not yet implemented - for an apache based depl it would read ...; exit; @$(SSHCOMMAND) /etc/init.d/apache2 restart
208 endif