File: GNUmakefile.in

package info (click to toggle)
qm 1.1.3-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 8,628 kB
  • ctags: 10,249
  • sloc: python: 41,482; ansic: 20,611; xml: 12,837; sh: 485; makefile: 226
file content (416 lines) | stat: -rw-r--r-- 11,429 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
######################################################### -*-Makefile-*-
#
# File:   Makefile
# Author: Alex Samuel
# Date:   2000-12-20
#
# Contents:
#   Top-level qm makefile.
# 
# Copyright (C) 2001, 2002 CodeSourcery LLC
#
# For license terms see the file COPYING.
#
########################################################################

# The QM Tools that are being built in this version of QM.
QM_TOOLS	:= $(notdir \
                     $(filter qm/test qm/track, \
	               $(wildcard qm/*)))

# This trick is necessary to create a make variable containing a
# single space.  See the "(make)Flavors" info page.
NULLSTRING	:=
SPACE		:= $(NULLSTRING) # This comment needs to be here.

TOPDIR		= @top_srcdir@

PYTHONDOCDIRS	= qm

# Python configuration.
PYTHONBIN	= @PYTHON@
PYTHON 		= PYTHONPATH=$(subst $(SPACE),:,$(PYTHONDIRS)) \
		  $(PYTHONBIN) -O
PYTHON_VERSION	= @PYTHON_VERSION@
PYTHON_PREFIX   = @PYTHON_PREFIX@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHONDIRS	= $(TOPDIR) \
                  $(TOPDIR)/zope-dtml \
                  $(TOPDIR)/zope-dtml/ExtensionClass

# Python packages with installation scripts.
PYTHON_PACKAGES = \
	qm \
	PyXML \
	zope-dtml/DocumentTemplate \
	zope-dtml/ExtensionClass \
	xmlrpc
PYTHON_PACKAGES = \
	qm \
	zope-dtml/DocumentTemplate \
	zope-dtml/ExtensionClass \
	xmlrpc
# The names of rules to install the PYTHON_PACKAGES.
PYTHON_PACKAGES_INSTALL = $(PYTHON_PACKAGES:=-install)

# The scripts that are run to start QM.
SCRIPTS = $(foreach tool,$(QM_TOOLS),qm/$(tool)/qm$(tool)$(SCRIPT_EXT))

# The DTD catalog.
DTD_CATALOG := share/xml/CATALOG
# The common DTDs.
COMMON_DTDS := $(wildcard share/xml/*.mod)
# The tool-specific DTDs.	
TOOL_DTDS := $(foreach tool, \
	       $(QM_TOOLS), \
               $(wildcard qm/$(tool)/share/dtds/*.dtd))
# The tool-specifi DTDs, copied to the common XML directory.
COPIED_TOOL_DTDS := $(foreach dtd,$(TOOL_DTDS),share/xml/$(notdir $(dtd)))
# All the DTDs.
DTDS := $(COMMON_DTDS) $(COPIED_TOOL_DTDS)

# Whether or not we should generate documentation.
DOCUMENTATION = @DOCUMENTATION@

# Jade configuration,
JADE = @JADE@
JADEEXTRA = @XML_DCL@
JADECMD = \
	$(JADE) $(foreach dir,$(SGMLDIRS),-D$(dir)) \
	-t $(1) -d ../../../doc/qm-$(1).dsl \
	$(JADEEXTRA)

# The directory containing the Docbook DTD.
SGMLDIRS      += @DOCBOOK_DTD@
# Modular DSSSL stylesheet configuration.  The system identifiers are
# specified as relative paths, so the base of the stylesheet
# installation needs to be provided.
SGMLDIRS      += @DOCBOOK_STYLESHEETS@ 

# The HTML user manuals.
HTML_MANUALS	= $(foreach tool,$(QM_TOOLS),qm/$(tool)/doc/html/index.html)

# The TeX user manuals.
TEX_MANUALS     = $(foreach tool,$(QM_TOOLS),qm/$(tool)/doc/print/manual.tex)

# The PDF user manuals.
PDF_MANUALS     = $(foreach tool,$(QM_TOOLS),qm/$(tool)/doc/print/manual.pdf)

# Tidy configuration.
TIDY 		= @TIDY@
TIDYFLAGS	= -wrap 72 -i --indent-spaces 1

# HappyDoc configuration.
HAPPYDOC	= @HAPPYDOC@

# The install program.
INSTALL		= @top_srcdir@/install-sh -c
INSTALL_DATA    = $(INSTALL) -m 644
INSTALL_DIR     = $(INSTALL) -d -m 755
INSTALL_PROGRAM = $(INSTALL)
INSTALL_SCRIPT  = $(INSTALL_PROGRAM)

# Places to install things.
prefix		= @prefix@
exec_prefix	= @exec_prefix@
INSTALLBINDIR	= @bindir@
INSTALLLIBDIR	= @libdir@/qm
INSTALLSHAREDIR	= @datadir@/qm
INSTALLDOCDIR   = @datadir@/doc/qm
INSTALLINCDIR   = @includedir@

ifneq ($(PYTHON_PLATFORM),win32)
NATPREFIX       := $(prefix)
else
NATPREFIX       := $(shell cygpath -a -w $(prefix))
endif

ifeq ($(PYTHON_PLATFORM),win32)
SCRIPT_EXT = .bat
else
SCRIPT_EXT =
endif

########################################################################
# Main Rules
########################################################################

all: \
	$(PYTHON_PACKAGES) \
	$(SCRIPTS) \
	$(DTD_CATALOG) \
	qm/setup_path.py \
	doc

# Regenerate files that are generated by configure.

%: %.in
	./config.status

########################################################################
# Build Rules
########################################################################

# Build the Python packages.
.PHONY: $(PYTHON_PACKAGES)

$(PYTHON_PACKAGES):
	cd $@ && $(PYTHON) ./setup.py -q build

# Generate executable scripts.
ifneq ($(PYTHON_PLATFORM),win32)
$(SCRIPTS): qm/qm.sh
	rm -rf $@
	cp qm/qm.sh $@
	chmod a-w $@
	chmod a+x $@
else
PYTHONEXE = `@PYTHON@ -c "import sys; print sys.prefix"`\\python
$(SCRIPTS): 
	rm -rf $@
	echo -e "@echo off\r" > $@
	echo -e "set QM_HOME=C:\\progra~1\qm\r" >> $@
	echo -e "set QM_BUILD=0\r" >> $@
	echo -n "$(PYTHONEXE)" \
                 \"%QM_HOME%\\lib\\qm\\$(subst /,\\,$(basename $@)).py\" \
          >> $@
	echo -e " %1 %2 %3 %4 %5 %6 %7 %8 %9\r" >> $@
endif

$(DTD_CATALOG): $(DTDS)
	rm -f $@
	echo "-- This file is automatically generated.  Do not edit. --" \
	  >> $@
	for x in $^; do \
	  name=`expr "\`grep NAME $$x\`" : '<!-- NAME: \(.*\) -->'`; \
	    echo 'PUBLIC "-//Software Carpentry//'$$name'//EN" \
	      "'`basename $$x`'"' \
	      >> $@; \
	done

$(COPIED_TOOL_DTDS): $(TOOL_DTDS)
	cp $(filter %$(notdir $@), $^) $@

clean::
	for x in $(PYTHON_PACKAGES); do \
	  (cd $$x && $(PYTHON) ./setup.py clean); \
	done
ifeq ($(DOCUMENTATION),yes)
	for tool in $(QM_TOOLS); do \
	  rm -rf qm/$$tool/doc/html qm/$$tool/doc/print; \
	done
endif
	rm -f $(SCRIPTS)

distclean: clean
	rm -f GNUmakefile config.cache config.status config.log
	rm -f qm/setup_path.py 
	rm -f qm.spec

# Run tests.
check: all
	qm/test/qmtest -D tests run $(QMTESTFLAGS)

########################################################################
# Documentation Rules
########################################################################

.PHONY: doc

ifeq ($(DOCUMENTATION), yes)
doc: doc-html doc-print
else
# If we are not building documentation, there is nothing to do.
doc:
endif

doc-html: $(HTML_MANUALS)

$(HTML_MANUALS): \
	%/html/index.html : \
	%/manual.xml %/introduction.xml %/tour.xml %/reference.xml
	mkdir -p $(dir $@)
	(cd $(dir $<) && \
	  $(call JADECMD,sgml) $(notdir $<)) || \
	  (rm -rf $(dir $@) && false)
ifneq ($(TIDY),no)
	for f in $(dir $@)*.html; \
	do \
	  HTML_TIDY=/dev/null \
		$(TIDY) $(TIDYFLAGS) -f /dev/null -asxml -modify $${f}; \
	  true; \
	done 
endif

.PHONY: doc-print

doc-print: $(PDF_MANUALS)

# Jade places the output TeX source file in the current directory, so
# move it where we want it afterwards.
#
# We have to change -- into -{-} so that TeX does not generate long 
# dashes.  This is a bug in Jade.

$(TEX_MANUALS): \
	%/print/manual.tex : \
	%/manual.xml %/introduction.xml %/tour.xml %/reference.xml
	mkdir -p $(dir $@)
	(cd $(dir $<) && \
	  $(call JADECMD,tex) $(notdir $<)) || \
          (rm -rf $(dir $@) && false)
	sed -e 's|--|-{-}|g' < \
          $(dir $<)$(notdir $@) > $@
	rm $(dir $<)$(notdir $@)

# Process the TeX file to PDF, in the print directory.  
%.pdf: %.tex 
	cd `dirname $@`; \
	  pdfjadetex $(notdir $<); \
	  pdfjadetex $(notdir $<); \
	  pdfjadetex $(notdir $<)

.PHONY: doc-python

doc-python: $(PYTHONDOCDIRS)
	for dir in $(PYTHONDOCDIRS); do \
	    $(HAPPYDOC) -d $(DOCDIR) -F htmltable -T docset $${dir}; \
done

########################################################################
# Installation Rules
########################################################################

# Install everything.
.PHONY: install

install: \
	$(PYTHON_PACKAGES_INSTALL) \
	doc-install \
	scripts-install \
	share-install \
	lib-install

# Install Python packages that use distutils.
.PHONY: $(PYTHON_PACKAGES_INSTALL)

# Distutils requires relative paths on Windows.  For consistency,
# we use the same technique everywhere.
RELLIBDIR := $(shell expr "$(INSTALLLIBDIR)" : '$(prefix)/\(.*\)')
RELSHAREDIR := $(shell expr "$(INSTALLSHAREDIR)" : '$(prefix)/\(.*\)')
RELINCDIR := $(shell expr "$(INSTALLINCDIR)" : '$(prefix)/\(.*\)')

# Unfortunately, Python's Distutils do not set permissons on on the
# installed files appropriately.  There is little we can do about this.
#
# The "root" option is undocumented, but apparently necessary, when
# using relative paths for --install-purelib and such.
$(PYTHON_PACKAGES_INSTALL):
	cd $(@:-install=) && \
		$(PYTHON) ./setup.py install -O1 \
	        --prefix="$(NATPREFIX)" --root="$(NATPREFIX)" \
		--install-purelib="$(RELLIBDIR)" \
                --install-platlib="$(RELLIBDIR)" \
                --install-scripts="$(RELSHAREDIR)" \
		--install-data="$(RELSHAREDIR)" \
                --install-headers="$(RELINCDIR)"

# Install documentation.
.PHONY: doc-install

doc-install:
	$(INSTALL_DIR) "$(INSTALLDOCDIR)"
	$(INSTALL_DATA) README "$(INSTALLDOCDIR)"
	$(INSTALL_DATA) COPYING "$(INSTALLDOCDIR)"
	for tool in $(QM_TOOLS); do \
		$(INSTALL_DIR) "$(INSTALLDOCDIR)/$$tool/html"; \
		for x in qm/$$tool/doc/html/*.html; do \
			$(INSTALL_DATA) $$x "$(INSTALLDOCDIR)/$$tool/html"; \
		done \
	done
	for tool in $(QM_TOOLS); do \
		$(INSTALL_DIR) "$(INSTALLDOCDIR)/$$tool/pdf"; \
		$(INSTALL_DATA) qm/$$tool/doc/print/manual.pdf \
		"$(INSTALLDOCDIR)/$$tool/pdf"; \
	done

# Install scripts.
.PHONY: scripts-install

scripts-install:
	$(INSTALL_DIR) "$(INSTALLBINDIR)"
	for script in $(SCRIPTS); do \
	  $(INSTALL_SCRIPT) $$script "$(INSTALLBINDIR)"; \
	done

# Install the lib directory.

.PHONY: lib-install

# Create the extension class directories.
lib-install:
	for tool in $(QM_TOOLS); do \
	  if test -e qm/$$tool/classes/classes.qmc; then \
	    $(INSTALL_DIR) "$(INSTALLLIBDIR)/qm/$$tool/classes"; \
	    $(INSTALL_DATA) qm/$$tool/classes/classes.qmc \
	      "$(INSTALLLIBDIR)/qm/$$tool/classes/classes.qmc"; \
	  fi; \
	done

# Install the share directory.
.PHONY: share-install

share-install: dtml-install messages-install
	for x in `find share \( -name '*.txt' -o -name '*.dtml' \
		  -o -name '*.css' -o -name '*.js' \
		  -o -name '*.gif' -o -name 'CATALOG' \
		  -o -name '*.dtd' -o -name '*.mod' \)`; do \
		y=`expr "$$x" : 'share/\(.*\)'`; \
		$(INSTALL_DIR) "$(INSTALLSHAREDIR)/`dirname $$y`"; \
		$(INSTALL_DATA) "$$x" "$(INSTALLSHAREDIR)/$$y"; \
	done

# Install DTML for each tool.
.PHONY: dtml-install

dtml-install:
	for tool in $(QM_TOOLS); do \
	  $(INSTALL_DIR) "$(INSTALLSHAREDIR)/dtml"; \
	  $(INSTALL_DIR) "$(INSTALLSHAREDIR)/dtml/$$tool"; \
	  for x in qm/$$tool/share/dtml/*.dtml; do \
	    $(INSTALL_DATA) "$$x" \
	      "$(INSTALLSHAREDIR)/dtml/$$tool/`basename $$x`"; \
	  done; \
	done

# Install messages for each tool.
.PHONY: messages-install

messages-install:
	for tool in $(QM_TOOLS); do \
	  $(INSTALL_DIR) "$(INSTALLSHAREDIR)/messages"; \
	  $(INSTALL_DIR) "$(INSTALLSHAREDIR)/messages/$$tool"; \
	  for x in qm/$$tool/share/messages/*.txt; do \
	    $(INSTALL_DATA) "$$x" \
	      "$(INSTALLSHAREDIR)/messages/$$tool/`basename $$x`"; \
	  done; \
	done

# Install the QMTest tutorial.
ifneq (,$(findstring test,$(QM_TOOLS)))
share-install: test-tutorial-install

.PHONY: test-tutorial-install

test-tutorial-install:
	$(INSTALL_DIR) "$(INSTALLSHAREDIR)/tutorial"
	$(INSTALL_DIR) "$(INSTALLSHAREDIR)/tutorial/test"
	$(INSTALL_DIR) "$(INSTALLSHAREDIR)/tutorial/test/tdb"
	for x in qm/test/share/tutorial/tdb/*.qmt; do \
	  $(INSTALL_DATA) "$$x" \
	    "$(INSTALLSHAREDIR)/tutorial/test/tdb/`basename $$x`"; \
	done
	$(INSTALL_DIR) "$(INSTALLSHAREDIR)/tutorial/test/tdb/QMTest"
	$(INSTALL_DATA) "qm/test/share/tutorial/tdb/QMTest/configuration" \
	  "$(INSTALLSHAREDIR)/tutorial/test/tdb/QMTest/configuration"
endif