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
|
%************************************************************************
%* *
\section[mkworld-TEMPLATE]{Main ``mkworld'' template; slurps in ...}
%* *
%************************************************************************
\begin{pseudocode}
#define JMAKE_TEMPLATE "TEMPLATE.jm"
#define INCLUDE_JMAKEFILE <Jmakefile>
#define SetupLabel std
#define SetupIsStd 1
#define ProjectLabel none
#define ProjectIsNone 1
#define SITE_SETUP_FILE <site-none-std.jm>
#define SITE_PROJECT_FILE <site-none.jm>
#define ONLY4_SETUP_FILE <only4-none-std.jm>
#define ONLY4_PROJECT_FILE <only4-none.jm>
#define SUFFIXES_SETUP_FILE <suffixes-none-std.jm>
#define SUFFIXES_PROJECT_FILE <suffixes-none.jm>
#define MACROS_SETUP_FILE <macros-none-std.jm>
#define MACROS_PROJECT_FILE <macros-none.jm>
#define UTILS_SETUP_FILE <utils-none-std.jm>
#define UTILS_PROJECT_FILE <utils-none.jm>
#define INSTALLATION_SETUP_FILE <install-none-std.jm>
#define INSTALLATION_PROJECT_FILE <install-none.jm>
\end{pseudocode}
This is the main template that is ``filled in'' by the @mkworld@
configuration system, to create a Makefile.
This whole scheme is derived from the fine work on a ``multi-project
Imake'' by Paul DuBois at the Wisconsin Regional Primate Research Center.
First some pervasive, needed-everywhere definitions:
\begin{code}
#define YES 1
#define NO 0
#if __STDC__
#define CAT2(a,b) a##b
#define CAT3(a,b,c) a##b##c
#define CAT4(a,b,c,d) a##b##c##d
#define CAT5(a,b,c,d,e) a##b##c##d##e
#else
#define CAT2(a,b) a/**/b
#define CAT3(a,b,c) a/**/b/**/c
#define CAT4(a,b,c,d) a/**/b/**/c/**/d
#define CAT5(a,b,c,d,e) a/**/b/**/c/**/d/**/e
#endif /* not STDC */
\end{code}
%************************************************************************
%* *
\subsection[mkworld-template-platform]{Platform-specific things}
%* *
%************************************************************************
@plat-TRIGGERS.jm@ uses the ``trigger'' symbols to decide what
platform-specific stuff to drag in; then it is so dragged.
Defaults for any platform-ish things can be defined in @plat-GEN.jm@,
with overrides in the individual platform-configuration files.
\begin{code}
#include "plat-TRIGGERS.jm"
/*# Platform-specific stuff was read from: PlatformFile */
#include PlatformIncludeFile
#include <plat-DEF.jm>
\end{code}
%************************************************************************
%* *
\subsection[mkworld-template-site]{Site-specific things}
%* *
%************************************************************************
Site-specific configuration stuff is, by definition, to override
default definitions to satisfy the needs of a particular ((setup of a)
project at a) site.
\begin{code}
#if ProjectIsNone == NO
#if SetupIsStd == NO
#include SITE_SETUP_FILE /* site-specific things for a setup of a project */
#endif
#include SITE_PROJECT_FILE /* site-specific things for a project */
#endif /* Project != none */
#include <site.jm> /* project-independent site-specific things */
#include <site-DEF.jm> /* _defaults_ for site-specific things */
\end{code}
%************************************************************************
%* *
\subsection[mkworld-template-macros]{Main mkworld CPP macros}
%* *
%************************************************************************
These don't generate any Makefile text, just define macros to be used
later. They have to come early, notably before the ONLY4 stuff.
\begin{code}
#if ProjectIsNone == NO
#if SetupIsStd == NO
#include MACROS_SETUP_FILE
#endif
#include MACROS_PROJECT_FILE
#endif /* Project != none */
#include <macros-GEN.jm>
\end{code}
%************************************************************************
%* *
\subsection[mkworld-template-only4]{Extra things ``only for'' a specific project}
%* *
%************************************************************************
\begin{code}
#if ProjectIsNone == NO
#if SetupIsStd == NO
#include ONLY4_SETUP_FILE
#endif
#include ONLY4_PROJECT_FILE
#endif /* Project != none */
\end{code}
\begin{code}
/*# Project identification -- name, version, and stuff */
#ifndef ProjectName
#define ProjectName NO_SPECIFIC_PROJECT
#endif
#ifndef ProjectVersion
#define ProjectVersion NO_SPECIFIC_VERSION
#endif
PROJECTNAME = ProjectName
PROJECTVERSION = ProjectVersion
PROJECTLABEL = ProjectLabel
SETUPLABEL = SetupLabel
#ifdef HaveProjectMkworldDir
PROJ_MKWORLD_DIR = ProjectMkworldDir
#else
PROJ_MKWORLD_DIR =
#endif
HOSTPLATFORM = HostPlatform
/* HOSTPLATFORM: the platform we expect the thing we are building will run on. */
/* BUILDPLATFORM: the platform we are building on NOW (if we can figure it out)
set by the platform-specific files
*/
\end{code}
%************************************************************************
%* *
\subsection[mkworld-template-suffixes]{Suffix rules}
%* *
%************************************************************************
\begin{code}
#if ProjectIsNone == NO
#if SetupIsStd == NO
#include SUFFIXES_SETUP_FILE
#endif
#include SUFFIXES_PROJECT_FILE
#endif /* Project != none */
#include <suffixes-GEN.jm>
\end{code}
%************************************************************************
%* *
\subsection[mkworld-template-utils]{``Utilities''}
%* *
%************************************************************************
\begin{code}
#if ProjectIsNone == NO
#if SetupIsStd == NO
#include UTILS_SETUP_FILE
#endif
#include UTILS_PROJECT_FILE
#endif /* Project != none */
#include <utils-GEN.jm>
\end{code}
%************************************************************************
%* *
\subsection[mkworld-template-installation]{Installation stuff}
%* *
%************************************************************************
\begin{code}
#if ProjectIsNone == NO
#if SetupIsStd == NO
#include INSTALLATION_SETUP_FILE
#endif
#include INSTALLATION_PROJECT_FILE
#endif /* Project != none */
#include <install-GEN.jm>
\end{code}
%************************************************************************
%* *
\subsection[mkworld-template-dir-specific]{Bring in directory-specific stuff (@Jmakefile@)}
%* *
%************************************************************************
\begin{code}
/* something so "all" is the first target... */
all ::
#include INCLUDE_JMAKEFILE
\end{code}
%************************************************************************
%* *
\subsection[mkworld-template-end-Makefile]{Common end-of-Makefile stuff}
%* *
%************************************************************************
\begin{code}
/*# end of stuff from Jmakefile */
/*# --------------------------- */
/*# common end-of-Makefile rules -- (still) DO NOT EDIT !!! */
/*
* These need to be here so that rules in Jmakefile occur first; the blank
* all is to make sure that an empty Jmakefile doesn't default to make clean.
*/
emptyrule::
CleanTarget()
VeryCleanTarget()
#ifndef IHaveSpecialMakefileTarget
MakefileTarget()
#endif
/* tags not in by default: you have to ask: TagsTarget() */
tags::
#ifdef MakefileAdditions
MakefileAdditions()
#endif
#ifdef IHaveSubdirs
/*###########################################################################
# rules for building in SUBDIRS - DO NOT EDIT !!!
*/
#ifndef NoAllTargetForSubdirs
DoAllinSubdirs($(SUBDIRS))
#endif
#ifndef NoDocsTargetForSubdirs
DoDocsinSubdirs($(SUBDIRS))
#else
docs:: /* nothing */
#endif
#ifndef NoRunTestsTargetForSubdirs
RunTestsSubdirs($(SUBDIRS))
#else
runtests::
@echo "runtests in $(CURRENT_DIR) done"
#endif
#ifndef NoInstallTargetForSubdirs
InstallSubdirs($(SUBDIRS))
#else
install::
@echo "install in $(CURRENT_DIR) done"
#endif
#ifndef NoInstallDocsTargetForSubdirs
InstallDocsSubdirs($(SUBDIRS))
#else
install_docs::
@echo "install_docs in $(CURRENT_DIR) done"
#endif
#ifndef NoDependTargetForSubdirs
DependSubdirs($(SUBDIRS))
#else
depend::
@echo "depend in $(CURRENT_DIR) done"
#endif
#ifndef NoTagTargetForSubdirs
TagSubdirs($(SUBDIRS))
#endif
CleanSubdirs($(SUBDIRS))
VeryCleanSubdirs($(SUBDIRS))
MakefileSubdirs($(SUBDIRS))
#else
/*###########################################################################
# empty rules for directories that do not have SUBDIRS - DO NOT EDIT !!!
*/
/* clean and veryclean rules not given here because they're added above... */
docs::
tags::
@echo "tags in $(CURRENT_DIR) done"
runtests::
@echo "runtests in $(CURRENT_DIR) done"
install::
@echo "install in $(CURRENT_DIR) done"
install_docs::
@echo "install_docs in $(CURRENT_DIR) done"
Makefiles::
depend::
@echo "depend in $(CURRENT_DIR) done"
#endif /* if subdirectory rules are needed */
\end{code}
|