Update plone3 skeleton
[zope-bootstrap.git] / Makefile.master
index 22ff4b6..4d69e96 100644 (file)
 #        <other>      Set variable to <value>
 # 
 # clean::
-#     Called to clean up all generated files
+#     Called to clean up all unimportant generated files. This includes all files
+#     which may be recreated by calling 'init'
+#
+# shorthelp::
+#     Called to provide an overview of important target (this is the default target)
+#
+# fullhelp::
+#     Called to create the list of supplementary targets.
+#
+# varhelp::
+#     Called to create the list of Makefile variables.
 #
 
 ###########################################################################
@@ -62,20 +72,20 @@ default: shorthelp
 #
 # If the file exists in $(DLCACHE), it is retrieved from there instead.
 define httpget
-    _httpget() {                                                       \
-       name="$${1##*/}";                                               \
-       target="$$2";                                                   \
-       [ -n "$$target" ] || target="$$name";                           \
-       cache="$(DLCACHE)/$$name";                                      \
-       if [ -r "$$cache" ]; then                                       \
-           echo "Fetching '$$name' from cache.";                       \
-       else                                                            \
+    _httpget() {                                                               \
+       name="$${1##*/}";                                                       \
+       target="$$2";                                                           \
+       [ -n "$$target" ] || target="$$name";                                   \
+       cache="$(BASEDIR)/$(DLCACHE)/$$name";                                   \
+       if [ -r "$$cache" ]; then                                               \
+           echo "Fetching '$$name' from cache.";                               \
+       else                                                                    \
            [ -z "$(HTTPGET_NONET)" ] || ( echo "Missing '$$1'."; exit 2 );     \
-           echo "Downloading '$$1'.";                                  \
-           wget -O "$$cache" "$$1";                                    \
-       fi;                                                             \
-       cp "$$cache" "$$target";                                        \
-    };                                                                 \
+           echo "Downloading '$$1'.";                                          \
+           wget -O "$$cache" "$$1";                                            \
+       fi;                                                                     \
+       cp "$$cache" "$$target";                                                \
+    };                                                                         \
     _httpget
 endef
 
@@ -95,50 +105,68 @@ shorthelp::
        @echo
        @echo "MAIN TARGETS"
        @echo
-       @echo "    shorthelp"
-       @echo "        Summary of important targets"
-       @echo
+       @echo "    shorthelp (default target)"
        @echo "    help"
-       @echo "        Complete list of user-targets"
+       @echo "        Summary of important targets / complete help."
        @echo
        @echo "    debdepends"
        @echo "        Install debian packages via 'aptitude' needed to satisy build"
        @echo "        dependencies. MUST BE CALLED AS ROOT (e.g. with sudo)."
        @echo
        @echo "    init"
+       @echo "    init-nonet"
        @echo "        Initialize buildout. Call this to either bootstrap a new project"
        @echo "        or to initialize a new working copy. Missing packages will be"
-       @echo "        downloaded from the internet."
-       @echo
-       @echo "    init-nonet"
-       @echo "        Initialize buildout from cache. Like 'init' but does not download"
-       @echo "        any packages from the internet. Needs an up-to-date download cache."
+       @echo "        downloaded from the internet (init target) or from an up-to-date"
+       @echo "        download cache (init-nonet). The download cache normaly resides in"
+       @echo "        './dlcache'"
        @echo
        @echo "    update"
-       @echo "        Update the buildout (calls './bin/buildout'). This target may need"
-       @echo "        network access."
-       @echo
        @echo "    update-nonet"
-       @echo "        Update the buildout (calls './bin/buildout -No') with no network"
-       @echo "        access."
+       @echo "        Update the buildout. Calls './bin/buildout' (update target) or "
+       @echo "        './bin/buildout -No (update-nonet target)."
        @echo
        @echo "    shell"
        @echo "        Spawn an interactive subshell with the environment set up correctly"
        @echo "        for the local buildout."
        @echo
