summaryrefslogtreecommitdiff
path: root/xc/config/cf/os2Lib.rules
blob: a4c1949f8221359dc32739b07327eac736fb7db5 (plain)
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
XCOMM $XConsortium: os2Lib.rules /main/1 1996/10/31 14:47:29 kaleb $



XCOMM $XFree86: xc/config/cf/os2Lib.rules,v 3.10 1999/04/29 09:13:20 dawes Exp $

/*
 * OS2/EMX shared library rules (DLL version)
 */
#ifndef __EMX__
#error You must edit os2Lib.rules for your (non-EMX) OS/2 dev system
#endif

#ifndef HasSharedLibraries
#define HasSharedLibraries YES
#endif
#ifndef ForceNormalLib
#define ForceNormalLib NO
#endif

#define SharedOldX NO

#ifndef SharedDataSeparation
#define SharedDataSeparation NO
#endif
#ifndef SharedCodeDef
#define SharedCodeDef /**/
#endif
#ifndef SharedLibraryDef
#define SharedLibraryDef /**/
#endif
#ifndef ShLibIncludeFile
#define ShLibIncludeFile <os2Lib.tmpl>
#endif
#ifndef SharedLibraryLoadFlags
#define SharedLibraryLoadFlags /**/
#endif
#ifndef PositionIndependentCFlags
#define PositionIndependentCFlags -Zdll -Zomf -Zmtd
#endif

#ifndef NormalSharedLibObjCompile
#define NormalSharedLibObjCompile(options) $(RM) $@                        @@\
	$(CC) -c $(CFLAGS) options $(SHLIBDEF) $(SHAREDCODEDEF) $(PICFLAGS) $*.c @@\
	touch $*.o
#endif

#ifndef InstallSharedLibrary
#ifdef BuildImplibs
#define InstallSharedLibrary(libname,rev,dest)				@@\
install:: libname.dll libname.a	libname.lib				@@\
	MakeDir($(DESTDIR)dest)						@@\
	$(INSTALL) -c $(INSTLIBFLAGS) libname.dll $(DESTDIR)dest 	@@\
	$(INSTALL) -c $(INSTLIBFLAGS) libname.a $(DESTDIR)dest 		@@\
	$(INSTALL) -c $(INSTLIBFLAGS) libname.lib $(DESTDIR)dest
#else
#define InstallSharedLibrary(libname,rev,dest)				@@\
install:: libname.dll libname.a						@@\
	MakeDir($(DESTDIR)dest)						@@\
	$(INSTALL) -c $(INSTLIBFLAGS) libname.a $(DESTDIR)dest		@@\
	$(INSTALL) -c $(INSTLIBFLAGS) libname.dll $(DESTDIR)dest
#endif
#endif /* InstallSharedLibrary */

/*#ifdef UseInstalled
#define LinkBuildLibrary(lib) $(_NULLCMD_)
#else*/
#define LinkBuildLibrary(lib) MakeDir($(BUILDLIBDIR))			@@\
	RemoveFile($(BUILDLIBDIR)/lib)					@@\
	ImakeIndir $(BUILDLIBDIR) $(LN) $(BUILDINCTOP)/$(CURRENT_DIR)/lib .
/*#endif*/

        EMXIMP = emximp
        EMXOMF = emxomf
          SHLD = gcc -Zomf -Zdll -Zmtd
     SHADDLIBS = -lbsd -lsocket -lc_import
#ifndef BuildDllSupportLibs
/*#ifdef UseInstalled
#define BuildDllSupportLibs(slib) $(_NULLCMD_)
#else*/
#define BuildDllSupportLibs(slib)					@@\
	$(EMXIMP) -o slib.imp slib.def					@@\
	$(EMXIMP) -o slib.a slib.imp					@@\
	$(EMXOMF) -s -l slib.a 						@@\
	LinkBuildLibrary(slib.a)					@@\
	LinkBuildLibrary(slib.lib)
/*#endif*/
#endif

#ifndef BuildDllSupportLibs2
/*#ifdef UseInstalled
#define BuildDllSupportLibs2(slib) $(_NULLCMD_)
#else*/
#define BuildDllSupportLibs2(slib)					@@\
	$(EMXIMP) -o slib.imp Concat3(slib,os2,.def)			@@\
	$(EMXIMP) -o slib.a slib.imp					@@\
	$(EMXOMF) -s -l slib.a 						@@\
	LinkBuildLibrary(slib.a)					@@\
	LinkBuildLibrary(slib.lib)
/*#endif*/
#endif

