4 # The master makefile sets up the follosing customizable (double-colon) targtets.
7 # This optional target may be used by the user to install the necessary
8 # system requirements via 'aptitude'. Must be called as root
11 # Called for basic setup. Executed before installing the basic eggs
14 # Called to install eggs
17 # Called to install the buildout (e.g. call paster create)
20 # Called after the buildout is installed but BEFORE bootstraping
23 # Called BEFORE updating the buildout (e.g. before calling bin/buildout)
26 # Called to bootstrap the buildout. Here you can add actions to be
27 # performed AFTER bootstraping the project whenever a bootstrap is performed
30 # Called to update the buildout (calls bin/buildout). Here you can add
31 # commands to call AFTER bin/buildout returns.
34 # Called to populate the .gitignore file. Use '@$(gitignore) <pattern>' to
38 # Called to add environment variables to be set when executing a shell
39 # Use @$(env) <var> <value> to add a variable settings. <var> may be
40 # PATH Add <value> to PATH
41 # PYTHONPATH Add <value> to PYTHONPATH
42 # <other> Set variable to <value>
45 # Called to clean up all unimportant generated files. This includes all files
46 # which may be recreated by calling 'init'
49 # Called to provide an overview of important target (this is the default target)
52 # Called to create the list of supplementary targets.
55 # Called to create the list of Makefile variables.
58 ###########################################################################
68 # @$(httpget) <url> [<target>]
70 # Download <url> to <target>. If <target> is missing, <target> defaults to
71 # the last component of the <url>.
73 # If the file exists in $(DLCACHE), it is retrieved from there instead.
78 [ -n "$$target" ] || target="$$name"; \
79 cache="$(BASEDIR)/$(DLCACHE)/$$name"; \
80 if [ -r "$$cache" ]; then \
81 echo "Fetching '$$name' from cache."; \
83 [ -z "$(HTTPGET_NONET)" ] || ( echo "Missing '$$1'."; exit 2 ); \
84 echo "Downloading '$$1'."; \
85 wget -O "$$cache" "$$1"; \
87 cp "$$cache" "$$target"; \
92 ###########################################################################
93 # Customization targets
99 @echo " Makefile for bootstraping and maintaining a buildout. Most important"
100 @echo " targets are:"
103 @echo " update-nonet"
108 @echo " shorthelp (default target)"
110 @echo " Summary of important targets / complete help."
113 @echo " Install debian packages via 'aptitude' needed to satisy build"
114 @echo " dependencies. MUST BE CALLED AS ROOT (e.g. with sudo)."
118 @echo " Initialize buildout. Call this to either bootstrap a new project"
119 @echo " or to initialize a new working copy. Missing packages will be"
120 @echo " downloaded from the internet (init target) or from an up-to-date"
121 @echo " download cache (init-nonet). The download cache normaly resides in"
125 @echo " update-nonet"
126 @echo " Update the buildout. Calls './bin/buildout' (update target) or "
127 @echo " './bin/buildout -No (update-nonet target)."
130 @echo " Spawn an interactive subshell with the environment set up correctly"
131 @echo " for the local buildout."
134 @echo " Remove all unimportant (!) generated files (the remaining files are"
135 @echo " those which may be changed and should be managed as part of the"
136 @echo " project source-code). calling 'make init' or 'make init-nonet' will"
137 @echo " rebuild the development environment."
143 @echo "SUPPLEMENTARY TARGETS"
146 @echo " purge the download cache"
149 @echo " Reinitializes the buildout. This is like calling"
150 @echo " 'make clean cleancache init'. Use this target to upgrade to a new"
151 @echo " python or extension (e.g. PIL) version (after changing the version"
152 @echo " in the project Makefile) or to upgrade the component eggs. This"
153 @echo " target purges the download cache to ensure, no obsolete files are"
160 @echo "MAKEFILE VARIABLES"
162 @echo " DLCACHE ($(DLCACHE))"
163 @echo " Name of the download-cache subdirectory. This directory may be"
164 @echo " persisted e.g. by checking into version control (together with"
165 @echo " the source code or into as a separate repository or by saving into"
166 @echo " an archive. A persistent cache allows the setup to be completely"
167 @echo " reproducible and network independent."
175 mkdir -p $(DLCACHE) $(DLCACHE)/pip
198 [ -r .gitignore ] || touch .gitignore; \
199 grep -qxF "$$1" .gitignore || echo "$$1" >>.gitignore; \
204 @echo "Updating .gitignore."
205 @$(gitignore) "/.env"
209 [ -r .env ] || touch .env; \
211 PATH|PYTHONPATH) line="export $$1=\"$$2:\$$$$1\"" ;; \
212 *) line="export $$1=\"$$2\"" ;; \
214 grep -qxF "$$line" .env || echo "$$line" >>.env; \
219 @echo "Updating .env."
225 ###########################################################################
228 init: setup eggs buildout init-hook update-hook bootstrap update .gitignore .env
231 init-nonet: HTTPGET_NONET=1
236 @eval "`cat .env`"; $$SHELL
246 upgrade: clean cleancache init
250 @[ -n `which less` ] && $(MAKE) -s shorthelp fullhelp varhelp | less \
251 || $(MAKE) -s shorthelp fullhelp varhelp