summaryrefslogtreecommitdiff
path: root/os2Lib.rules
blob: 6f8e83510efdaec5038c20ab183abb4f1c830cc7 (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
XCOMM $Xorg: os2Lib.rules,v 1.3 2000/08/17 19:41:48 cpqbld Exp $



XCOMM $XFree86: xc/config/cf/os2Lib.rules,v 3.20 2003/11/12 00:10:23 dawes Exp $

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

#define HasSharedLibraries YES
#define ForceNormalLib NO
#define SharedOldX NO
#define SharedDataSeparation NO
#define SharedCodeDef /**/
#define SharedLibraryDef /**/
#define ShLibIncludeFile <os2Lib.tmpl>
#define SharedLibraryLoadFlags /**/
#define PositionIndependentCFlags -Zmtd

#define NormalSharedLibObjCompile(options) RemoveFile($@)                       @@\
	$(CC) -c $(CFLAGS) options $(SHLIBDEF) $(SHAREDCODEDEF) $(PICFLAGS) $*.c

#define InstallSharedLibrary(libname,rev,dest)				@@\
install:: libname.dll LibraryTargetName(libname) libname.lib		@@\
	MakeDir($(DESTDIR)dest)						@@\
	$(INSTALL) -c $(INSTLIBFLAGS) $(DLLNAME) $(DESTDIR)dest 	@@\
	$(INSTALL) -c $(INSTLIBFLAGS) LibraryTargetName(libname) $(DESTDIR)dest 		@@\
	$(INSTALL) -c $(INSTLIBFLAGS) libname.a $(DESTDIR)dest		@@\
	$(INSTALL) -c $(INSTLIBFLAGS) libname.lib $(DESTDIR)dest

#define LinkBuildLibrary2(slib,ext) MakeDir($(BUILDLIBDIR))		@@\
	RemoveFile($(BUILDLIBDIR)/slib.ext)				@@\
	(cd $(BUILDLIBDIR); $(LN) $(BUILDINCTOP)/$(CURRENT_DIR)/slib.ext .)

#define LinkBuildLibrary3(slib,rev,ext) MakeDir($(BUILDLIBDIR))	@@\
	RemoveFile($(BUILDLIBDIR)/Concat3(slib,rev,ext))		@@\
	(cd $(BUILDLIBDIR); $(LN) $(BUILDINCTOP)/$(CURRENT_DIR)/Concat3(slib,rev,ext) .)

#define LinkBuildLibrary4(pre,slib,rev,ext) MakeDir($(BUILDLIBDIR))	@@\
	RemoveFile($(BUILDLIBDIR)/Concat4(pre,slib,rev,ext))		@@\
	(cd $(BUILDLIBDIR); $(LN) $(BUILDINCTOP)/$(CURRENT_DIR)/Concat4(pre,slib,rev,ext) .)

#define LinkBuildLibrary5(slib,rev,ext) MakeDir($(BUILDLIBDIR))		@@\
	RemoveFile($(BUILDLIBDIR)/$(DLLNAME))				@@\
	(cd $(BUILDLIBDIR); $(LN) $(BUILDINCTOP)/$(CURRENT_DIR)/$(INSTDLLNAME) .)

        EMXIMP = emximp
        EMXOMF = emxomf -p 32
          SHLD = gcc -Zdll -Zmtd -Zmap -Zbin-files
        SHXXLD = g++ -Zdll -Zmtd -Zmap -Zbin-files
     SHADDLIBS = ExtraLibraries -lc_import
       DLLNAME = `cat $(TOP)/$(CURRENT_DIR)/dll.name`
   INSTDLLNAME = `cat $(BUILDINCTOP)/$(CURRENT_DIR)/dll.name`

#define BuildDllSupportLibs3(slib,rev)					@@\
	$(EMXIMP) -o Concat3(slib,rev,.imp) Concat3(slib,os2,.def)	@@\
	$(EMXIMP) -o Concat4(lib,slib,rev,.a) Concat3(slib,rev,.imp)	@@\
	$(EMXIMP) -o Concat3(slib,rev,_o.imp) Concat3(slib,o_os2,.def) @@\
	$(EMXIMP) -o Concat3(slib,rev,.a) Concat3(slib,rev,_o.imp)	@@\
	$(EMXOMF) -s -l -o Concat3(slib,rev,.lib) Concat3(slib,rev,.a)	@@\
	LinkBuildLibrary4(lib,slib,rev,.a)				@@\

#define BuildLibSupportLibs(slib)					@@\
	$(EMXOMF) -s -l -o Concat(slib,.lib) Concat(slib,.a) 		@@\
	LinkBuildLibrary3(lib,slib,.a)					@@\

#define BuildLibSupportLibs2(slib)					@@\
	$(EMXOMF) -s -l -o Concat(slib,.lib) Concat3(lib,slib,.a) 		@@\
	LinkBuildLibrary3(lib,slib,.a)					@@\

#define SharedLibraryTarget(libname,rev,solist,down,up)			@@\
AllTarget(Concat3(libname,rev,.dll))					@@\
.SUFFIXES: .def								@@\
									@@\
Concat(libname,os2.def): Concat(libname,-def.cpp)			@@\
	cmd /c $(subst /,\\,$(CONFIGSRC)/util/makedef.cmd) $(CONFIGSRC)/cf/os2def.db libname @@\
	cmd /c $(subst /,\\,$(CONFIGSRC)/util/makedef.cmd) -O1 $(CONFIGSRC)/cf/os2def.db libname @@\
									@@\
Concat3(libname,rev,.dll):  solist Concat(libname,os2.def)		@@\
	RemoveFile($@)							@@\
	$(SHLD) -o $(DLLNAME) solist $(REQUIREDLIBS) $(SHADDLIBS) Concat(libname,o_os2.def)	@@\
	touch $@							@@\
	BuildDllSupportLibs3(libname,rev)				@@\
	LinkBuildLibrary5(libname,rev,.dll)				@@\
									@@\
clean::									@@\
	RemoveFiles(Concat3(libname,rev,.imp) Concat3(libname,rev,_o.imp))	@@\
	RemoveFiles(Concat(libname,os2.def) Concat(libname,o_os2.def))	@@\
	RemoveFile(dll.name)

#define	NormalLibraryTarget(libname,objlist)				@@\
AllTarget(LibraryTargetName(libname))					@@\
									@@\
LibraryTargetName(libname): objlist					@@\
	RemoveFile($@)							@@\
	MakeLibrary($@,objlist)						@@\
	BuildLibSupportLibs2(libname)

#define SharedDepLibraryTarget(libname,rev,deplist,solist,down,up)	@@\
AllTarget(Concat3(libname,rev,.dll))					@@\
									@@\
Concat(libname,os2.def): deplist $(EXTRALIBRARYDEPS) Concat(libname,-def.cpp) @@\
	cmd /c $(subst /,\\,$(CONFIGSRC)/util/makedef.cmd) $(CONFIGSRC)/cf/os2def.db libname @@\
	cmd /c $(subst /,\\,$(CONFIGSRC)/util/makedef.cmd) -O1 $(CONFIGSRC)/cf/os2def.db libname @@\
									@@\
Concat3(libname,rev,.dll):  Concat(libname,os2.def)		@@\
	RemoveFile($@)							@@\
	(cd down; $(SHLD) -o up/$(DLLNAME) solist $(REQUIREDLIBS) $(SHADDLIBS) Concat(libname,o_os2.def)) @@\
	touch $@							@@\
	BuildDllSupportLibs3(libname,rev)				@@\
	LinkBuildLibrary5(libname,rev,.dll)				@@\
									@@\
clean::									@@\
	RemoveFiles(Concat3(libname,rev,.imp) Concat3(libname,rev,_o.imp))	@@\
	RemoveFiles(Concat(libname,os2.def) Concat(libname,o_os2.def))	@@\
	RemoveFile(dll.name)

#define SharedDepCplusplusLibraryTarget(libname,rev,deplist,solist,down,up)	@@\
AllTarget(Concat3(libname,rev,.dll))					@@\
									@@\
Concat(libname,os2.def): deplist $(EXTRALIBRARYDEPS) Concat(libname,-def.cpp) @@\
	cmd /c $(subst /,\\,$(CONFIGSRC)/util/makedef.cmd) $(CONFIGSRC)/cf/os2def.db libname @@\
	cmd /c $(subst /,\\,$(CONFIGSRC)/util/makedef.cmd) -O1 $(CONFIGSRC)/cf/os2def.db libname @@\
									@@\
Concat3(libname,rev,.dll):  Concat(libname,os2.def)		@@\
	RemoveFile($@)							@@\
	(cd down; $(SHXXLD) -o up/$(DLLNAME) solist $(REQUIREDLIBS) $(SHADDLIBS) Concat(libname,o_os2.def)) @@\
	touch $@							@@\
	BuildDllSupportLibs3(libname,rev)				@@\
	LinkBuildLibrary5(libname,rev,.dll)				@@\
									@@\
clean::									@@\
	RemoveFiles(Concat3(libname,rev,.imp) Concat3(libname,rev,_o.imp))	@@\
	RemoveFiles(Concat(libname,os2.def) Concat(libname,o_os2.def))	@@\
	RemoveFile(dll.name)

#define SharedDepModuleTarget(name,deps,solist)				@@\
AllTarget(name)								@@\
									@@\
name: deps								@@\
	$(CC) -o $@ $(SHLIBLDFLAGS) solist $(REQUIREDLIBS) BaseShLibReqs @@\
									@@\
clean::									@@\
	RemoveFile(name)

#define SharedLibraryDataTarget(libname,rev,salist)

#define InstallSharedLibraryData(libname,rev,dest)

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

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

#define	UnsharedLibraryTarget(libname,objlist,down,up)			@@\
AllTarget(LibraryTargetNameSuffix(libname,_s))				@@\
									@@\
LibraryTargetNameSuffix(libname,_s): objlist				@@\
	RemoveFile($@)							@@\
	(cd down; MakeStaticLibrary(up/$@))				@@\
	RanLibrary($@)							@@\
	_LinkBuildLibrary($@)						@@\
									@@\
install::	LibraryTargetNameSuffix(libname,_s)			@@\
	$(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) LibraryTargetNameSuffix(libname,_s) $(DESTDIR)$(SHLIBDIR)

#define	UnsharedLibraryTarget3(libname,objlist1,objlist2,objlist3,down,up) @@\
AllTarget(LibraryTargetNameSuffix(libname,_s))				@@\
									@@\
LibraryTargetNameSuffix(libname,_s): objlist1 objlist2 objlist3		@@\
	RemoveFile($@)							@@\
	(cd down; MakeStaticLibrary(up/$@))				@@\
	RanLibrary($@)							@@\
	_LinkBuildLibrary($@)						@@\
									@@\
install::	LibraryTargetNameSuffix(libname,_s)			@@\
	$(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) LibraryTargetNameSuffix(libname,_s) $(DESTDIR)$(SHLIBDIR)

#define	DebuggedLibraryTarget(libname,objlist)				@@\
AllTarget(LibraryTargetNameSuffix(libname,_d))				@@\
									@@\
LibraryTargetNameSuffix(libname,_d): objlist $(EXTRALIBRARYDEPS)	@@\
	RemoveFile($@)							@@\
	(cd debugger; MakeStaticLibrary(../$@))				@@\
	RanLibrary($@)							@@\
	_LinkBuildLibrary($@)

#define	ProfiledLibraryTarget(libname,objlist)				@@\
AllTarget(LibraryTargetNameSuffix(libname,_p))				@@\
									@@\
LibraryTargetNameSuffix(libname,_p): objlist $(EXTRALIBRARYDEPS)	@@\
	RemoveFile($@)							@@\
	(cd profiled; MakeStaticLibrary(../$@))				@@\
	RanLibrary($@)							@@\
	_LinkBuildLibrary($@)

#define	LibraryModuleTarget(module,objlist)				@@\
AllTarget(LibraryTargetName(module))					@@\
									@@\
LibraryTargetName(module): objlist					@@\
	RemoveFile($@)							@@\
	MakeLibrary($@,objlist)