1XCOMM $Xorg: sv3Lib.rules,v 1.3 2000/08/17 19:41:48 cpqbld Exp $
2
3
4
5XCOMM $XFree86: xc/config/cf/sv3Lib.rules,v 3.5 2002/11/22 22:55:56 tsi Exp $
6/*
7 * SVR3 shared library rules
8 * Copyright (c) 1992, 1993 by Thomas Wolfram, Berlin, Germany
9 * Author: Thomas Wolfram, thomas@aeon.in-berlin.de, wolf@prz.tu-berlin.de
10 * Conception derived partially from work of Thomas Roell
11 */
12
13#ifndef HasSharedLibraries
14#define HasSharedLibraries NO		/* JUST FOR NOW */
15#endif
16#ifndef ForceNormalLib
17#define ForceNormalLib YES
18#endif
19
20#ifndef SharedLibSM
21#define SharedLibSM HasSharedLibraries
22#endif
23#ifndef SharedLibXau
24#define SharedLibXau HasSharedLibraries
25#endif
26#ifndef SharedLibXdmcp
27#define SharedLibXdmcp HasSharedLibraries
28#endif
29#ifndef SharedLibXi
30#define SharedLibXi HasSharedLibraries
31#endif
32#ifndef SharedLibXtst
33#define SharedLibXtst HasSharedLibraries
34#endif
35#ifndef SharedLibICE
36#define SharedLibICE HasSharedLibraries
37#endif
38#ifndef SharedLibFS
39#define SharedLibFS HasSharedLibraries
40#endif
41#ifndef SharedLibX11
42#define SharedLibX11 HasSharedLibraries
43#endif
44#ifndef SharedOldX
45#define SharedOldX NO		/* it's obsolete */
46#endif
47#ifndef SharedLibXt
48#define SharedLibXt HasSharedLibraries
49#endif
50#ifndef SharedLibXaw
51#define SharedLibXaw HasSharedLibraries
52#endif
53#ifndef SharedLibXmu
54#define SharedLibXmu HasSharedLibraries
55#endif
56#ifndef SharedLibXext
57#define SharedLibXext HasSharedLibraries
58#endif
59
60#ifndef SharedDataSeparation
61#define SharedDataSeparation NO
62#endif
63#ifndef SharedCodeDef
64#define SharedCodeDef /**/
65#endif
66#ifndef SharedLibraryDef
67#define SharedLibraryDef -DSVR3SHLIB
68#endif
69#ifndef ShLibIncludeFile
70#define ShLibIncludeFile <sv3Lib.tmpl>
71#endif
72#ifndef SharedLibraryLoadFlags
73#define SharedLibraryLoadFlags -q
74#endif
75
76#ifndef PositionIndependentCFlags
77# if HasGcc2
78#  define PositionIndependentCFlags -msvr3-shlib
79# else
80#  define PositionIndependentCFlags /**/
81# endif
82#endif
83
84#ifndef PositionIndependentCplusplusFlags
85# if HasGcc2
86#  define PositionIndependentCplusplusFlags -msvr3-shlib
87# else
88#  define PositionIndependentCplusplusFlags /**/
89# endif
90#endif
91
92#ifndef StripInstalledPrograms
93# define StripInstalledPrograms NO
94#endif
95
96#if 0
97/*
98 * LibCleanDir - helper for cleaning library object subdirectories
99 */
100#ifndef LibCleanDir
101#define LibCleanDir(dir) -@if [ -d dir ]; then \                           @@\
102                (set -x; cd dir; $(RM) *.o *.sd); else exit 0; fi
103#endif
104
105/*
106 * SharedLibObjCompile - compile fragment for shared objects
107 */
108#ifndef SharedLibObjCompile
109#define SharedLibObjCompile(options) $(RM) shared/$@ 	                   @@\
110	cat import.h $*.c >_$*.c                                           @@\
111        $(CC) -c $(ANSICCOPTIONS) $(CCOPTIONS) $(ALLDEFINES) options \     @@\
112$(SHLIBDEF) $(SHAREDCODEDEF) $(PICFLAGS) $(CDEBUGFLAGS) $(CLIBDEBUGFLAGS) \@@\
113_$*.c                                                                      @@\
114	$(MV) _$*.o shared/$@                                              @@\
115	$(RM) _$*.c
116#endif
117
118/*
119 * NormalSharedLibObjCompile - compile fragment for shared object when
120 * a normal library is not being built
121 */
122#ifndef NormalSharedLibObjCompile
123#define NormalSharedLibObjCompile(options) $(RM) $@                        @@\
124	cat import.h $*.c >_$*.c                                           @@\
125        $(CC) -c $(CFLAGS) options $(SHLIBDEF) $(SHAREDCODEDEF) $(PICFLAGS) _$*.c @@\
126	$(MV) _$*.o $@                                                     @@\
127	$(RM) _$*.c
128#endif
129
130
131#ifndef LibraryObjectRule
132#define LibraryObjectRule()                                             @@\
133all::                                                                   @@\
134        _DebuggedLibMkdir()                                             @@\
135        _ProfiledLibMkdir()                                             @@\
136        _SharedLibMkdir()                                               @@\
137                                                                        @@\
138includes::                                                              @@\
139        _DebuggedLibMkdir()                                             @@\
140        _ProfiledLibMkdir()                                             @@\
141        _SharedLibMkdir()                                               @@\
142                                                                        @@\
143.c.o:                                                                   @@\
144        _DebuggedObjCompile($(_NOOP_))                                  @@\
145        _ProfiledObjCompile($(_NOOP_))                                  @@\
146        _SharedObjCompile($(_NOOP_))                                    @@\
147        _NormalObjCompile($(_NOOP_))                                    @@\
148                                                                        @@\
149.SUFFIXES: .sd                                                          @@\
150.c.sd:                                                                  @@\
151        _SharedDatCompile(-DSVR3SHDAT)                                  @@\
152                                                                        @@\
153clean::                                                                 @@\
154        _DebuggedCleanDir()                                             @@\
155        _ProfiledCleanDir()                                             @@\
156        _SharedCleanDir()                                               @@\
157
158#endif /* LibraryObjectRule */
159
160
161/*
162 * InstallSharedLibrary - generate rules to install the shared library.
163 */
164#ifndef InstallSharedLibrary
165#if StripInstalledPrograms
166#define	InstallSharedLibrary(libname,rev,dest)				@@\
167install:: Concat(lib,libname.rev) 					@@\
168	MakeDir($(DESTDIR)dest)						@@\
169	$(INSTALL) -c $(INSTLIBFLAGS) Concat3(lib,libname,_s.a) $(DESTDIR)dest @@\
170	MakeDir($(DESTDIR)$(LIBDIR)/shlib)                              @@\
171        $(INSTALL) -c $(INSTPGMFLAGS) Concat(lib,libname.rev) \         @@\
172	$(DESTDIR)$(LIBDIR)/shlib                                       @@\
173	strip Concat($(DESTDIR)$(LIBDIR)/shlib/lib,libname.rev)         @@\
174	mcs -d Concat($(DESTDIR)$(LIBDIR)/shlib/lib,libname.rev)
175#else
176#define	InstallSharedLibrary(libname,rev,dest)				@@\
177install:: Concat(lib,libname.rev) 					@@\
178	MakeDir($(DESTDIR)dest)						@@\
179	$(INSTALL) -c $(INSTLIBFLAGS) Concat3(lib,libname,_s.a) $(DESTDIR)dest @@\
180	MakeDir($(DESTDIR)$(LIBDIR)/shlib)                              @@\
181        $(INSTALL) -c $(INSTPGMFLAGS) Concat(lib,libname.rev) \         @@\
182	$(DESTDIR)$(LIBDIR)/shlib
183#endif
184
185#endif /* InstallSharedLibrary */
186
187/*
188 * InstallSharedLibraryData - generate rules to install the shared library data
189 */
190#ifndef InstallSharedLibraryData
191#define	InstallSharedLibraryData(libname,rev,dest)
192#endif /* InstallSharedLibraryData */
193
194
195/*
196 * SharedLibraryTarget - generate rules to create a shared library;
197 * build it into a different name so that we do not hose people by having
198 * the library gone for long periods.
199 */
200#ifndef SharedLibraryTarget
201#define SharedLibraryTarget(libname,rev,solist,down,up)			@@\
202AllTarget(Concat(lib,libname.rev))					@@\
203									@@\
204Concat(lib,libname.rev):  solist					@@\
205	$(RM) $@ Concat3(lib,libname,_s.a)				@@\
206        $(CPP) -DDOWN=down ConnectionFlags ShlibDefines Concat(lib,libname.def) | \ @@\
207        sed -e '/^#  *[0-9][0-9]*  *.*$$/d; /^$$/d' >spec.cpp           @@\
208        sed -e '1,/#libraries/d; /#externals/,$$d' spec.cpp | \         @@\
209        nawk '{ system("ar x " $$1 " " $$2 )}'                          @@\
210        echo "#target " Concat($(LIBDIR)/shlib/lib,libname.rev) >spec   @@\
211        sed -e '/#libraries/,$$d' spec.cpp >>spec                             @@\
212        mkshlib -s spec -t $@ -h Concat3(lib,libname,_s.a) $(SHLIBLDFLAGS)    @@\
213        ar rulv Concat3(lib,libname,_s.a) `sed -e '1,/#externals/d' spec.cpp` @@\
214        $(RM) spec.cpp spec                                             @@\
215									@@\
216clean::									@@\
217	$(RM) Concat(lib,libname.rev) Concat3(lib,libname,_s.a)
218
219#endif /* SharedLibraryTarget */
220
221/*
222 * SharedDepLibraryTarget - generate rules to create a shared library.
223 */
224#ifndef SharedDepLibraryTarget
225#define SharedDepLibraryTarget(libname,rev,deplist,solist,down,up)	@@\
226AllTarget(Concat(lib,libname.rev))					@@\
227									@@\
228Concat(lib,libname.rev):  deplist					@@\
229	$(RM) $@ Concat3(lib,libname,_s.a)				@@\
230        $(CPP) -DDOWN=down ConnectionFlags ShlibDefines Concat(lib,libname.def) | \ @@\
231        sed -e '/^#  *[0-9][0-9]*  *.*$$/d; /^$$/d' >spec.cpp           @@\
232        sed -e '1,/#libraries/d; /#externals/,$$d' spec.cpp | \         @@\
233        nawk '{ system("ar x " $$1 " " $$2 )}'                          @@\
234        echo "#target " Concat($(LIBDIR)/shlib/lib,libname.rev) >spec   @@\
235        sed -e '/#libraries/,$$d' spec.cpp >>spec                             @@\
236        mkshlib -s spec -t $@ -h Concat3(lib,libname,_s.a) $(SHLIBLDFLAGS)    @@\
237        ar rulv Concat3(lib,libname,_s.a) `sed -e '1,/#externals/d' spec.cpp` @@\
238        $(RM) spec.cpp spec                                             @@\
239									@@\
240clean::									@@\
241	$(RM) Concat(lib,libname.rev) Concat3(lib,libname,_s.a)
242
243#endif /* SharedDepLibraryTarget */
244
245/*
246 * SharedLibraryDataTarget - generate rules to create shlib data file;
247 */
248#ifndef SharedLibraryDataTarget
249#define SharedLibraryDataTarget(libname,rev,salist)
250#endif /* SharedLibraryTarget */
251
252#endif
253