#ifndef BuildLibSupportLibs
/*#ifdef UseInstalled
#define BuildLibSupportLibs(slib) $(_NULLCMD_)
#else*/
#define BuildLibSupportLibs(slib)					@@\
	$(EMXOMF) -s -l slib.a 						@@\
	LinkBuildLibrary(slib.a)					@@\
	LinkBuildLibrary(slib.lib)
/*#endif*/
#endif

#ifndef SharedLibraryTarget
#define SharedLibraryTarget(libname,rev,solist,down,up)			@@\
AllTarget(libname.dll)							@@\
.SUFFIXES: .obj .rsp .def						@@\
        LBRPATH = $(subst /,\,$(LIBRARY_PATH))				@@\
        LBRDEF = Concat3(libname,os2,.def)				@@\
	LBRCPPDEF = Concat3(libname,os2,-def.cpp)			@@\
	LBRRSP = Concat3(libname,os2,.rsp)				@@\
									@@\
link.rsp: $(LBRRSP) $(LBRDEF)						@@\
	@echo $(LBRPATH)\\dll0.obj+ >link.rsp				@@\
	@cat $(LBRRSP) >>link.rsp					@@\
	@echo $(LBRPATH)\\mt\\ $(LBRPATH)\\ $(REQUIREDLIBS) bsd socket c_alias c_static c_import os2 emx2 end >>link.rsp	@@\
	@echo $(LBRDEF) >>link.rsp					@@\
									@@\
libname.dll:  $(OBJS) link.rsp						@@\
	link386 @link.rsp >nul						@@\
	BuildDllSupportLibs2(libname)					@@\
	LinkBuildLibrary(libname.dll)					@@\
									@@\
clean::									@@\
	$(RM) libname.lib libname.imp *.obj link.rsp
#endif /* SharedLibraryTarget */

#ifndef NormalLibraryTarget
#define	NormalLibraryTarget(libname,objlist)				@@\
AllTarget(LibraryTargetName(libname))					@@\
									@@\
LibraryTargetName(libname): objlist					@@\
	RemoveFile($@)							@@\
	MakeLibrary($@,objlist)						@@\
	RanLibrary($@)							@@\
	BuildLibSupportLibs($*)
#endif /* NormalLibraryTarget */

#ifndef NormalDepLibraryTarget
#define	NormalDepLibraryTarget(libname,deplist,objlist)			@@\
AllTarget(Concat(libname,_baselibtarget) LibraryTargetName(libname))	@@\
									@@\
Concat(libname,_baselibtarget):: deplist				@@\
	rm -rf baseobjs/?*						@@\
	ImakeHelper 11 baseobjs						@@\
	$(CP) objlist baseobjs						@@\
									@@\
LibraryTargetName(libname): 						@@\
	RemoveFile($@)							@@\
	MakeLibrary($@,baseobjs/?*.o)					@@\
	RanLibrary($@)							@@\
	BuildLibSupportLibs($*)
#endif /* NormalDepLibraryTarget */

/*
 * 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 */

#ifndef SharedLibraryDataTarget
#define SharedLibraryDataTarget(libname,rev,salist)
#endif /* SharedLibraryDataTarget */

#ifndef InstallSharedLibraryData
#define InstallSharedLibraryData(libname,rev,dest)
#endif /* InstallSharedLibraryData */

#ifndef InstallLibrary
#define	InstallLibrary(libname,dest)					@@\
install:: LibraryTargetName(libname)					@@\
	MakeDir($(DESTDIR)dest)						@@\
	$(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) LibraryTargetName(libname) $(DESTDIR)dest @@\
	$(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) Concat(libname,.lib) $(DESTDIR)dest @@\
	RanLibrary($(RANLIBINSTFLAGS) $(DESTDIR)dest/LibraryTargetName(libname))
#endif /* InstallLibrary */

#ifndef LibMkdir
#define LibMkdir(dir) ImakeHelper 11 dir
#endif

#ifndef LibCleanDir
#define LibCleanDir(dir) 						@@\
	ImakeIndir dir call RemoveFiles(*.Osuf)
#endif

#define MakeStaticLibrary(libname) $(AR) libname *.o

#ifndef UnsharedLibraryTarget
#define	UnsharedLibraryTarget(libname,objlist,down,up)			@@\
AllTarget(LibraryTargetName(Concat(libname,_s)))			@@\
									@@\
