summaryrefslogtreecommitdiff
path: root/ibmLib.rules
blob: a455279e1a9c5b35c59c737ffb8d4b177d804073 (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
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
XCOMM $Xorg: ibmLib.rules,v 1.3 2000/08/17 19:41:47 cpqbld Exp $
XCOMM $XdotOrg: xc/config/cf/ibmLib.rules,v 1.1.4.3 2003/12/15 16:42:40 kaleb Exp $

/*
 * AIX shared library rules
 */

XCOMM $XFree86: xc/config/cf/ibmLib.rules,v 3.5 2000/02/13 06:15:18 dawes Exp $
#ifndef HasSharedLibraries
# define HasSharedLibraries YES
#endif
#ifndef ForceNormalLib
# define ForceNormalLib NO
#endif
#ifndef SharedDataSeparation
# define SharedDataSeparation NO
#endif
#ifndef SharedCodeDef
# define SharedCodeDef -DSHAREDCODE
#endif
#if OSMajorVersion < 5
# ifndef SharedLibraryDef
#  define SharedLibraryDef -DAIXSHLIB
# endif
#else
# define SharedLibraryDef /**/
#endif
#ifndef ShLibIncludeFile
# define ShLibIncludeFile <ibmLib.tmpl>
#endif
#ifndef PositionIndependentCFlags
# define PositionIndependentCFlags -bM\:SRE
#endif
#ifndef ExtraLoadFlags
# define ExtraLoadFlags -bnodelcsect
#endif
#if !defined(LdPostLib) && !defined(UseInstalled) && OSMajorVersion > 3
# if ThreadedX
#  define LdPostLib -bnoipath -blibpath:$(USRLIBDIRPATH):/usr/lib/threads:/usr/lib:/lib
# else
#  define LdPostLib -bnoipath -blibpath:$(USRLIBDIRPATH):/usr/lib:/lib
# endif
# define SharedLibPostRef $(LDPOSTLIBS)
#endif
#ifndef SharedLibPostRef
# define SharedLibPostRef $(LDPOSTLIBS)
#endif
#if ThreadedX
# define BaseShLibReqs -lc_r -lm
#else
# define BaseShLibReqs -lc -lm
#endif
#ifndef UseExportLists
# define UseExportLists YES
#endif

/*
 * MakeExportList - generate an export list file for linking libraries.
 */
#ifndef MakeExportList
# if UseExportLists
#  define MakeExportList(libname,result) \
	@-RemoveFile(result)						@@\
	case ,$(SHR4OBJLIBS), in *,libname,*) shr4obj=shr4.o;; esac &&\	@@\
		echo "#! $@ ($${shr4obj:-shr.o})" > result		@@\
	if [ -f Concat(lib,libname.elist) ]; then \			@@\
	    $(CPP) $(ALLINCLUDES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(THREADS_DEFINES) $(DEFINES) Concat(lib,libname.elist) | CppSedMagic > $@.list; \	@@\
	    $(EXPORTLISTGEN) $@~ $@.list >> result; \			@@\
	    RemoveFile($@.list); \					@@\
	else \								@@\
	    dump -g $@~ | sed -n -e 's/^[ 	]*[0-9][0-9]*[	 ]*\([^	 .][^	 ]*\)$$/\1/p' >> result; \	@@\
	fi;
# else
#  define MakeExportList(libname,result) \
	@-RemoveFile(result)						@@\
	case ,$(SHR4OBJLIBS), in *,libname,*) shr4obj=shr4.o;; esac &&\	@@\
		echo "#! $@ ($${shr4obj:-shr.o})" > result		@@\
	dump -g $@~ | sed -n -e 's/^[ 	]*[0-9][0-9]*[	 ]*\([^	 .][^	 ]*\)$$/\1/p' >> result;
# endif
#endif /* MakeExportList */


#if !defined(UseInstalled) && !defined(UseInstalledX11) \
    && !defined(UseImports) && !defined(ImportX11)
   /* we want this to be defined only when building X */

# if OSMajorVersion < 5
#  if OSMajorVersion < 4
/*
 * SharedLibReferences - variables for shared libraries
 */

#   ifndef SharedLibReferences
#    define SharedLibReferences(varname,libname,libsource,revname,rev)	@@\
Concat3(DEP,varname,LIB) = /**/						@@\
Concat(varname,LIB) = _Use(Concat(-l,libname),Concat(libsource/lib,libname.a)) @@\
LintLibReferences(varname,libname,libsource)
#   endif

