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 #################### compute emacs tags
25 # list files under git but exclude third-party stuff like bootstrap and jquery
27 @git ls-files | egrep -v 'insert(_|-)above|/third-party/|/play/'
29 # in general it's right to rely on the contents as reported by git
31 $(MAKE-SILENT) myfiles | xargs etags
33 # however sometimes we have stuff not yet added, so in this case
35 find . -type f | fgrep -v '/.git/' | xargs etags
37 #################### third-party layout is kind of special
38 # because we have differents versions and all
39 THIRD-PARTY-RESOURCES =
40 # ignore variants, use the main symlink third-party/bootstrap
41 THIRD-PARTY-RESOURCES += $(shell ls third-party/bootstrap/*/*)
42 # just the single js as identified with a symlink
43 THIRD-PARTY-RESOURCES += $(shell ls third-party/datatables/js/dataTables.js)
45 THIRD-PARTY-RESOURCES += $(shell ls third-party/jquery/js/jquery.js)
46 # spin comes in plain or min, + the jquery plugin, and our own settings
47 THIRD-PARTY-RESOURCES += $(shell ls third-party/spin/*.js)
50 @find $(THIRD-PARTY-RESOURCES) -name '*.js'
52 @find $(THIRD-PARTY-RESOURCES) -name '*.css'
54 @find $(THIRD-PARTY-RESOURCES) -name '*.png'
56 # we might have any of these as templates - e.g. ./engine/templates/plugin-setenv.js
57 # so if there's a /templates/ in the path ignore the file
59 @find . -type f -name '*.js' | egrep -v '/all-(static|templates)/|/third-party/|/templates/'
61 @find . -type f -name '*.css' | egrep -v 'all-(static|templates)/|/third-party/|/templates/'
63 @find . -type f -name '*.png' | egrep -v 'all-(static|templates)/|/third-party/|/templates/'
65 list-js: thirdparty-js other-js
66 list-css: thirdparty-css other-css
67 list-img: thirdparty-img other-img
69 # having templates in a templates/ subdir is fine most of the time except for plugins
71 @find plugins -type f -name '*.html'
73 #################### manage static contents (extract from all the modules into the single all-static location)
74 static run-static static-run: force
75 mkdir -p ./all-static/js all-static/css all-static/img
76 ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-js),../../$(x)) ./all-static/js
77 ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-css),../../$(x)) ./all-static/css
78 ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-img),../../$(x)) ./all-static/img
79 # rsync -av $(shell $(MAKE-SILENT) list-js) ./all-static/js
80 # rsync -av $(shell $(MAKE-SILENT) list-css) ./all-static/css
81 # rsync -av $(shell $(MAKE-SILENT) list-img) ./all-static/img
83 clean-static static-clean: force
86 all-static: clean-static run-static
88 #################### manage templates for the plugin area
89 templates run-templates templates-run: force
90 mkdir -p all-templates
91 ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-templates),../$(x)) ./all-templates
92 # rsync -av $(shell $(MAKE-SILENT) list-templates) ./all-templates
94 clean-templates templates-clean: force
95 rm -rf ./all-templates
97 all-templates: clean-templates run-templates
100 list-all list-resources: list-templates list-js list-css list-img
102 #################### sync : push current code on a (devel) box running myslice
103 SSHURL:=root@$(MYSLICEBOX):/
104 SSHCOMMAND:=ssh root@$(MYSLICEBOX)
107 # the config file should probably not be overridden ??
108 # --exclude settings.py
109 LOCAL_RSYNC_EXCLUDES := --exclude '*.pyc' --exclude config.py --exclude all-static --exclude all-templates --exclude '*.sqlite3'
111 RSYNC_EXCLUDES := --exclude .git --exclude '*~' --exclude TAGS --exclude .DS_Store $(LOCAL_RSYNC_EXCLUDES)
112 # make -n will propagate as rsync -n
113 RSYNC_COND_DRY_RUN := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
114 # putting it together
115 RSYNC := rsync -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
117 # xxx until we come up with a packaging this is going to be a wild guess
118 # on debian04 I have stuff in /usr/share/myslice and a symlink in /root/myslice
119 #INSTALLED=/usr/share/myslice
120 INSTALLED=/root/myslice
123 ifeq (,$(MYSLICEBOX))
124 @echo "you need to set MYSLICEBOX, like in e.g."
125 @echo " $(MAKE) MYSLICEBOX=debian04.pl.sophia.inria.fr "$@""
128 +$(RSYNC) ./ $(SSHURL)/$(INSTALLED)/
131 # xxx likewise until we run this under apache it's probably hard to restart from here
133 ifeq (,$(MYSLICEBOX))
134 @echo "you need to set MYSLICEBOX, like in e.g."
135 @echo " $(MAKE) MYSLICEBOX=debian04.pl.sophia.inria.fr "$@""
138 @echo "$@" target not yet implemented - for an apache based depl it would read ...; exit; @$(SSHCOMMAND) /etc/init.d/apache2 restart