LibraryTargetName(Concat(libname,_s)): objlist				@@\
	RemoveFile($@)							@@\
	ImakeIndir down MakeStaticLibrary(up/$@)			@@\
	RanLibrary($@)							@@\
	_LinkBuildLibrary($@)						@@\
									@@\
install::	LibraryTargetName(Concat(libname,_s))			@@\
	$(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) LibraryTargetName(Concat(libname,_s)) $(DESTDIR)$(SHLIBDIR)
#endif

#ifndef UnsharedLibraryTarget3
#define	UnsharedLibraryTarget3(libname,objlist1,objlist2,objlist3,down,up) @@\
AllTarget(LibraryTargetName(Concat(libname,_s)))			@@\
									@@\
LibraryTargetName(Concat(libname,_s)): objlist1 objlist2 objlist3	@@\
	RemoveFile($@)							@@\
	ImakeIndir down MakeStaticLibrary(up/$@)			@@\
	RanLibrary($@)							@@\
	_LinkBuildLibrary($@)						@@\
									@@\
install::	LibraryTargetName(Concat(libname,_s))			@@\
	$(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) LibraryTargetName(Concat(libname,_s)) $(DESTDIR)$(SHLIBDIR)
#endif /* UnsharedLibraryTarget3 */

/*
 * DebuggedLibraryTarget - generate rules to create a debuggable library.
 */
#ifndef DebuggedLibraryTarget
#define	DebuggedLibraryTarget(libname,objlist)				@@\
AllTarget(LibraryTargetNameSuffix(libname,_d))				@@\
									@@\
LibraryTargetNameSuffix(libname,_d): objlist $(EXTRALIBRARYDEPS)	@@\
	RemoveFile($@)							@@\
	ImakeIndir debugger MakeStaticLibrary(../$@)			@@\
	RanLibrary($@)							@@\
	_LinkBuildLibrary($@)

#endif /* DebuggedLibraryTarget */

/*
 * DebuggedDepLibraryTarget - generate rules to create a debuggable library.
 */
#ifndef DebuggedDepLibraryTarget

#define	DebuggedDepLibraryTarget2(libname,deplist,objlist)		@@\
AllTarget(Concat(libname,_dbglibtarget) LibraryTargetNameSuffix(libname,_d))		@@\
									@@\
Concat(libname,_dbglibtarget):: deplist							@@\
	rm -rf debugged/?*						@@\
	ImakeHelper 11 debugged						@@\
	$(CP) objlist debugged						@@\
									@@\
LibraryTargetNameSuffix(libname,_d): $(EXTRALIBRARYDEPS)		@@\
	RemoveFile($@)							@@\
	ImakeIndir debugger MakeStaticLibrary(../$@)			@@\
	RanLibrary($@)							@@\
	_LinkBuildLibrary($@)

#endif /* DebuggedDepLibraryTarget */

/*
 * ProfiledLibraryTarget - generate rules to create a profiled library.
 */
#ifndef ProfiledLibraryTarget
#define	ProfiledLibraryTarget(libname,objlist)				@@\
AllTarget(LibraryTargetNameSuffix(libname,_p))				@@\
									@@\
LibraryTargetNameSuffix(libname,_p): objlist $(EXTRALIBRARYDEPS)	@@\
	RemoveFile($@)							@@\
	ImakeIndir profiled MakeStaticLibrary(../$@)			@@\
	RanLibrary($@)							@@\
	_LinkBuildLibrary($@)

#endif /* ProfiledLibraryTarget */

/*
 * ProfiledDepLibraryTarget - generate rules to create a profiled library.
 */
#ifndef ProfiledDepLibraryTarget
#define	ProfiledDepLibraryTarget(libname,deplist,objlist)		@@\
AllTarget(Concat(libname,_prflibtarget) LibraryTargetNameSuffix(libname,_p))		@@\
									@@\
Concat(libname,_prflibtarget):: deplist							@@\
	rm -rf profiled/?*						@@\
	ImakeHelper 11 profiled						@@\
	$(CP) objlist profiled						@@\
									@@\
LibraryTargetNameSuffix(libname,_p): $(EXTRALIBRARYDEPS)		@@\
	RemoveFile($@)							@@\
	ImakeIndir profiled MakeStaticLibrary(../$@)			@@\
	RanLibrary($@)							@@\
	_LinkBuildLibrary($@)

#endif /* ProfiledDepLibraryTarget */

/*
 * DepLibraryModuleTarget
 */
#ifndef DepLibraryModuleTarget
#define DepLibraryModuleTarget(module,deplist,objects)			@@\
NormalDepLibraryTarget(module, deplist, objects)
#endif