#  else /* OSMajorVersion < 4 */

#   ifndef SharedLibReferences
#    define SharedLibReferences(varname,libname,libsource,revname,rev)	@@\
Concat3(DEP,varname,LIB) = /**/						@@\
Concat(varname,LIB) = _Use(Concat(-l,libname),Concat($(BUILDLIBDIR),/libname.imp) Concat3($(BUILDLIBDIR),/lib,libname.a)) @@\
LintLibReferences(varname,libname,libsource)
#   endif

#  endif
# else /* OSMajorVersion < 5 */

#  ifndef SharedLibReferences
#   define SharedLibReferences(varname,libname,libsource,revname,rev)	@@\
Concat3(DEP,varname,LIB) = /**/						@@\
Concat(varname,LIB) = _Use(Concat(-l,libname), Concat3($(BUILDLIBDIR),/lib,libname.so)) @@\
LintLibReferences(varname,libname,libsource)
#  endif

# endif

# if OSMajorVersion < 5
#  if OSMajorVersion < 4
/*
 * SharedFontLibReferences - shared font libraries
 */

#   ifndef SharedFontLibReferences
#    define SharedFontLibReferences()					@@\
DEPFONTLIB = /**/							@@\
FONTLIB = -L$(FREETYPELIBDIR) _Use(-lXfont,$(FONTLIBSRC)/libXfont.a)	@@\
LintLibReferences(XFONT,Xfont,$(FONTLIBSRC))
#   endif
#  else
#   ifndef SharedFontLibReferences
#    define SharedFontLibReferences()					@@\
DEPFONTLIB = /**/							@@\
FONTLIB = -L$(FREETYPELIBDIR) _Use(-lXfont,$(BUILDLIBDIR)/font.imp) $(BUILDLIBDI)/libXfont.a)) @@\
LintLibReferences(XFONT,Xfont,$(FONTLIBSRC))
#   endif
#  endif
# else /* OSMajorVersion < 5 */
#  ifndef SharedFontLibReferences
#   define SharedFontLibReferences()					@@\
DEPFONTLIB = /**/							@@\
FONTLIB = -L$(FREETYPELIBDIR) _Use(-lXfont,$(BUILDLIBDI)/libXfont.so)) @@\
LintLibReferences(XFONT,Xfont,$(FONTLIBSRC))
#  endif

# endif

/*
 * SharedDSLibReferences - variables for shared libraries
 */
# ifndef SharedDSLibReferences
#  define SharedDSLibReferences(varname,libname,libsource,revname,rev)	@@\
SharedLibReferences(varname,libname,libsource,revname,rev)
# endif

# if OSMajorVersion == 4
/*
 * UnsharedLibReferences - variables for unshared libraries
 */
#  ifndef UnsharedLibReferences
#   define UnsharedLibReferences(varname,libname,libsource)		@@\
Concat3(DEP,varname,LIB) = _UseCat($(USRLIBDIR)/lib,$(BUILDLIBDIR)/lib,libname.a)	@@\
Concat(varname,LIB) = _Use(Concat(-l,libname),Concat($(BUILDLIBDIR)/lib,libname.a))	@@\
LintLibReferences(varname,libname,libsource)
#  endif
# endif

#endif /* !defined(UseInstalled) && !defined(UseInstalledX11) ... */


/*
 * InstallSharedLibrary - generate rules to install the shared library.
 */
#ifndef InstallSharedLibrary
# if OSMajorVersion < 5
#  define InstallSharedLibrary(libname,rev,dest)			@@\
InstallLibrary(libname,dest)
# else /* OSMajorVersion < 5 */
#  define InstallSharedLibrary(libname,rev,dest)			@@\
install:: Concat(lib,libname.so)					@@\
	MakeDir($(DESTDIR)dest)						@@\
	$(INSTALL) $(INSTALLFLAGS) $(INSTBINFLAGS) Concat(lib,libname.so) $(DESTDIR)dest
# endif /* OSMajorVersion < 5 */
#endif /* InstallSharedLibrary */

/*
 * InstallSharedLibraryData - generate rules to install the shared library data
 */
#ifndef InstallSharedLibraryData
# define InstallSharedLibraryData(libname,rev,dest)
#endif /* InstallSharedLibraryData */

