1XCOMM $Xorg: sequentLib.rules,v 1.3 2000/08/17 19:41:48 cpqbld Exp $
2
3/*
4 * SVR4 shared library rules
5 */
6
7#ifndef HasSharedLibraries
8# define HasSharedLibraries YES
9#endif
10#ifndef SharedDataSeparation
11# define SharedDataSeparation NO
12#endif
13#ifndef SharedCodeDef
14# define SharedCodeDef /**/
15#endif
16#ifndef SharedLibraryDef
17# define SharedLibraryDef /**/
18#endif
19#ifndef ShLibIncludeFile
20# define ShLibIncludeFile <sequentLib.tmpl>
21#endif
22#ifndef SharedLibraryLoadFlags
23/* Sequent may need to implement the X11R5 HasMultipleSockets ? */
24# if HasMultipleSockets
25#  define SharedLibraryLoadFlags -G -z text $(DEFAULTSOCKETLDOPTIONS)
26#  define ExtraLoadOptions $(DEFAULTSOCKETLDOPTIONS)
27# else
28/* #  define SharedLibraryLoadFlags -G -z text */
29#  define SharedLibraryLoadFlags -G
30#  define ExtraLoadOptions
31# endif
32#endif
33#ifndef PositionIndependentCFlags
34# if HasGcc2
35#  define PositionIndependentCFlags -fpic
36# else
37#  define PositionIndependentCFlags -K PIC
38# endif
39#endif
40#ifndef PositionIndependentCplusplusFlags
41# if HasGcc2ForCplusplus
42#  define PositionIndependentCplusplusFlags -fpic
43# else
44#  define PositionIndependentCplusplusFlags -K PIC
45# endif
46#endif
47#ifndef UseExportLists
48# define UseExportLists NO
49#endif
50#ifndef UseHidesymsLists
51# define UseHidesymsLists NO
52#endif
53
54#if UseHidesymsLists
55
56#ifndef BuildHidesyms
57#define BuildHidesyms(libname)						@@\
58includes::								@@\
59	MakeDir($(BUILDLIBDIR)/hidesyms) 				@@\
60	@( if [ -f Concat(lib,libname.hs) ]; \				@@\
61	then \								@@\
62	(set -x; cd $(BUILDLIBDIR)/hidesyms && \			@@\
63	RemoveFile(Concat(lib,libname.hs)) && \				@@\
64	$(LN) $(BUILDLIBTOP)/../$(CURRENT_DIR)/Concat(lib,libname.hs) .); \	@@\
65	fi; )
66#endif /* BuildHidesyms */
67
68/*
69 * InstallHidesyms - install library hidesyms directive file. (Sequent only)
70 * Logic cloned from InstallNonExecFile.
71 * We do not list the hidesyms directive file as a dependency since it
72 * may not exist.
73 */
74#ifndef InstallHidesyms
75#define InstallHidesyms(libname)					@@\
76install::								@@\
77	MakeDir($(DESTDIR)/usr/lib/hidesyms) 				@@\
78	@( if [ -f Concat(lib,libname.hs) ]; then \			@@\
79	$(INSTALL) $(INSTALLFLAGS) $(INSTDATFLAGS) Concat(lib,libname.hs) $(DESTDIR)/usr/lib/hidesyms; fi; )
80#endif /* InstallHidesyms */
81
82/*
83 * InstallLibrary - generate rules to install the indicated library.
84 *
85 * Sequent includes an extra "install::" target to install hidesyms files
86 * and an extra "includes::" target to export library hidesyms files.
87 * Therefore whenever InstallLibrary is expanded the hidesyms targets
88 * will also be expanded.  This avoids changes to generic cf *.tmpl files.
89 */
90#ifndef InstallLibrary
91#define	InstallLibrary(libname,dest)					@@\
92install:: LibraryTargetName(libname)					@@\
93	MakeDir($(DESTDIR)dest)						@@\
94	$(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) LibraryTargetName(libname) $(DESTDIR)dest @@\
95	RanLibrary($(RANLIBINSTFLAGS) $(DESTDIR)dest/LibraryTargetName(libname))	@@\
96									@@\
97InstallHidesyms(libname)						@@\
98									@@\
99BuildHidesyms(libname)
100#endif /* InstallLibrary */
101
102/*
103 * Sequent additions to MakeLibrary for filtering objects
104 * with hidesyms before making a normal archive library.
105 */
106
107#ifndef MakeLibrary
108#define MakeLibrary(libname,objlist) ( $(RM) -r tmp_hs ; \		@@\
109	LIBNAME_HS=`dirname libname`/`basename libname .a`.hs ; \	@@\
110	(if [ -f $$LIBNAME_HS ]; \					@@\
111	then \								@@\
112	    LIBNAME_AR=../libname; \					@@\
113	    $(MKDIRHIER) tmp_hs && \					@@\
114	    $(CP) *.o tmp_hs && \					@@\
115	    cd tmp_hs && \						@@\
116	    $(HSCMD) -i ../$$LIBNAME_HS *.o ; \				@@\
117	else \								@@\
118	     LIBNAME_AR=libname; \					@@\
119	fi; \								@@\
120	$(AR) $$LIBNAME_AR objlist ) ;\					@@\
121	$(RM) -r tmp_hs )
122#endif
123
124#endif /* UseHidesymsLists */
125
126/*
127 * InstallSharedLibrary - generate rules to install the shared library.
128 */
129#ifndef InstallSharedLibrary
130# define InstallSharedLibrary(libname,rev,dest)				@@\
131install:: Concat(lib,libname.so.rev) 					@@\
132	MakeDir($(DESTDIR)dest)						@@\
133	$(INSTALL) $(INSTALLFLAGS) $(INSTSHLIBFLAGS) Concat(lib,libname.so.rev) $(DESTDIR)dest @@\
134	$(RM) Concat($(DESTDIR)dest/lib,libname.so)			@@\
135	$(LN) Concat(lib,libname.so.rev) Concat($(DESTDIR)dest/lib,libname.so)
136#endif /* InstallSharedLibrary */
137
138/*
139 * InstallSharedLibraryData - generate rules to install the shared library data
140 */
141#ifndef InstallSharedLibraryData
142# define InstallSharedLibraryData(libname,rev,dest)
143#endif /* InstallSharedLibraryData */
144
145#ifndef LinkWithExports
146# if UseHidesymsLists
147#  define LinkWithExports(libname,rev,solist,down,up) \
148	$(RM) -r tmp_hs							@@\
149	( if [ -f Concat(lib,libname.hs) ]; \				@@\
150	then \								@@\
151	    LIBNAME_SO=../$@~; \					@@\
152	    mkdir tmp_hs; \						@@\
153	    cd down; \							@@\
154	    $(CP) *.o up/tmp_hs && \					@@\
155	    cd up/tmp_hs && \						@@\
156	    $(HSCMD) -i ../Concat(lib,libname.hs) *.o; \		@@\
157	else \								@@\
158	    LIBNAME_SO=up/$@~; \					@@\
159	    cd down; \							@@\
160	fi; \								@@\
161	$(CCENVSETUP) $(LD) -o $$LIBNAME_SO $(SHLIBLDFLAGS) -h $@ solist $(REQUIREDLIBS) )	@@\
162	$(RM) -r tmp_hs
163# else
164# if UseExportLists
165#  define LinkWithExports(libname,rev,solist,down,up) \
166	(cd down; $(CCENVSETUP) $(LD) -o up/$@~ $(SHLIBLDFLAGS) -h $@ solist $(REQUIREDLIBS))	@@\
167	if [ -f Concat(lib,libname.elist) ]; then \			@@\
168	    $(RM) down/$@.exports $@.list; \				@@\
169	    $(CPP) $(ALLINCLUDES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(THREADS_DEFINES) $(DEFINES) Concat(lib,libname.elist) | CppSedMagic >$@.list; \	@@\
170	    $(EXPORTLISTGEN) $@~ $@.list > down/$@.exports; \		@@\
171	    (cd down; $(CCENVSETUP) $(LD) -o up/$@~ $(SHLIBLDFLAGS) -h $@ ShlibExportListOpt($@.exports) solist $(REQUIREDLIBS)); \	@@\
172	    $(RM) down/$@.exports $@.list; \				@@\
173	fi;
174# else
175#  define LinkWithExports(libname,rev,solist,down,up) \
176	(cd down; $(CCENVSETUP) $(LD) -o up/$@~ $(SHLIBLDFLAGS) -h $@ solist $(REQUIREDLIBS))
177# endif /* UseExportLists */
178# endif /* UseHidesymsLists */
179#endif
180
181/*
182 * SharedLibraryTarget - generate rules to create a shared library;
183 * build it into a different name so that we do not hose people by having
184 * the library gone for long periods.
185 */
186#ifndef SharedLibraryTarget
187# define SharedLibraryTarget(libname,rev,solist,down,up)		@@\
188AllTarget(Concat(lib,libname.so.rev))					@@\
189									@@\
190Concat(lib,libname.so.rev):  solist $(EXTRALIBRARYDEPS)			@@\
191	$(RM) $@~							@@\
192	LinkWithExports(libname,rev,solist,down,up)			@@\
193	$(RM) $@ 							@@\
194	$(MV) $@~ $@							@@\
195	$(RM) Concat(lib,libname.so)					@@\
196	$(LN) $@ Concat(lib,libname.so)					@@\
197	LinkBuildLibrary($@)						@@\
198	LinkBuildLibrary(Concat(lib,libname.so))			@@\
199									@@\
200clean::									@@\
201	$(RM) Concat(lib,libname.so.rev) Concat(lib,libname.so)
202
203#endif /* SharedLibraryTarget */
204
205/*
206 * SharedLibraryDataTarget - generate rules to create shlib data file;
207 */
208#ifndef SharedLibraryDataTarget
209# define SharedLibraryDataTarget(libname,rev,salist)
210#endif /* SharedLibraryTarget */
211
212/*
213 * Sequent does not use the InstallManPageAliases rule.
214 * Sequent customer installation procedure uses makealiases(1M)
215 * after the initial product manpages are installed in system directories.
216 */
217#define InstallManPageAliases(file,destdir,aliases) /* use makealiases(1M) */
218
219/*
220 * Man pages need to be formatted when installed, so override the default
221 * imake rules.
222 */
223#if defined(UseInstalled)
224MANCAT = cat
225#else
226MANCAT = sed -f $(CONFIGSRC)/util/installman.sed
227#endif
228
229#define InstallManPageLong(file,destdir,dest)				@@\
230all:: file.$(MANSUFFIX).z						@@\
231									@@\
232file.$(MANSUFFIX).z:: file.man						@@\
233	@if [ -f file.man ]; \						@@\
234	then \								@@\
235	$(MANCAT) file.man | $(NEQN) | \				@@\
236	$(TBL) | $(NROFF) $(MANMACROS) | $(COL) > file.$(MANSUFFIX); \	@@\
237	$(RM) file.$(MANSUFFIX).z; \					@@\
238	$(PACK) -f file.$(MANSUFFIX); \					@@\
239	fi 								@@\
240									@@\
241file.man::								@@\
242									@@\
243install.man::								@@\
244	MakeDir($(DESTDIR)destdir)					@@\
245	@if [ -f file.$(MANSUFFIX).z ]; \				@@\
246	then \								@@\
247	$(INSTALL) -c $(INSTMANFLAGS) file.$(MANSUFFIX).z $(DESTDIR)destdir/dest.$(MANSUFFIX).z; \@@\
248	fi
249
250#define InstallMultipleManSuffix(list,dest,suff)			@@\
251install.man::								@@\
252	MakeDir($(DESTDIR)dest)						@@\
253	MakeFlagsToShellFlags(i,set +e); \				@@\
254	@for i in list; do \						@@\
255	  (set -x; \							@@\
256	$(MANCAT) $$i.suff | $(NEQN) | \				@@\
257	$(TBL) | $(NROFF) $(MANMACROS) | $(COL) >/tmp/$$i.suff; \	@@\
258	  $(PACK) -f /tmp/$$i.suff; \					@@\
259	  $(INSTALL) -c $(INSTMANFLAGS) /tmp/$$i.suff.z $(DESTDIR)dest/$$i.$(MANSUFFIX).z; \	@@\
260	  $(RM) /tmp/$$i.suff.z); \					@@\
261	done
262
263#define InstallMultipleMan(list,dest)					@@\
264	InstallMultipleManSuffix(list,dest,man)
265
266/*
267 * InstallMotifManPage relies on the fact that all the
268 * Imakefiles where it is used (or Makefile default value)
269 * will correctly define MANSUFFIX which may be
270 * either "section" or "section"x.
271 * Since we rely on MANSUFFIX being defined correctly in each Makefile
272 * we can also rely on MANDIR = $(MANSOURCEPATH)section
273 *
274 * CAUTION:
275 * The source file "file.section" may have the same name as
276 * the target file "file.$(MANSUFFIX)" so we must use temporary files
277 * so that we do not overwrite "file.section".
278 */
279#define InstallMotifManPage(file,section)				@@\
280all:: file.$(MANSUFFIX).z						@@\
281									@@\
282file.$(MANSUFFIX).z: file.section					@@\
283	@$(MANCAT) file.section | $(NEQN) | \				@@\
284	$(TBL) | $(NROFF) $(MANMACROS) | $(COL) > /tmp/file.man; \	@@\
285	$(RM) /tmp/file.man.z; \					@@\
286	$(PACK) -f /tmp/file.man; \					@@\
287	$(CP) /tmp/file.man.z file.$(MANSUFFIX).z; \			@@\
288	$(RM) /tmp/file.man.z						@@\
289									@@\
290install.man:: file.$(MANSUFFIX).z					@@\
291	MakeDir($(DESTDIR)$(MANDIR))					@@\
292	$(INSTALL) -c $(INSTMANFLAGS) file.$(MANSUFFIX).z $(DESTDIR)$(MANDIR)/file.$(MANSUFFIX).z
293
294/*
295 * The Real_MessageCatalogRule defined in Motif.rules does not
296 * install the generated catalog file.  This rule adds an install
297 * clause to do that.
298 */
299#define Real_MessageCatalogRule(prefix)					@@\
300prefix.cat Concat(prefix,MsgCatI.h):					@@\
301	$(RM) Concat(prefix,MsgCatI.h) prefix.cat $(MLOCSRC)/C/msg/prefix.msg	@@\
302	$(MKCATTOOL) Concat(prefix,MsgCatI.h) prefix.msg > $(MLOCSRC)/C/msg/prefix.msg	@@\
303	$(GENCAT) prefix.cat $(MLOCSRC)/C/msg/prefix.msg		@@\
304									@@\
305includes:: prefix.cat Concat(prefix,MsgCatI.h)				@@\
306									@@\
307depend:: prefix.cat Concat(prefix,MsgCatI.h)				@@\
308									@@\
309all:: prefix.cat							@@\
310									@@\
311install:: prefix.cat							@@\
312	MakeDir($(DESTDIR)$(MESSAGECATDIR))				@@\
313	$(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) prefix.cat $(DESTDIR)$(MESSAGECATDIR)/prefix.cat	@@\
314	$(RM) $(DESTDIR)$(MESSAGECATDIR)/prefix				@@\
315	$(LN) prefix.cat $(DESTDIR)$(MESSAGECATDIR)/prefix		@@\
316	MakeDir($(DESTDIR)$(NLSDIR))					@@\
317	$(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) prefix.cat $(DESTDIR)$(NLSDIR)/prefix.cat	@@\
318	$(RM) $(DESTDIR)$(NLSDIR)/prefix				@@\
319	$(LN) prefix.cat $(DESTDIR)$(NLSDIR)/prefix			@@\
320									@@\
321clean::									@@\
322	$(RM) prefix.cat Concat(prefix,MsgCatI.h)
323
324