-       @echo "    versions"
-       @echo "        Generate lines to be added to 'buildout.cfg' to pin all package"
-       @echo "        versions."
-       @echo
        @echo "    clean"
-       @echo "        Remove all generated files."
+       @echo "        Remove all unimportant (!) generated files (the remaining files are"
+       @echo "        those which may be changed and should be managed as part of the"
+       @echo "        project source-code). calling 'make init' or 'make init-nonet' will"
+       @echo "        rebuild the development environment."
        @echo
 .PHONY: shorthelp
 
-help:: shorthelp
+fullhelp::
+       @echo
+       @echo "SUPPLEMENTARY TARGETS"
        @echo
-       @echo "SECONDARY TARGETS"
+       @echo "    cleancache"
+       @echo "        purge the download cache"
        @echo
+       @echo "    upgrade"
+       @echo "        Reinitializes the buildout. This is like calling"
+       @echo "        'make clean cleancache init'. Use this target to upgrade to a new"
+       @echo "        python or extension (e.g. PIL) version (after changing the version"
+       @echo "        in the project Makefile) or to upgrade the component eggs. This"
+       @echo "        target purges the download cache to ensure, no obsolete files are"
+       @echo "        left."
+       @echo
+.PHONY: fullhelp
+
+varhelp::
+       @echo
+       @echo "MAKEFILE VARIABLES"
+       @echo
+       @echo "    DLCACHE ($(DLCACHE))"
+       @echo "        Name of the download-cache subdirectory. This directory may be"
+       @echo "        persisted e.g. by checking into version control (together with"
+       @echo "        the source code or into as a separate repository or by saving into"
+       @echo "        an archive. A persistent cache allows the setup to be completely"
+       @echo "        reproducible and network independent."
+       @echo
+.PHONY: varhelp
 
 debdepends::
 .PHONY: debdepends
@@ -160,12 +188,9 @@ update-hook::
 .PHONY: update-hook
 
 bootstrap::
-       sed -i -e '1s/^#!.*\/python/#!$(subst /,\/,$(PYTHON))/' $(PYTHON_DIR)/bin/*
-       $(PYTHON) -c 'from zc.buildout.buildout import main; main(["bootstrap"])'
 .PHONY: bootstrap
 
 update:: update-hook
-       bin/buildout $(BUILDOUT_OPTS)
 .PHONY: update
 
 define gitignore
@@ -177,10 +202,7 @@ define gitignore
 endef
 .gitignore::
        @echo "Updating .gitignore."
-       @$(gitignore) "*.pyc"
-       @$(gitignore) "*.egg-info/"
        @$(gitignore) "/.env"
-       @$(gitignore) "/.nonet.cfg"
 
 define env
     _env () {                                                  \
@@ -197,7 +219,7 @@ endef
        @echo "Updating .env."
 
 clean::
-       rm -f .gitignore .env
+       rm -f .env
 .PHONY: clean
 
 ###########################################################################
@@ -210,14 +232,21 @@ init-nonet: HTTPGET_NONET=1
 init-nonet: init
 .PHONY: init-nonet
 
-versions:
-       @echo "# Add the following lines to [versions] in buildout.cfg to pin all packages"
-       @bin/buildout -vvvvv | sed -ne 's/^Picked: //p' | sort | uniq 
-.PHONY: versions
-
 shell:
        @eval "`cat .env`"; $$SHELL
 .PHONY: shell
 
 update-nonet: update
 .PHONY: update-nonet
+
+cleancache:
+       rm -rf $(DLCACHE)/*
+.PHONY: cleancache
+
+upgrade: clean cleancache init
+.PHONY: upgrade
+
+help:
+       @[ -n `which less` ] && $(MAKE) -s shorthelp fullhelp varhelp | less \
+               || $(MAKE) -s shorthelp fullhelp varhelp
+.PHONY: help
\ No newline at end of file