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



XCOMM $XFree86: xc/config/cf/sv3Lib.rules,v 3.5 2002/11/22 22:55:56 tsi Exp $
/*
 * SVR3 shared library rules
 * Copyright (c) 1992, 1993 by Thomas Wolfram, Berlin, Germany
 * Author: Thomas Wolfram, thomas@aeon.in-berlin.de, wolf@prz.tu-berlin.de
 * Conception derived partially from work of Thomas Roell
 */

#ifndef HasSharedLibraries
#define HasSharedLibraries NO		/* JUST FOR NOW */
#endif
#ifndef ForceNormalLib
#define ForceNormalLib YES
#endif

#ifndef SharedLibSM
#define SharedLibSM HasSharedLibraries
#endif
#ifndef SharedLibXau
#define SharedLibXau HasSharedLibraries
#endif
#ifndef SharedLibXdmcp
#define SharedLibXdmcp HasSharedLibraries
#endif
#ifndef SharedLibXi
#define SharedLibXi HasSharedLibraries
#endif
#ifndef SharedLibXtst
#define SharedLibXtst HasSharedLibraries
#endif
#ifndef SharedLibICE
#define SharedLibICE HasSharedLibraries
#endif
#ifndef SharedLibFS
#define SharedLibFS HasSharedLibraries
#endif
#ifndef SharedLibX11
#define SharedLibX11 HasSharedLibraries
#endif
#ifndef SharedOldX
#define SharedOldX NO		/* it's obsolete */
#endif
#ifndef SharedLibXt
#define SharedLibXt HasSharedLibraries
#endif
#ifndef SharedLibXaw
#define SharedLibXaw HasSharedLibraries
#endif
#ifndef SharedLibXmu
#define SharedLibXmu HasSharedLibraries
#endif
#ifndef SharedLibXext
#define SharedLibXext HasSharedLibraries
#endif

#ifndef SharedDataSeparation
#define SharedDataSeparation NO
#endif
#ifndef SharedCodeDef
#define SharedCodeDef /**/
#endif
#ifndef SharedLibraryDef
#define SharedLibraryDef -DSVR3SHLIB
#endif
#ifndef ShLibIncludeFile
#define ShLibIncludeFile <sv3Lib.tmpl>
#endif
#ifndef SharedLibraryLoadFlags
#define SharedLibraryLoadFlags -q
#endif

#ifndef PositionIndependentCFlags
# if HasGcc2
#  define PositionIndependentCFlags -msvr3-shlib  
# else
#  define PositionIndependentCFlags /**/
# endif
#endif

#ifndef PositionIndependentCplusplusFlags
# if HasGcc2
#  define PositionIndependentCplusplusFlags -msvr3-shlib  
# else
#  define PositionIndependentCplusplusFlags /**/
# endif
#endif

#ifndef StripInstalledPrograms
# define StripInstalledPrograms NO
#endif

#if 0
/*
 * LibCleanDir - helper for cleaning library object subdirectories
 */
#ifndef LibCleanDir
#define LibCleanDir(dir) -@if [ -d dir ]; then \                           @@\
                (set -x; cd dir; $(RM) *.o *.sd); else exit 0; fi
#endif

/*
 * SharedLibObjCompile - compile fragment for shared objects
 */
#ifndef SharedLibObjCompile
#define SharedLibObjCompile(options) $(RM) shared/$@ 	                   @@\
	cat import.h $*.c >_$*.c                                           @@\
        $(CC) -c $(ANSICCOPTIONS) $(CCOPTIONS) $(ALLDEFINES) options \     @@\
$(SHLIBDEF) $(SHAREDCODEDEF) $(PICFLAGS) $(CDEBUGFLAGS) $(CLIBDEBUGFLAGS) \@@\
_$*.c                                                                      @@\
	$(MV) _$*.o shared/$@                                              @@\
	$(RM) _$*.c
#endif

/*
 * NormalSharedLibObjCompile - compile fragment for shared object when
 * a normal library is not being built
 */
#ifndef NormalSharedLibObjCompile
#define NormalSharedLibObjCompile(options) $(RM) $@                        @@\
	cat import.h $*.c >_$*.c                                           @@\
        $(CC) -c $(CFLAGS) options $(SHLIBDEF) $(SHAREDCODEDEF) $(PICFLAGS) _$*.c @@\
	$(MV) _$*.o $@                                                     @@\
	$(RM) _$*.c
#endif


#ifndef LibraryObjectRule
#define LibraryObjectRule()                                             @@\
all::                                                                   @@\
        _DebuggedLibMkdir()                                             @@\
        _ProfiledLibMkdir()                                             @@\
        _SharedLibMkdir()                                               @@\
                                                                        @@\
includes::                                                              @@\
        _DebuggedLibMkdir()                                             @@\
        _ProfiledLibMkdir()                                             @@\
        _SharedLibMkdir()                                               @@\
                                                                        @@\
.c.o:                                                                   @@\
        _DebuggedObjCompile($(_NOOP_))                                  @@\
        _ProfiledObjCompile($(_NOOP_))                                  @@\
        _SharedObjCompile($(_NOOP_))                                    @@\
        _NormalObjCompile($(_NOOP_))                                    @@\
                                                                        @@\
