3 MAKE-SILENT = $(MAKE) --no-print-directory
5 ### first purpose, build and install from the specfile
16 build: static templates
20 python setup.py install \
21 --install-purelib=$(DESTDIR)/$(datadir)/unfold \
22 --install-scripts=$(DESTDIR)/$(datadir)/unfold \
23 --install-data=$(DESTDIR)/$(datadir)/unfold
27 DATE=$(shell date -u +"%a, %d %b %Y %T")
29 # This is called from the build with the following variables set
30 # (see build/Makefile and target_debian)
35 DEBVERSION=$(RPMVERSION).$(RPMRELEASE)
36 DEBTARBALL=../$(RPMNAME)_$(DEBVERSION).orig.tar.bz2
38 debian: static templates debian/changelog debian.source debian.package
40 debian/changelog: debian/changelog.in
41 sed -e "s|@VERSION@|$(DEBVERSION)|" -e "s|@DATE@|$(DATE)|" debian/changelog.in > debian/changelog
44 rsync -a $(RPMTARBALL) $(DEBTARBALL)
50 $(MAKE) -f debian/rules clean
51 rm -rf build/ MANIFEST ../*.tar.gz ../*.dsc ../*.build
52 find . -name '*.pyc' -delete
55 #################### third-party layout is kind of special
56 # because we have differents versions, and also we
57 # try to preserve the file structure from upstream
58 # so let's handle this manually
59 THIRD-PARTY-RESOURCES =
60 # ignore variants, use the main symlink third-party/bootstrap
61 THIRD-PARTY-RESOURCES += $(shell ls third-party/bootstrap/*/*)
62 # just the single js as identified with a symlink
63 THIRD-PARTY-RESOURCES += $(shell ls third-party/datatables/js/dataTables.js)
64 THIRD-PARTY-RESOURCES += $(shell ls third-party/datatables/js/dataTables.bootstrap.js)
65 THIRD-PARTY-RESOURCES += $(shell ls third-party/datatables/css/dataTables.bootstrap.css)
67 THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery/js/jquery.js)
68 THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery/js/jquery.min.js)
69 # for storing the visible status of plugins
70 THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery-html5storage/jquery.html5storage.js)
71 THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery-html5storage/jquery.html5storage.min.js)
72 # creating queries uuids on the fly
73 THIRD-PARTY-RESOURCES += $(shell ls third-party/uuid/Math.uuid.js)
74 # spin comes in plain or min, + the jquery plugin, and our own settings
75 THIRD-PARTY-RESOURCES += $(shell ls third-party/spin/*.js)
77 THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/scripts/shCore.js)
78 THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/scripts/shAutoloader.js)
79 THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/scripts/shBrushPython.js)
80 THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/scripts/shBrushRuby.js)
81 THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/styles/shCore.css)
82 THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/styles/shCoreDefault.css)
83 THIRD-PARTY-RESOURCES += $(shell ls third-party/syntaxhighlighter/styles/shThemeDefault.css)
87 @find $(THIRD-PARTY-RESOURCES) -name '*.js'
89 @find $(THIRD-PARTY-RESOURCES) -name '*.css'
91 @find $(THIRD-PARTY-RESOURCES) -name '*.png' -o -name '*.ico'
93 # we might have any of these as templates - e.g. ./unfold/templates/plugin-init.js
94 # so if there's a /templates/ in the path ignore the file
96 @find . -type f -name '*.js' | egrep -v '/all-(static|templates)/|/third-party/|/templates/'
98 @find . -type f -name '*.css' | egrep -v 'all-(static|templates)/|/third-party/|/templates/'
100 @find . -type f -name '*.png' -o -name '*.ico' | egrep -v 'all-(static|templates)/|/third-party/|/templates/'
102 list-js: thirdparty-js local-js
103 list-css: thirdparty-css local-css
104 list-img: thirdparty-img local-img
106 # having templates in a templates/ subdir is fine most of the time except for plugins
107 plugins-templates: force
108 @find plugins -type f -name '*.html'
109 local-templates: force
110 @$(foreach tmpl,$(shell find . -name templates),ls -1 $(tmpl)/*;)
112 list-templates: plugins-templates local-templates
114 #################### manage static contents (extract from all the modules into the single all-static location)
115 static run-static static-run: force
116 mkdir -p ./all-static/js all-static/css all-static/img
117 ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-js),../../$(x)) ./all-static/js
118 ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-css),../../$(x)) ./all-static/css
119 ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-img),../../$(x)) ./all-static/img
121 clean-static static-clean: force
124 all-static: clean-static run-static
126 #################### manage templates for the plugin area
127 templates run-templates templates-run: force
128 mkdir -p all-templates
129 ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-templates),../$(x)) ./all-templates
131 clean-templates templates-clean: force
132 rm -rf ./all-templates
134 all-templates: clean-templates run-templates
137 list-all list-resources: list-templates list-js list-css list-img
139 #################### compute emacs tags
140 # list files under git but exclude third-party stuff like bootstrap and jquery
142 @git ls-files | egrep -v 'insert(_|-)above|third-party/|play/'
144 # in general it's right to rely on the contents as reported by git
146 $(MAKE-SILENT) myfiles | xargs etags
148 # however sometimes we have stuff not yet added, so in this case
150 find . -type f | fgrep -v '/.git/' | xargs etags
152 #################### sync : push current code on a (devel) box running myslice
153 SSHURL:=root@$(MYSLICEBOX):/
154 SSHCOMMAND:=ssh root@$(MYSLICEBOX)
157 # the config file should probably not be overridden ??
158 # --exclude settings.py
159 LOCAL_RSYNC_EXCLUDES := --exclude '*.pyc' --exclude config.py --exclude all-static --exclude all-templates --exclude '*.sqlite3' --exclude play/
161 RSYNC_EXCLUDES := --exclude .git --exclude '*~' --exclude TAGS --exclude .DS_Store $(LOCAL_RSYNC_EXCLUDES)
162 # make -n will propagate as rsync -n
163 RSYNC_COND_DRY_RUN := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
164 # putting it together
165 RSYNC := rsync -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
167 ##### convenience for development only, push code on a specific test box
168 # xxx until we come up with a packaging this is going to be a wild guess
169 # on debian04 I have stuff in /usr/share/myslice and a symlink in /root/myslice
170 #INSTALLED=/usr/share/myslice
171 INSTALLED=/root/myslice
174 ifeq (,$(MYSLICEBOX))
175 @echo "you need to set MYSLICEBOX, like in e.g."
176 @echo " $(MAKE) MYSLICEBOX=debian04.pl.sophia.inria.fr "$@""
179 +$(RSYNC) ./ $(SSHURL)/$(INSTALLED)/
182 # xxx likewise until we run this under apache it's probably hard to restart from here
184 ifeq (,$(MYSLICEBOX))
185 @echo "you need to set MYSLICEBOX, like in e.g."
186 @echo " $(MAKE) MYSLICEBOX=debian04.pl.sophia.inria.fr "$@""
189 @echo "$@" target not yet implemented - for an apache based depl it would read ...; exit; @$(SSHCOMMAND) /etc/init.d/apache2 restart