Merge branch 'master' of ssh://git.onelab.eu/git/myslice
[myslice.git] / Makefile
index bb7da6d..31ee234 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,8 +2,13 @@ SHELL = /bin/bash
 
 MAKE-SILENT = $(MAKE) --no-print-directory
 
-### first purpose, build and install from the specfile
-all: build
+all: static templates
+
+# clean up and recompute
+redo: clean-oldies redo-static redo-templates 
+
+clean-oldies:
+       rm -rf all-static all-templates django-static 
 
 force:
 
@@ -13,8 +18,8 @@ bindir := /usr/bin
 
 PWD := $(shell pwd)
 
-# as of sept. 2013, we collect static files using manage.py
-build: templates
+# 
+build: static templates force
        python setup.py build
 
 install: 
@@ -23,6 +28,14 @@ install:
            --install-scripts=$(DESTDIR)/$(datadir)/unfold \
            --install-data=$(DESTDIR)/$(datadir)/unfold
 
+static: force
+       ./manage.py collectstatic --noinput
+
+clean-static:
+       rm -rf static/
+
+redo-static: clean-static static
+
 ####################
 # general stuff
 DATE=$(shell date -u +"%a, %d %b %Y %T")
@@ -124,31 +137,19 @@ debian.clean:
 plugins-templates: force
        @find plugins -type f -name '*.html' 
 local-templates: force
-       @$(foreach tmpl,$(shell find . -name templates),ls -1 $(tmpl)/*;)
+       @$(foreach tmpl,$(shell find . -name templates | grep -v '^\./templates$$'),ls -1 $(tmpl)/*;)
 
 list-templates: plugins-templates local-templates
 
-### #################### manage static contents (extract from all the modules into the single all-static location)
-### static run-static static-run: force
-###    mkdir -p ./all-static/js all-static/css all-static/img
-###    ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-js),../../$(x)) ./all-static/js
-###    ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-css),../../$(x)) ./all-static/css
-###    ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-img),../../$(x)) ./all-static/img
-### 
-### clean-static static-clean: force
-###    rm -rf ./all-static
-### 
-### all-static: clean-static run-static
-
 #################### manage templates for the plugin area
-templates run-templates templates-run: force
-       mkdir -p all-templates
-       ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-templates),../$(x)) ./all-templates
+templates: force
+       mkdir -p templates
+       ln -sf $(foreach x,$(shell $(MAKE-SILENT) list-templates),../$(x)) ./templates
 
 clean-templates templates-clean: force
-       rm -rf ./all-templates
+       rm -rf ./templates
 
-all-templates: clean-templates run-templates
+redo-templates: clean-templates templates
 
 ####################
 ### list-all list-resources: list-templates list-js list-css list-img
@@ -173,7 +174,7 @@ SSHCOMMAND:=ssh root@$(MYSLICEBOX)
 ### rsync options
 # the config file should probably not be overridden ??
 # --exclude settings.py 
-LOCAL_RSYNC_EXCLUDES   := --exclude '*.pyc' --exclude config.py --exclude all-static --exclude all-templates --exclude '*.sqlite3'  --exclude play/ 
+LOCAL_RSYNC_EXCLUDES   := --exclude '*.pyc' --exclude config.py --exclude static --exclude templates --exclude '*.sqlite3'  --exclude play/ 
 # usual excludes
 RSYNC_EXCLUDES         := --exclude .git --exclude '*~' --exclude TAGS --exclude .DS_Store $(LOCAL_RSYNC_EXCLUDES) 
 # make -n will propagate as rsync -n