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

/*
 * SVR4 shared library rules
 */

#ifndef HasSharedLibraries
# define HasSharedLibraries YES
#endif
#ifndef SharedDataSeparation
# define SharedDataSeparation NO
#endif
#ifndef SharedCodeDef
# define SharedCodeDef /**/
#endif
#ifndef SharedLibraryDef
# define SharedLibraryDef /**/
#endif
#ifndef ShLibIncludeFile
# define ShLibIncludeFile <sequentLib.tmpl>
#endif
#ifndef SharedLibraryLoadFlags
/* Sequent may need to implement the X11R5 HasMultipleSockets ? */
# if HasMultipleSockets
#  define SharedLibraryLoadFlags -G -z text $(DEFAULTSOCKETLDOPTIONS)
#  define ExtraLoadOptions $(DEFAULTSOCKETLDOPTIONS)
# else
/* #  define SharedLibraryLoadFlags -G -z text */
#  define SharedLibraryLoadFlags -G
#  define ExtraLoadOptions
# endif
#endif
#ifndef PositionIndependentCFlags
# if HasGcc2
#  define PositionIndependentCFlags -fpic
# else
#  define PositionIndependentCFlags -K PIC
# endif
#endif
#ifndef PositionIndependentCplusplusFlags
# if HasGcc2ForCplusplus
#  define PositionIndependentCplusplusFlags -fpic
# else
#  define PositionIndependentCplusplusFlags -K PIC
# endif
#endif
#ifndef UseExportLists
# define UseExportLists NO
#endif
#ifndef UseHidesymsLists
# define UseHidesymsLists NO
#endif

#if UseHidesymsLists

#ifndef BuildHidesyms
#define BuildHidesyms(libname)						@@\
includes::								@@\
	MakeDir($(BUILDLIBDIR)/hidesyms) 				@@\
	@( if [ -f Concat(lib,libname.hs) ]; \				@@\
	then \								@@\
	(set -x; cd $(BUILDLIBDIR)/hidesyms && \			@@\
	RemoveFile(Concat(lib,libname.hs)) && \				@@\
	$(LN) $(BUILDLIBTOP)/../$(CURRENT_DIR)/Concat(lib,libname.hs) .); \	@@\
	fi; )
#endif /* BuildHidesyms */

/*
 * InstallHidesyms - install library hidesyms directive file. (Sequent only)
 * Logic cloned from InstallNonExecFile.
 * We do not list the hidesyms directive file as a dependency since it
 * may not exist.
 */
#ifndef InstallHidesyms
#define InstallHidesyms(libname)					@@\
install::								@@\
	MakeDir($(DESTDIR)/usr/lib/hidesyms) 				@@\
	@( if [ -f Concat(lib,libname.hs) ]; then \			@@\
	$(INSTALL) $(INSTALLFLAGS) $(INSTDATFLAGS) Concat(lib,libname.hs) $(DESTDIR)/usr/lib/hidesyms; fi; )
#endif /* InstallHidesyms */

/*
 * InstallLibrary - generate rules to install the indicated library.
 *
 * Sequent includes an extra "install::" target to install hidesyms files
 * and an extra "includes::" target to export library hidesyms files.
 * Therefore whenever InstallLibrary is expanded the hidesyms targets
 * will also be expanded.  This avoids changes to generic cf *.tmpl files.
 */
#ifndef InstallLibrary
#define	InstallLibrary(libname,dest)					@@\
install:: LibraryTargetName(libname)					@@\
	MakeDir($(DESTDIR)dest)						@@\
	$(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) LibraryTargetName(libname) $(DESTDIR)dest @@\
	RanLibrary($(RANLIBINSTFLAGS) $(DESTDIR)dest/LibraryTargetName(libname))	@@\
									@@\
InstallHidesyms(libname)						@@\
									@@\
BuildHidesyms(libname)
#endif /* InstallLibrary */

/*
 * Sequent additions to MakeLibrary for filtering objects
 * with hidesyms before making a normal archive library.
 */

#ifndef MakeLibrary
#define MakeLibrary(libname,objlist) ( $(RM) -r tmp_hs ; \		@@\
	LIBNAME_HS=`dirname libname`/`basename libname .a`.hs ; \	@@\
	(if [ -f $$LIBNAME_HS ]; \					@@\
	then \								@@\
	    LIBNAME_AR=../libname; \					@@\
	    $(MKDIRHIER) tmp_hs && \					@@\
	    $(CP) *.o tmp_hs && \					@@\
	    cd tmp_hs && \						@@\
	    $(HSCMD) -i ../$$LIBNAME_HS *.o ; \				@@\
	else \								@@\
	     LIBNAME_AR=libname; \					@@\
	fi; \								@@\
	$(AR) $$LIBNAME_AR objlist ) ;\					@@\
	$(RM) -r tmp_hs )