/*
 * SharedLibraryTarget - generate rules to create a shared library;
 * build it into a different name so that the we do not hose people by having
 * the library gone for long periods.
 *
 * IBM uses an unusual shared object file name (shr4.o) in some libraries.
 * Duplicate this behavior to preserve compatibility with IBM's libraries.
 */
#if OSMajorVersion < 5
# if OSMajorVersion < 4

#  ifndef SharedLibraryTarget
#   define SharedLibraryTarget(libname,rev,solist,down,up)		@@\
AllTarget(Concat(lib,libname.a))					@@\
									@@\
Concat(lib,libname.a):  solist $(UNSHAREDOBJS) $(EXTRALIBRARYDEPS)	@@\
	$(RM) $@~ shr.o shr4.o						@@\
	(cd down; $(AR) up/$@~ solist)					@@\
	dump -g $@~ | sed -n -e 's/^[ 	]*[0-9][0-9]*[	 ]*\([^	 .][^	 ]*\)$$/\1/p' > $@.syms	@@\
	$(LD) -o shr.o $@~ -H512 -T512 -bM\:SRE -bE\:$@.syms $(REQUIREDLIBS) BaseShLibReqs SharedLibPostRef	@@\
	$(LN) shr.o shr4.o						@@\
	$(RM) $@~							@@\
	case ,$(SHR4OBJLIBS), in *,libname,*) shr4obj=shr4.o;; esac &&\	@@\
		$(AR) $@~ $${shr4obj} shr.o $(UNSHAREDOBJS)		@@\
	$(RM) $@.syms $@ shr.o shr4.o					@@\
	$(MV) $@~ $@							@@\
	LinkBuildLibrary($@)						@@\
									@@\
clean::									@@\
	$(RM) Concat(lib,libname.a)
#  endif /* SharedLibraryTarget */

# else /* OSMajorVersion < 4 */

#  ifndef SharedLibraryTarget
#   define SharedLibraryTarget(libname,rev,solist,down,up)		@@\
AllTarget(Concat(lib,libname.a))					@@\
									@@\
Concat(lib,libname.a):  solist $(UNSHAREDOBJS) $(EXTRALIBRARYDEPS)	@@\
	RemoveFiles($@~ shr.o shr4.o)					@@\
	(cd down; $(AR) up/$@~ solist)					@@\
	MakeExportList(libname,libname.imp)				@@\
	$(LD) -o shr.o $@~ -H512 -T512 -bM\:SRE -bE\:libname.imp -bnoentry $(REQUIREDLIBS) BaseShLibReqs $(LDPOSTLIBS)	@@\
	$(LN) shr.o shr4.o						@@\
	RemoveFile($@~)							@@\
	case ,$(SHR4OBJLIBS), in *,libname,*) shr4obj=shr4.o;; esac &&\	@@\
		$(AR) $@~ $${shr4obj} shr.o $(UNSHAREDOBJS)		@@\
	RemoveFile($@)							@@\
	$(MV) $@~ $@							@@\
	LinkBuildLibrary($@)						@@\
	LinkBuildLibrary(libname.imp)					@@\
									@@\
clean::									@@\
	$(RM) Concat(lib,libname.a)
#  endif /* SharedLibraryTarget */
# endif /* OSMajorVersion < 4 */
#else /* OSMajorVersion < 5 */
# ifndef SharedLibraryTarget
#  define SharedLibraryTarget(libname,rev,solist,down,up)		@@\
AllTarget(Concat(lib,libname.so))					@@\
									@@\
Concat(lib,libname.so): solist $(EXTRALIBRARYDEPS)			@@\
	$(RM) $@~							@@\
	$(AR) $*.a solist						@@\
	dump -g $*.a | sed -n -e 's/^[  ]*[0-9][0-9]*[[:space:]]*\([_[:alpha:]][[:alnum:]]*\)/\1/p' | egrep -v \\\. | sort | uniq > $*.syms	@@\
	$(LD) -bnoipath -bnoentry -bM\:SRE -bE\:$*.syms -o $@~ solist $(REQUIREDLIBS) BaseShLibReqs -lc	@@\
	$(RM) $@ $*.a $*.syms						@@\
	$(MV) $@~ $@							@@\
	LinkBuildLibrary($@)						@@\
									@@\
clean::									@@\
	$(RM) Concat(lib,libname.so.rev) Concat(lib,libname.so)

# endif /* SharedLibraryTarget */
#endif /* OSMajorVersion < 5 */

/*
 * SharedDepLibraryTarget - generate rules to create a shared library.
 */
#if OSMajorVersion < 5
# if OSMajorVersion < 4

