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