#endif

#endif /* UseHidesymsLists */

/*
 * InstallSharedLibrary - generate rules to install the shared library.
 */
#ifndef InstallSharedLibrary
# define InstallSharedLibrary(libname,rev,dest)				@@\
install:: Concat(lib,libname.so.rev) 					@@\
	MakeDir($(DESTDIR)dest)						@@\
	$(INSTALL) $(INSTALLFLAGS) $(INSTSHLIBFLAGS) Concat(lib,libname.so.rev) $(DESTDIR)dest @@\
	$(RM) Concat($(DESTDIR)dest/lib,libname.so)			@@\
	$(LN) Concat(lib,libname.so.rev) Concat($(DESTDIR)dest/lib,libname.so)
#endif /* InstallSharedLibrary */

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

#ifndef LinkWithExports
# if UseHidesymsLists
#  define LinkWithExports(libname,rev,solist,down,up) \
	$(RM) -r tmp_hs							@@\
	( if [ -f Concat(lib,libname.hs) ]; \				@@\
	then \								@@\
	    LIBNAME_SO=../$@~; \					@@\
	    mkdir tmp_hs; \						@@\
	    cd down; \							@@\
	    $(CP) *.o up/tmp_hs && \					@@\
	    cd up/tmp_hs && \						@@\
	    $(HSCMD) -i ../Concat(lib,libname.hs) *.o; \		@@\
	else \								@@\
	    LIBNAME_SO=up/$@~; \					@@\
	    cd down; \							@@\
	fi; \								@@\
	$(CCENVSETUP) $(LD) -o $$LIBNAME_SO $(SHLIBLDFLAGS) -h $@ solist $(REQUIREDLIBS) )	@@\
	$(RM) -r tmp_hs
