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
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
|
XCOMM $XFree86: xc/config/cf/cygwin.rules,v 3.18 2001/11/15 23:15:55 alanh Exp $
/*
* Cygwin shared library rules (DLL versions)
*/
#define HasSharedLibraries YES
#define NeedLibInsideFlag NO
#define ForceNormalLib NO
#define SharedLibXaw NO
#define SharedLibXmu NO
#define SharedLibXt NO
#define SharedLibSM YES
#define SharedLibICE YES
#define SharedLibXext YES
#define SharedLibXie YES
#define SharedLibXi YES
#define SharedLibPex YES
#define SharedLibXtst YES
#define SharedOldX YES
#define SharedLibXp YES
#define SharedLibGlx YES
#define SharedLibFont NO
#define SharedLibXaw6 NO
#define SharedLibgetsurf NO
#define SharedLibDps YES
#define SharedLibDpsTk YES
#define SharedLibGlu YES
#ifndef SharedDataSeparation
#define SharedDataSeparation NO
#endif
#ifndef SharedCodeDef
#define SharedCodeDef /**/
#endif
#ifndef SharedLibraryDef
#define SharedLibraryDef /**/
#endif
#ifndef ShLibIncludeFile
#define ShLibIncludeFile <cygwin.tmpl>
#endif
#ifndef SharedLibraryLoadFlags
#define SharedLibraryLoadFlags -dll /**/
#endif
#ifndef PositionIndependentCFlags
#define PositionIndependentCFlags -D_DLL
#endif
#ifndef PositionIndependentCplusplusFlags
#define PositionIndependentCplusplusFlags -D_DLL
#endif
#ifndef UseExportLists
#define UseExportLists YES
#endif
/*
* SharedDepLibraryTarget - generate rules to create a shared library.
*/
#ifndef SharedDepLibraryTarget
# ifdef UseInstalled
# ifndef LinkBuildSonameLibrary
# define LinkBuildSonameLibrary(lib)
# endif
# else /* !UseInstalled */
# ifndef LinkBuildSonameLibrary
# define LinkBuildSonameLibrary(lib) (RemoveFile($(BUILDLIBDIR)/lib); @@\
cd $(BUILDLIBDIR); $(LN) $(BUILDINCTOP)/$(CURRENT_DIR)/lib .)
# endif
# endif /* UseInstalled */
/*
* SharedDepLibraryTarget
*/
#define SharedDepLibraryTarget(libname,rev,deplist,solist,down,up) @@\
AllTarget(Concat3(lib,libname,.dll)) @@\
@@\
CppFileTarget(libname.def,libname-def.cpp,-DLIBRARY_VERSION=rev,$(ICONFIGFILES)) @@\
@@\
@@\
@@\
Concat3(lib,libname,.dll): deplist libname.def @@\
RemoveFile(LibraryTargetName(libname)) @@\
RemoveFile(Concat3(lib,libname,.dll)) @@\
MakeDLL(libname,solist) @@\
LinkBuildLibrary(Concat3(lib,libname,.a)) @@\
LinkBuildDLL(Concat3(lib,libname,.dll)) @@\
@@\
clean:: @@\
RemoveFile(LibraryTargetName(libname)) @@\
RemoveFile(Concat3(lib,libname,.dll)) @@\
#endif /* SharedDepLibraryTarget */
/*
* SharedDepCplusplusLibraryTarget - generate rules to create a shared library.
*/
#ifndef SharedDepCplusplusLibraryTarget
# ifdef UseInstalled
# ifndef LinkBuildSonameLibrary
# define LinkBuildSonameLibrary(lib)
# endif
# else /* !UseInstalled */
# ifndef LinkBuildSonameLibrary
# define LinkBuildSonameLibrary(lib) (RemoveFile($(BUILDLIBDIR)/lib); @@\
cd $(BUILDLIBDIR); $(LN) $(BUILDINCTOP)/$(CURRENT_DIR)/lib .)
# endif
# endif /* UseInstalled */
/*
* SharedDepCplusplusLibraryTarget
*/
#define SharedDepCplusplusLibraryTarget(libname,rev,deplist,solist,down,up) @@\
AllTarget(Concat3(lib,libname,.dll)) @@\
@@\
CppFileTarget(libname.def,libname-def.cpp,-DLIBRARY_VERSION=rev,$(ICONFIGFILES)) @@\
@@\
@@\
@@\
Concat3(lib,libname,.dll): deplist libname.def @@\
RemoveFile(LibraryTargetName(libname)) @@\
RemoveFile(Concat3(lib,libname,.dll)) @@\
MakeCplusplusDLL(libname,solist) @@\
LinkBuildLibrary(Concat3(lib,libname,.a)) @@\
LinkBuildDLL(Concat3(lib,libname,.dll)) @@\
@@\
clean:: @@\
RemoveFile(LibraryTargetName(libname)) @@\
RemoveFile(Concat3(lib,libname,.dll)) @@\
#endif /* SharedDepCplusplusLibraryTarget */
/*
* SharedDepModuleTarget
*/
#ifndef SharedDepModuleTarget
#define SharedDepModuleTarget(name,deps,solist) @@\
AllTarget(name) @@\
@@\
name: deps @@\
$(CC) -o $@ $(SHLIBLDFLAGS) solist $(REQUIREDLIBS) BaseShLibReqs @@\
@@\
clean:: @@\
RemoveFile(name)
#endif /* SharedDepModuleTarget */
/*
* SharedLibraryDataTarget - generate rules to create shared data file
*/
#ifndef SharedLibraryDataTarget
#define SharedLibraryDataTarget(libname,rev,salist)
#endif
/*
* InstallSharedLibraryData - generate rules to install the shared library data
*/
#ifndef InstallSharedLibraryData
#define InstallSharedLibraryData(libname,rev,dest)
#endif /* InstallSharedLibraryData */
/*
* MakeDllProg
*/
#define MakeDLLProg(libname,solist,prog) @@\
prog -shared -Wl,--out-implib=Concat3(lib,libname,.a) -Wl,--enable-auto-import --def libname.def -o Concat3(lib,libname,.dll) solist $(REQUIREDLIBS)
/*
* MakeDll
*/
#define MakeDLL(libname,solist) @@\
MakeDLLProg(libname,solist,$(CC))
/*
* MakeCplusplusDll
*/
#define MakeCplusplusDLL(libname,solist) @@\
MakeDLLProg(libname,solist,$(CXX))
/*
* SharedLibraryTarget
*/
#define SharedLibraryTarget(libname,rev,solist,down,up) @@\
AllTarget(Concat3(lib,libname,.dll)) @@\
@@\
CppFileTarget(libname.def,libname-def.cpp,-DLIBRARY_VERSION=rev,$(ICONFIGFILES)) @@\
@@\
@@\
Concat3(lib,libname,.dll): solist libname.def @@\
RemoveFile(LibraryTargetName(libname)) @@\
RemoveFile(Concat3(lib,libname,.dll)) @@\
MakeDLL(libname,solist) @@\
LinkBuildLibrary(Concat3(lib,libname,.a)) @@\
LinkBuildDLL(Concat3(lib,libname,.dll)) @@\
clean:: @@\
RemoveFile(LibraryTargetName(libname)) @@\
RemoveFile(Concat3(lib,libname,.dll)) @@\
/*
* InstallSharedLibrary
*/
#define InstallSharedLibrary(libname,rev,dest) @@\
InstallTarget(install,LibraryTargetName(libname),$(INSTLIBFLAGS),$(USRLIBDIR)) @@\
InstallTarget(install,Concat3(lib,libname,.dll),$(INSTLIBFLAGS),$(BINDIR))
/*
* ProgramTargetName - This can be simply 'target' or 'target.exe' when
* building on Cygwin proper, as Cygwin automatically appends .exe to compiled
* executables and make, rm, ln, etc. will automatically search for a file
* with .exe appended if the raw file name cannot be found. However,
* building with a cross compiler requires 'target.exe', as the cross
* compiler doesn't know to append .exe, nor do the cross compiler tools
* know to search for files with .exe appended if the raw file name cannot
* be found.
*/
#define ProgramTargetName(target) Concat(target,.exe)
/*
* HostProgramTargetName - Don't add .exe if cross-compiling.
*/
#ifndef HostProgramTargetName
# if CrossCompiling
# define HostProgramTargetName(target) target
# else
# define HostProgramTargetName(target) ProgramTargetName(target)
# endif
#endif
/*
* LinkBuildDLL - Cygwin only rule, similar to LinkBuildModule.
* Unfortunately, we have to create a copy of each DLL in xc/exports/bin;
* linking doesn't work, the executables (e.g. xkbcomp) will report
* that they cannot find DLLs (e.g. libX11.dll).
*/
#ifdef UseInstalled
#define LinkBuildDLL(lib) $(_NULLCMD_)
#else
#define LinkBuildDLL(lib) MakeDir($(BUILDBINDIR)) @@\
RemoveFile($(BUILDBINDIR)/lib) @@\
cd $(BUILDBINDIR) && $(CP) $(BUILDBINTOP)/$(CURRENT_DIR)/lib .
#endif
/*
* LinkBuildBinary - This rule normally creates a link in xc/exports/bin
* to a binary, but we create an actual copy of the binary.
* Creating a link causes the DLLs that the binary depend on, such as
* libX11.dll, not to be found. Copying the binary causes the runtime
* directory to be xc/exports/bin, which is the location of the DLLs, thus,
* the DLLs can now be found by the binary. Phew...
*
* Note that sometimes the binary is not an executable. One example
* is the rgb binary file.
*
* ProgramTargetName is passed to LinkBuildBinary if the binary
* is actually an executable; thus, we do not wrap the binary name
* with ProgramTargetName here.
*/
#ifndef LinkBuildBinary
#define LinkBuildBinary(binary) @@\
all:: binary @@\
MakeDir($(BUILDBINDIR)) @@\
RemoveFile($(BUILDBINDIR)/binary) @@\
$(CP) $(BUILDBINTOP)/$(CURRENT_DIR)/binary $(BUILDBINDIR)
#endif /* LinkBuildBinary */
/*
* ComplexProgramTarget - Imake.rules doesn't wrap the program name
* with ProgramTargetName(), so we need this rule for Cygwin.
*/
#define ComplexProgramTarget(program) @@\
AllTarget(ProgramTargetName(program)) @@\
ProgramTargetHelper(program,SRCS,OBJS,DEPLIBS,$(LOCAL_LIBRARIES),NullParameter) @@\
DependTarget() @@\
LintTarget() @@\
@@\
clean:: @@\
RemoveFile(ProgramTargetName(program))
/*
* ComplexProgramTarget_1 - Imake.rules doesn't wrap the program names
* with ProgramTargetName(), so we need this rule for Cygwin.
*/
#define ComplexProgramTarget_1(program,locallib,syslib) @@\
OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5) \ @@\
$(OBJS6) $(OBJS7) $(OBJS8) $(OBJS9) $(OBJS10) @@\
SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4) $(SRCS5) \ @@\
$(SRCS6) $(SRCS7) $(SRCS8) $(SRCS9) $(SRCS10) @@\
PROGS_EXE = $(foreach prog,$(PROGRAMS),ProgramTargetName($(prog))) @@\
@@\
AllTarget($(PROGS_EXE)) @@\
@@\
ProgramTargetHelper(program,SRCS1,OBJS1,DEPLIBS1,locallib,syslib) @@\
@@\
DependTarget() @@\
LintTarget() @@\
@@\
clean:: @@\
RemoveFiles($(PROGS_EXE))
/*
* ProfiledRelocatableTarget - generate rules to produce a profiled
* relocatable object file instead of a library. Differs from Imake.rules
* by passing '--oformat pe-i386' to ld.
*/
#ifndef ProfiledRelocatableTarget
#define ProfiledRelocatableTarget(objname,objlist) @@\
AllTarget(Concat(objname,_p.Osuf)) @@\
@@\
Concat(objname,_p.Osuf): objlist $(EXTRALIBRARYDEPS) @@\
RemoveFile($@) @@\
$(LD) -X -r --oformat pe-i386 objlist -o $@
#endif /* ProfiledRelocatableTarget */
/*
* DebuggedRelocatableTarget - generate rules to produce a debuggable
* relocatable object file instead of a library. Differs from Imake.rules
* by passing '--oformat pe-i386' to ld.
*/
#ifndef DebuggedRelocatableTarget
#define DebuggedRelocatableTarget(objname,objlist) @@\
AllTarget(Concat(objname,_d.Osuf)) @@\
@@\
Concat(objname,_d.Osuf): objlist $(EXTRALIBRARYDEPS) @@\
RemoveFile($@) @@\
$(LD) -X -r --oformat pe-i386 objlist -o $@
#endif /* DebuggedRelocatableTarget */
/*
* DependDependencyStatement - Imake.rules wraps $(DEPEND) in
* ProgramTargetName(), which causes cross compiling to think that
* $(DEPEND) hasn't been built, as $(DEPEND) is a host tool, and should
* not be wrapped with ProgramTargetName(). Perhaps there should be
* a HostProgramTargetName()...
*/
#ifndef DependDependencyStatement
#if HasMakefileSafeInclude
#define DependDependencyStatement() @@\
DependFileName:: $(DEPEND)
#else
#define DependDependencyStatement() @@\
depend:: $(DEPEND)
#endif
#endif
/*
* DependDependency - Imake.rules wraps $(DEPEND) in ProgramTargetName().
* This doesn't work when cross compiling, see the locally defined
* DependDependencyStatement comment (above) for more information.
*/
#ifndef DependDependency
#ifdef UseInstalled
#define DependDependency() /**/
#else
#define DependDependency() @@\
DependDependencyStatement() @@\
@@\
NoCmpScript($(DEPEND)) @@\
@@\
$(DEPEND): @@\
@echo "checking $@ over in $(DEPENDSRC) first..."; \ @@\
cd $(DEPENDSRC) && $(MAKE); \ @@\
echo "okay, continuing in $(CURRENT_DIR)"
#endif /* UseInstalled */
#endif /* DependDependency */
/*
* ImakeDependency - Imake.rules wraps $(IMAKE) in ProgramTargetName(),
* which doesn't work when cross compiling, as imake is supposed to be a
* host program. See the locally defined DependDependencyStatement
* comment (above) for more information.
*/
#ifndef ImakeDependency
#ifdef UseInstalled
#define ImakeDependency(target) /**/
#else
#define ImakeDependency(target) @@\
target:: $(IMAKE) @@\
@@\
NoCmpScript($(IMAKE) $(IMAKE).Osuf) @@\
@@\
$(IMAKE) $(IMAKE).Osuf: @@\
-@(cd $(IMAKESRC) && if [ -f Makefile ]; then \ @@\
echo "checking $@ in $(IMAKESRC) first..."; $(MAKE) all; else \ @@\
echo "bootstrapping $@ from Makefile.ini in $(IMAKESRC) first..."; \ @@\
$(MAKE) -f Makefile.ini BOOTSTRAPCFLAGS="$(BOOTSTRAPCFLAGS)"; fi; \ @@\
echo "okay, continuing in $(CURRENT_DIR)")
#endif /* UseInstalled */
#endif /* ImakeDependency */
|