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
|
XCOMM $XFree86: xc/config/cf/cygwin.rules,v 3.5 2001/04/27 12:32:42 alanh Exp $
#define CPPOnlyAsm(basename,options) RemoveFile(basename.i) @@\
$(CPP) AsmDefines $(DEFINES) $(INCLUDES) options basename.S | grep -v '^\#' > basename.i
/*
* Cygwin shared library rules (DLL versions)
*/
#define HasSharedLibraries YES
#define NeedLibInsideFlag YES
#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 SharedLibGL YES
#define SharedLibXpm YES
#define SharedLibFont NO
#define SharedLibXaw6 NO
#define SharedLibgetsurf NO
#define SharedLibDps YES
#define SharedLibDpsTk YES
#define NormalLibGlu 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
#ifndef LinkBuildSonameLibrary
#define LinkBuildSonameLibrary(lib) (RemoveFile($(BUILDLIBDIR)/lib); \
cd $(BUILDLIBDIR); $(LN) $(BUILDINCTOP)/$(CURRENT_DIR)/lib .)
#endif
#endif
#define SharedDepLibraryTarget(libname,rev,deplist,solist,down,up) @@\
SharedLibraryTarget(libname,rev,solist,down,up)
#endif /* SharedDepLibraryTarget */
#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 */
BASE_COUNTER=/tmp/DLL_BASE_COUNTER
#define MakeDLL(libname,solist) @@\
if [ -f $(BASE_COUNTER) ]; then true; \ @@\
else echo 0x67000000 > $(BASE_COUNTER); fi @@\
dllwrap -s --def libname.def --output-lib Concat3(lib,libname,.a) -o Concat3(lib,libname,.dll) solist junk.o $(REQUIREDLIBS) -image-base `cat $(BASE_COUNTER)` @@\
IMAGE_LENGTH=`objdump -x Concat3(lib,libname,.dll) |awk '/SizeOfImage/ {print "0x"$$2}'`; \ @@\
export IMAGE_LENGTH=`expr '(' \`printf %u $$IMAGE_LENGTH\` / 65536 + 1 ')' '*' 65536` ; \ @@\
export IMAGE_BASE=`cat $(BASE_COUNTER)`; \ @@\
printf 0x%x `expr \`printf %u $$IMAGE_BASE\` + $$IMAGE_LENGTH` > $(BASE_COUNTER)
#define SharedLibraryTarget(libname,rev,solist,down,up) @@\
AllTarget(Concat3(lib,libname,.dll)) @@\
@@\
CppFileTarget(libname.def,libname-def.cpp,-DLIBRARY_VERSION=rev,$(ICONFIGFILES)) @@\
@@\
@@\
junk.c: @@\
echo "#include <cygwin/cygwin_dll.h>" >junk.c @@\
echo "DECLARE_CYGWIN_DLL(dll_main);" >>junk.c @@\
echo "int WINAPI dll_main(HINSTANCE a, DWORD reason, void *q)" >>junk.c @@\
echo "{ return 1; }" >>junk.c @@\
Concat3(lib,libname,.dll): solist junk.o 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)) @@\
RemoveFile(junk.o) @@\
RemoveFile(junk.c) @@\
RemoveFile($(BASE_COUNTER))
#define InstallSharedLibrary(libname,rev,dest) @@\
InstallTarget(install,LibraryTargetName(libname),$(INSTLIBFLAGS),$(USRLIBDIR)) @@\
InstallTarget(install,Concat3(lib,libname,.dll),$(INSTLIBFLAGS),$(BINDIR))
#define ProgramTargetName(target)target.exe
/*
* LinkBuildDLL - export a .dll to exports/bin.
*/
#ifdef UseInstalled
#define LinkBuildDLL(lib) $(_NULLCMD_)
#else
#define LinkBuildDLL(lib) MakeDir($(BUILDBINDIR)) @@\
RemoveFile($(BUILDBINDIR)/lib) @@\
cd $(BUILDBINDIR) && $(CP) $(BUILDBINTOP)/$(CURRENT_DIR)/lib .
#endif
/*
* LinkBuildBinary - export an .exe to exports/bin.
*/
#ifndef LinkBuildBinary
#define LinkBuildBinary(program) @@\
all:: program @@\
MakeDir($(BUILDBINDIR)) @@\
RemoveFile($(BUILDBINDIR)/program) @@\
$(CP) $(BUILDBINTOP)/$(CURRENT_DIR)/program $(BUILDBINDIR)
#endif /* LinkBuildBinary */
/* This is to replace an ugly hack in /xc/nls/XLC_LOCALE */
/* the corresponding Imake.rules rule would be:
define LinkFileSpecial(gotodir,tofile,fromfile) @@\
@MakeFlagsToShellFlags(i,set +e); \ @@\
cd dir && (set -x; RemoveFile(tofile); $(LN) fromfile tofile)
*/
/* And this replaces a similarlry ugly hack in InstallDynamicModule */
#ifndef LinkBuildModule
#ifdef UseInstalled
#define LinkBuildModule(module,subdir) $(_NULLCMD_)
#else
#define LinkBuildModule(module,subdir) @@\
MakeDir($(BUILDMODULEDIR)/subdir) @@\
RemoveFile($(BUILDMODULEDIR)/subdir/module) @@\
$(LN) $(BUILDMODULETOP)/$(CURRENT_DIR)/module $(BUILDMODULEDIR)/subdir/module
#endif
#endif /* LinkBuildModule */
#ifndef LinkBuildNamedModule
#define LinkBuildNamedModule(module,name) MakeDir($(BUILDMODULEDIR)) @@\
RemoveFile($(BUILDMODULEDIR)/module) @@\
$(BUILDMODULEDIR) $(BUILDMODULETOP)/$(CURRENT_DIR)/module name
#endif /* LinkBuildNamedModule */
#define NormalProgramTarget(program,objects,deplibs,locallibs,syslibs) @@\
AllTarget(ProgramTargetName(program)) @@\
ProgramTargetName(program): objects deplibs @@\
RemoveTargetProgram($@) @@\
LinkRule($@,$(LDOPTIONS),objects,locallibs $(LDLIBS) syslibs) @@\
@@\
clean:: @@\
RemoveFile(ProgramTargetName(program))
#define ProgramTargetHelper(program,srcs,objs,deplib,locallib,syslib) @@\
ProgramTargetName(program): $(objs) $(deplib) @@\
RemoveTargetProgram($@) @@\
LinkRule($@,$(LDOPTIONS),$(objs),locallib $(LDLIBS) syslib) @@\
@@\
InstallProgram(program,$(BINDIR)) @@\
InstallManPage(program,$(MANDIR))
#define ComplexProgramTarget(program) @@\
AllTarget(ProgramTargetName(program)) @@\
@@\
ProgramTargetHelper(program,SRCS,OBJS,DEPLIBS,$(LOCAL_LIBRARIES),NullParameter) @@\
@@\
DependTarget() @@\
LintTarget() @@\
@@\
clean:: @@\
RemoveFile(ProgramTargetName(program))
#define ComplexProgramTarget_1(program,locallib,syslib) @@\
OBJS = $(OBJS1) $(OBJS2) $(OBJS3) @@\
SRCS = $(SRCS1) $(SRCS2) $(SRCS3) @@\
PROGRAM1 = ProgramTargetName(program) @@\
@@\
AllTarget($(PROGRAM1) $(PROGRAM2) $(PROGRAM3)) @@\
@@\
ProgramTargetHelper(program,SRCS1,OBJS1,DEPLIBS1,locallib,syslib) @@\
@@\
DependTarget() @@\
LintTarget() @@\
@@\
clean:: @@\
for i in $(PROGRAMS); do $(RM) ProgramTargetName($$i); done
#define ComplexProgramTarget_2(program,locallib,syslib) @@\
PROGRAM2 = ProgramTargetName(program) @@\
@@\
ProgramTargetHelper(program,SRCS2,OBJS2,DEPLIBS2,locallib,syslib)
#define ComplexProgramTarget_3(program,locallib,syslib) @@\
PROGRAM3 = ProgramTargetName(program) @@\
@@\
ProgramTargetHelper(program,SRCS3,OBJS3,DEPLIBS3,locallib,syslib)
#define ServerTargetWithFlags(server,subdirs,objects,libs,syslibs,flags) @@\
AllTarget(ProgramTargetName(server)) @@\
ProgramTargetName(server): subdirs objects libs @@\
MoveToBakFile($@) @@\
LinkRule($@,$(LDOPTIONS),objects,libs $(LDLIBS) syslibs) @@\
@@\
Concat(load,server): @@\
MoveToBakFile(ProgramTargetName(server)) @@\
LinkRule(ProgramTargetName(server),$(LDOPTIONS),objects,libs $(LDLIBS) syslibs) @@\
@@\
loadX:: Concat(load,server) @@\
@@\
SentinelProgramTarget(server,subdirs objects libs,objects libs $(LDLIBS) syslibs) @@\
SentinelLinkTarget(Concat(load,server),server,objects libs $(LDLIBS) syslibs) @@\
PurifyProgramTarget(server,subdirs objects libs,objects libs $(LDLIBS) syslibs) @@\
PurifyLinkTarget(Concat(load,server),server,objects libs $(LDLIBS) syslibs) @@\
ProofProgramTarget(server,subdirs objects libs,objects libs $(LDLIBS) syslibs) @@\
ProofLinkTarget(Concat(load,server),server,objects libs $(LDLIBS) syslibs) @@\
@@\
InstallProgramWithFlags(server,$(BINDIR),flags) @@\
@@\
clean:: @@\
RemoveFile(ProgramTargetName(server))
/*
* ProfiledRelocatableTarget - generate rules to produce a profiled relocatable
* object file instead of a library.
*/
#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.
*/
#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 */
|