# else
# if UseExportLists
#  define LinkWithExports(libname,rev,solist,down,up) \
	(cd down; $(CCENVSETUP) $(LD) -o up/$@~ $(SHLIBLDFLAGS) -h $@ solist $(REQUIREDLIBS))	@@\
	if [ -f Concat(lib,libname.elist) ]; then \			@@\
	    $(RM) down/$@.exports $@.list; \				@@\
	    $(CPP) $(ALLINCLUDES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(THREADS_DEFINES) $(DEFINES) Concat(lib,libname.elist) | CppSedMagic >$@.list; \	@@\
	    $(EXPORTLISTGEN) $@~ $@.list > down/$@.exports; \		@@\
	    (cd down; $(CCENVSETUP) $(LD) -o up/$@~ $(SHLIBLDFLAGS) -h $@ ShlibExportListOpt($@.exports) solist $(REQUIREDLIBS)); \	@@\
	    $(RM) down/$@.exports $@.list; \				@@\
	fi;
# else
#  define LinkWithExports(libname,rev,solist,down,up) \
	(cd down; $(CCENVSETUP) $(LD) -o up/$@~ $(SHLIBLDFLAGS) -h $@ solist $(REQUIREDLIBS))
# endif /* UseExportLists */
# endif /* UseHidesymsLists */
#endif

/*
 * 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.so.rev))					@@\
									@@\
Concat(lib,libname.so.rev):  solist $(EXTRALIBRARYDEPS)			@@\
	$(RM) $@~							@@\
	LinkWithExports(libname,rev,solist,down,up)			@@\
	$(RM) $@ 							@@\
	$(MV) $@~ $@							@@\
	$(RM) Concat(lib,libname.so)					@@\
	$(LN) $@ Concat(lib,libname.so)					@@\
	LinkBuildLibrary($@)						@@\
	LinkBuildLibrary(Concat(lib,libname.so))			@@\
									@@\
clean::									@@\
	$(RM) Concat(lib,libname.so.rev) Concat(lib,libname.so)

#endif /* SharedLibraryTarget */

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

/*
 * Sequent does not use the InstallManPageAliases rule.
 * Sequent customer installation procedure uses makealiases(1M)
 * after the initial product manpages are installed in system directories.
 */
#define InstallManPageAliases(file,destdir,aliases) /* use makealiases(1M) */

/*
 * Man pages need to be formatted when installed, so override the default
 * imake rules.
 */
#if defined(UseInstalled)
MANCAT = cat
#else
MANCAT = sed -f $(CONFIGSRC)/util/installman.sed
#endif

#define InstallManPageLong(file,destdir,dest)				@@\
all:: file.$(MANSUFFIX).z						@@\
									@@\
file.$(MANSUFFIX).z:: file.man						@@\
	@if [ -f file.man ]; \						@@\
	then \								@@\
	$(MANCAT) file.man | $(NEQN) | \				@@\
	$(TBL) | $(NROFF) $(MANMACROS) | $(COL) > file.$(MANSUFFIX); \	@@\
	$(RM) file.$(MANSUFFIX).z; \					@@\
	$(PACK) -f file.$(MANSUFFIX); \					@@\
	fi 								@@\
									@@\
file.man::								@@\
									@@\
install.man::								@@\
	MakeDir($(DESTDIR)destdir)					@@\
	@if [ -f file.$(MANSUFFIX).z ]; \				@@\
	then \								@@\
	$(INSTALL) -c $(INSTMANFLAGS) file.$(MANSUFFIX).z $(DESTDIR)destdir/dest.$(MANSUFFIX).z; \@@\
	fi

#define InstallMultipleManSuffix(list,dest,suff)			@@\
install.man::								@@\
	MakeDir($(DESTDIR)dest)						@@\
	MakeFlagsToShellFlags(i,set +e); \				@@\
	@for i in list; do \						@@\
	  (set -x; \							@@\
	$(MANCAT) $$i.suff | $(NEQN) | \				@@\
	$(TBL) | $(NROFF) $(MANMACROS) | $(COL) >/tmp/$$i.suff; \	@@\
	  $(PACK) -f /tmp/$$i.suff; \					@@\
	  $(INSTALL) -c $(INSTMANFLAGS) /tmp/$$i.suff.z $(DESTDIR)dest/$$i.$(MANSUFFIX).z; \	@@\
	  $(RM) /tmp/$$i.suff.z); \					@@\
	done

#define InstallMultipleMan(list,dest)					@@\
	InstallMultipleManSuffix(list,dest,man)

/* 
 * InstallMotifManPage relies on the fact that all the
 * Imakefiles where it is used (or Makefile default value)
 * will correctly define MANSUFFIX which may be
 * either "section" or "section"x.
 * Since we rely on MANSUFFIX being defined correctly in each Makefile
 * we can also rely on MANDIR = $(MANSOURCEPATH)section
 *
 * CAUTION:
 * The source file "file.section" may have the same name as
 * the target file "file.$(MANSUFFIX)" so we must use temporary files
 * so that we do not overwrite "file.section".
 */
#define InstallMotifManPage(file,section)				@@\
all:: file.$(MANSUFFIX).z						@@\
									@@\
file.$(MANSUFFIX).z: file.section					@@\
	@$(MANCAT) file.section | $(NEQN) | \				@@\
	$(TBL) | $(NROFF) $(MANMACROS) | $(COL) > /tmp/file.man; \	@@\
	$(RM) /tmp/file.man.z; \					@@\
	$(PACK) -f /tmp/file.man; \					@@\
	$(CP) /tmp/file.man.z file.$(MANSUFFIX).z; \			@@\
	$(RM) /tmp/file.man.z						@@\
									@@\
install.man:: file.$(MANSUFFIX).z					@@\
	MakeDir($(DESTDIR)$(MANDIR))					@@\
	$(INSTALL) -c $(INSTMANFLAGS) file.$(MANSUFFIX).z $(DESTDIR)$(MANDIR)/file.$(MANSUFFIX).z

/* 
 * The Real_MessageCatalogRule defined in Motif.rules does not
 * install the generated catalog file.  This rule adds an install
 * clause to do that.
 */
#define Real_MessageCatalogRule(prefix)					@@\
prefix.cat Concat(prefix,MsgCatI.h):					@@\
	$(RM) Concat(prefix,MsgCatI.h) prefix.cat $(MLOCSRC)/C/msg/prefix.msg	@@\
	$(MKCATTOOL) Concat(prefix,MsgCatI.h) prefix.msg > $(MLOCSRC)/C/msg/prefix.msg	@@\
	$(GENCAT) prefix.cat $(MLOCSRC)/C/msg/prefix.msg		@@\
									@@\
includes:: prefix.cat Concat(prefix,MsgCatI.h)				@@\
									@@\
depend:: prefix.cat Concat(prefix,MsgCatI.h)				@@\
									@@\
all:: prefix.cat							@@\
									@@\
install:: prefix.cat							@@\
	MakeDir($(DESTDIR)$(MESSAGECATDIR))				@@\
	$(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) prefix.cat $(DESTDIR)$(MESSAGECATDIR)/prefix.cat	@@\
	$(RM) $(DESTDIR)$(MESSAGECATDIR)/prefix				@@\
	$(LN) prefix.cat $(DESTDIR)$(MESSAGECATDIR)/prefix		@@\
	MakeDir($(DESTDIR)$(NLSDIR))					@@\
	$(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) prefix.cat $(DESTDIR)$(NLSDIR)/prefix.cat	@@\
	$(RM) $(DESTDIR)$(NLSDIR)/prefix				@@\
	$(LN) prefix.cat $(DESTDIR)$(NLSDIR)/prefix			@@\
									@@\
clean::									@@\
	$(RM) prefix.cat Concat(prefix,MsgCatI.h)