.SUFFIXES: .sd                                                          @@\
.c.sd:                                                                  @@\
        _SharedDatCompile(-DSVR3SHDAT)                                  @@\
                                                                        @@\
clean::                                                                 @@\
        _DebuggedCleanDir()                                             @@\
        _ProfiledCleanDir()                                             @@\
        _SharedCleanDir()                                               @@\

#endif /* LibraryObjectRule */


/*
 * InstallSharedLibrary - generate rules to install the shared library.
 */
#ifndef InstallSharedLibrary
#if StripInstalledPrograms
#define	InstallSharedLibrary(libname,rev,dest)				@@\
install:: Concat(lib,libname.rev) 					@@\
	MakeDir($(DESTDIR)dest)						@@\
	$(INSTALL) -c $(INSTLIBFLAGS) Concat3(lib,libname,_s.a) $(DESTDIR)dest @@\
	MakeDir($(DESTDIR)$(LIBDIR)/shlib)                              @@\
        $(INSTALL) -c $(INSTPGMFLAGS) Concat(lib,libname.rev) \         @@\
	$(DESTDIR)$(LIBDIR)/shlib                                       @@\
	strip Concat($(DESTDIR)$(LIBDIR)/shlib/lib,libname.rev)         @@\
	mcs -d Concat($(DESTDIR)$(LIBDIR)/shlib/lib,libname.rev)
#else
#define	InstallSharedLibrary(libname,rev,dest)				@@\
install:: Concat(lib,libname.rev) 					@@\
	MakeDir($(DESTDIR)dest)						@@\
	$(INSTALL) -c $(INSTLIBFLAGS) Concat3(lib,libname,_s.a) $(DESTDIR)dest @@\
	MakeDir($(DESTDIR)$(LIBDIR)/shlib)                              @@\
        $(INSTALL) -c $(INSTPGMFLAGS) Concat(lib,libname.rev) \         @@\
	$(DESTDIR)$(LIBDIR)/shlib
#endif

#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 we do not hose people by having
 * the library gone for long periods.
 */
#ifndef SharedLibraryTarget
#define SharedLibraryTarget(libname,rev,solist,down,up)			@@\
AllTarget(Concat(lib,libname.rev))					@@\
									@@\
Concat(lib,libname.rev):  solist					@@\
	$(RM) $@ Concat3(lib,libname,_s.a)				@@\
        $(CPP) -DDOWN=down ConnectionFlags ShlibDefines Concat(lib,libname.def) | \ @@\
        sed -e '/^#  *[0-9][0-9]*  *.*$$/d; /^$$/d' >spec.cpp           @@\
        sed -e '1,/#libraries/d; /#externals/,$$d' spec.cpp | \         @@\
        nawk '{ system("ar x " $$1 " " $$2 )}'                          @@\
        echo "#target " Concat($(LIBDIR)/shlib/lib,libname.rev) >spec   @@\
        sed -e '/#libraries/,$$d' spec.cpp >>spec                             @@\
        mkshlib -s spec -t $@ -h Concat3(lib,libname,_s.a) $(SHLIBLDFLAGS)    @@\
        ar rulv Concat3(lib,libname,_s.a) `sed -e '1,/#externals/d' spec.cpp` @@\
        $(RM) spec.cpp spec                                             @@\
									@@\
clean::									@@\
	$(RM) Concat(lib,libname.rev) Concat3(lib,libname,_s.a)

#endif /* SharedLibraryTarget */

/*
 * SharedDepLibraryTarget - generate rules to create a shared library.
 */
#ifndef SharedDepLibraryTarget
#define SharedDepLibraryTarget(libname,rev,deplist,solist,down,up)	@@\
AllTarget(Concat(lib,libname.rev))					@@\
									@@\
Concat(lib,libname.rev):  deplist					@@\
	$(RM) $@ Concat3(lib,libname,_s.a)				@@\
        $(CPP) -DDOWN=down ConnectionFlags ShlibDefines Concat(lib,libname.def) | \ @@\
        sed -e '/^#  *[0-9][0-9]*  *.*$$/d; /^$$/d' >spec.cpp           @@\
        sed -e '1,/#libraries/d; /#externals/,$$d' spec.cpp | \         @@\
        nawk '{ system("ar x " $$1 " " $$2 )}'                          @@\
        echo "#target " Concat($(LIBDIR)/shlib/lib,libname.rev) >spec   @@\
        sed -e '/#libraries/,$$d' spec.cpp >>spec                             @@\
        mkshlib -s spec -t $@ -h Concat3(lib,libname,_s.a) $(SHLIBLDFLAGS)    @@\
        ar rulv Concat3(lib,libname,_s.a) `sed -e '1,/#externals/d' spec.cpp` @@\
        $(RM) spec.cpp spec                                             @@\
									@@\
clean::									@@\
	$(RM) Concat(lib,libname.rev) Concat3(lib,libname,_s.a)

#endif /* SharedDepLibraryTarget */

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

#endif