#  ifndef SharedDepLibraryTarget
#   define SharedDepLibraryTarget(libname,rev,deplist,solist,down,up)	@@\
AllTarget(Concat(lib,libname.a))					@@\
									@@\
Concat(lib,libname.a):  deplist $(UNSHAREDOBJS) $(EXTRALIBRARYDEPS)	@@\
	$(RM) $@~ shr.o shr4.o						@@\
	(cd down; $(AR) up/$@~ solist)					@@\
	dump -g $@~ | sed -n -e 's/^[   ]*[0-9][0-9]*[   ]*\([^  .][^    ]*\)$$/\1/p' > $@.syms	@@\
	$(LD) -o shr.o $@~ -H512 -T512 -bM\:SRE -bE\:$@.syms $(REQUIREDLIBS) BaseShLibReqs SharedLibPostRef	@@\
	$(LN) shr.o shr4.o						@@\
	$(RM) $@~							@@\
	case ,$(SHR4OBJLIBS), in *,libname,*) shr4obj=shr4.o;; esac &&\	@@\
		$(AR) $@~ $${shr4obj} shr.o $(UNSHAREDOBJS)		@@\
	$(RM) $@.syms $@ shr.o shr4.o					@@\
	$(MV) $@~ $@							@@\
	LinkBuildLibrary($@)						@@\
									@@\
clean::									@@\
	$(RM) Concat(lib,libname.a)
#  endif /* SharedDepLibraryTarget */

# else /* OSMajorVersion < 4 */

#  ifndef SharedDepLibraryTarget
#   define SharedDepLibraryTarget(libname,rev,deplist,solist,down,up)	@@\
AllTarget(Concat(lib,libname.a))					@@\
									@@\
Concat(lib,libname.a):  deplist $(UNSHAREDOBJS) $(EXTRALIBRARYDEPS)	@@\
	RemoveFiles($@~ shr.o shr4.o)					@@\
	(cd down; $(AR) up/$@~ solist)					@@\
	MakeExportList(libname,libname.imp)				@@\
	$(LD) -o shr.o $@~ -H512 -T512 -bM\:SRE -bE\:libname.imp -bnoentry $(REQUIREDLIBS) BaseShLibReqs $(LDPOSTLIBS)	@@\
	$(LN) shr.o shr4.o						@@\
	RemoveFile($@~)							@@\
	case ,$(SHR4OBJLIBS), in *,libname,*) shr4obj=shr4.o;; esac &&\	@@\
		$(AR) $@~ $${shr4obj} shr.o $(UNSHAREDOBJS)		@@\
	RemoveFile($@)							@@\
	$(MV) $@~ $@							@@\
	LinkBuildLibrary($@)						@@\
	LinkBuildLibrary(libname.imp)					@@\
									@@\
clean::									@@\
	$(RM) Concat(lib,libname.a)
#  endif /* SharedDepLibraryTarget */

# endif /* OSMajorVersion < 4 */
#else /* OSMajorVersion < 5 */
# ifndef SharedDepLibraryTarget
#  define SharedDepLibraryTarget(libname,rev,deplist,solist,down,up)	@@\
AllTarget(Concat(lib,libname.so))					@@\
									@@\
Concat(lib,libname.so):  deplist $(EXTRALIBRARYDEPS)			@@\
	$(RM) $@~							@@\
	$(AR) $*.a solist						@@\
	dump -g $*.a | sed -n -e 's/^[  ]*[0-9][0-9]*[[:space:]]*\([_[:alpha:]][[:alnum:]]*\)/\1/p' | egrep -v \\\. | sort | uniq > $*.syms	@@\
	$(LD) -bnoipath -bnoentry -bsymbolic -bM\:SRE -bE\:$*.syms -o $@~ solist $(REQUIREDLIBS) BaseShLibReqs -lc	@@\
	$(RM) $@ $*.a $*.syms						@@\
	$(MV) $@~ $@							@@\
	LinkBuildLibrary($@)						@@\
									@@\
clean::									@@\
	$(RM) Concat(lib,libname.so) Concat(lib,libname.so)

# endif /* SharedDepLibraryTarget */
#endif /* OSMajorVersion < 5 */

/*
 * SharedLibraryDataTarget - generate rules to create shlib data file;
 */
#ifndef SharedLibraryDataTarget
# define SharedLibraryDataTarget(libname,rev,salist)
#endif /* SharedLibraryTarget */