summaryrefslogtreecommitdiff
path: root/xorg-cf-files/lnxLib.rules
blob: 0cc71d32589912a33668f3341871d16a5d98e634 (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
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
XCOMM $Xorg: lnxLib.rules,v 1.3 2000/08/17 19:41:47 cpqbld Exp $
XCOMM $XFree86: xc/config/cf/lnxLib.rules,v 3.52 2003/10/31 20:49:03 herrb Exp $

/*
 * Linux shared library rules (DLL & ELF versions)
 */
#ifndef HasSharedLibraries
# define HasSharedLibraries YES
#endif
#ifndef ForceNormalLib
# define ForceNormalLib NO
#endif

#ifndef UseRpath
#define UseRpath NO
#endif

#ifndef SharedOldX
# define SharedOldX NO
#endif

#if UseElfFormat

# if (LinuxCLibMajorVersion >= 5 && LinuxCLibMinorVersion >= 4) || LinuxCLibMajorVersion >= 6
#  ifndef SpecialMalloc
#   define SpecialMalloc NO
#  endif
#if 0
#  ifndef UseInternalMalloc
#   define UseInternalMalloc NO
#  endif
#endif
# endif

# if LinuxCLibMajorVersion <= 5
/*
 *	#define BaseShLibReqs	-lc
 *
 * I don't want to use this since the normal ELF executables should
 * be linked with libc.so. If it is not, i.e., static, the variables in
 * libc.so which is loaded in because of the other shared libraries
 * may have different values than the ones in the static ELF
 * executables. That happens if the binaries are linked with libg.a
 * or libc_p.a.
 *
 * If an ELF executable linked with libg.a or libc_p.a loads a shared
 * object which needs libc.so via dlopen (), I think it should fail.
 * It is a very bad idea. The moral story is DON'T USE dlopen () IN
 * ELF EXECUTABLES LINKED WITH libg.a OR libc_p.a. H.J.
 *
 */
#  define BaseShLibReqs
# else
/* With GNU libc 2 this works fine. */
#  define BaseShLibReqs	-lc
# endif

# ifndef SharedDataSeparation
#  define SharedDataSeparation NO
# endif
# ifndef SharedCodeDef
#  define SharedCodeDef /**/
# endif
# ifndef SharedLibraryDef
#  define SharedLibraryDef /**/
# endif
# ifndef ShLibIncludeFile
#  define ShLibIncludeFile <lnxLib.tmpl>
# endif
#ifndef RpathLoadFlags
#if UseRpath
#define RpathLoadFlags -Wl,-rpath,$(USRLIBDIRPATH)
#else
#define RpathLoadFlags /**/
#endif
#endif
#ifndef LibraryRpathLoadFlags
#define LibraryRpathLoadFlags RpathLoadFlags
#endif
# ifndef SharedLibraryLoadFlags
#  define SharedLibraryLoadFlags -shared
# endif
# ifndef PositionIndependentCFlags
#  define PositionIndependentCFlags -fPIC
# endif
# ifndef PositionIndependentCplusplusFlags
#  define PositionIndependentCplusplusFlags -fPIC
# endif
# ifndef ExtraLoadFlags
#  if LinuxBinUtilsMajorVersion >= 26
#   ifdef UseInstalled
#    if LinuxBinUtilsMajorVersion < 27
#     define ExtraLoadFlags RpathLoadFlags -Wl,-rpath-link,$(USRLIBDIRPATH)
#    endif
#   else
#    define ExtraLoadFlags RpathLoadFlags -Wl,-rpath-link,$(BUILDLIBDIR)
#   endif
#  else
#   define ExtraLoadFlags RpathLoadFlags
#  endif
# endif
# ifndef HardCodeLibdirFlag
#  define HardCodeLibdirFlag RpathLoadFlags
# endif
# if !defined(ShlibGlobalsFlags)
#  define ShlibGlobalsFlags -Wl,-Bsymbolic
# endif

/*
 * InstallSharedLibrary - generate rules to install the shared library.
 * NOTE: file must be executable, hence "INSTBINFLAGS"
 */
# ifndef InstallSharedLibrary
#  define	InstallSharedLibrary(libname,rev,dest)			@@\
install:: Concat(lib,libname.so.rev) 					@@\
	MakeDir($(DESTDIR)dest)						@@\
	$(INSTALL) $(INSTALLFLAGS) $(INSTBINFLAGS) Concat(lib,libname.so.rev) $(DESTDIR)dest @@\
	@T=`echo Concat($(DESTDIR)dest/lib,libname.so.rev) | sed 's/\(lib[^\.]*\.so\.[0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`;\
	  set -x; $(RM) $$T && $(LN) Concat(lib,libname.so.rev) $$T	@@\
	@if $(SOSYMLINK); then (set -x; \
	  $(RM) Concat($(DESTDIR)dest/lib,libname.so); \		@@\
	  $(LN) Concat(lib,libname.so.rev) Concat($(DESTDIR)dest/lib,libname.so)); fi
# endif /* InstallSharedLibrary */

# ifndef InstallSharedLibtoolLibrary

#  define SetRevisions(rev) V=`expr rev : '\([^:]*\)'`; \		@@\
		R=`expr rev : '.*:\([^:]*\):'`; \			@@\
		A=`expr rev : '.*:\([^:]*\)'`; \			@@\
		MAJ=`expr $$V - $$A`; \					@@\
		MIN=$$A.$$R

#  define	InstallSharedLibtoolLibrary(libname,rev,dest)		@@\
install:: Concat(lib,libname.so) 					@@\
	MakeDir($(DESTDIR)dest)						@@\
	@set +e; SetRevisions(rev); \					@@\
		set -xe; \						@@\
		$(INSTALL) $(INSTALLFLAGS) $(INSTBINFLAGS) Concat(lib,libname.so.$$MAJ.$$MIN) $(DESTDIR)dest; \ @@\
		$(RM) Concat($(DESTDIR)dest/lib,libname.so.$$MAJ); \	@@\
		$(LN) Concat(lib,libname.so.$$MAJ.$$MIN) Concat($(DESTDIR)dest/lib,libname.so.$$MAJ); \ @@\
		$(RM) Concat($(DESTDIR)dest/lib,libname.so); \		@@\
		$(LN) Concat(lib,libname.so.$$MAJ.$$MIN) 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 */


/*
 * 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) $@~							@@\
	@SONAME=`echo $@ | sed 's/\(lib[^\.]*\.so\.[0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`; (set -x; \	@@\
		cd down; $(CC) -o up/$@~ $(SHLIBLDFLAGS) -Wl,-soname,$$SONAME solist $(REQUIREDLIBS) BaseShLibReqs) || exit 1; \ @@\
		(set -x; $(RM) $$SONAME; $(LN) $@ $$SONAME); \		@@\
		LinkBuildSonameLibrary($$SONAME)			@@\
	$(RM) $@ 							@@\
	$(MV) $@~ $@							@@\
	@if $(SOSYMLINK); then (set -x; \				@@\
	  $(RM) Concat(lib,libname.so); \				@@\
	  $(LN) $@ Concat(lib,libname.so)); fi				@@\
	LinkBuildLibrary($@)						@@\
	LinkBuildLibraryMaybe(Concat(lib,libname.so),$(SOSYMLINK))	@@\
									@@\
clean::									@@\
	@MAJREV=`echo rev | sed 's/\([0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`; \	@@\
	set -x; $(RM) Concat(lib,libname.so.$$MAJREV)			@@\
	$(RM) Concat(lib,libname.so.rev) Concat(lib,libname.so)

# endif /* SharedLibraryTarget */


# ifndef SharedLibtoolLibraryTarget
#  define SharedLibtoolLibraryTarget(libname,rev,solist,down,up)	@@\
AllTarget(Concat(lib,libname.so))					@@\
									@@\
Concat(lib,libname.so):  solist $(EXTRALIBRARYDEPS)			@@\
	$(RM) $@~							@@\
	@set +e; SetRevisions(rev); set -e; \				@@\
		SONAME=$@.$$MAJ; \					@@\
		(set -x; \						@@\
		$(RM) $@.$$MAJ.$$MIN~; \				@@\
		cd down; $(CC) -o up/$@.$$MAJ.$$MIN~ $(SHLIBLDFLAGS) -Wl,-soname,$$SONAME solist $(REQUIREDLIBS) BaseShLibReqs) || exit 1; \ @@\
		(set -x; \						@@\
		$(RM) $$SONAME; $(LN) $@.$$MAJ.$$MIN $$SONAME); \	@@\
		LinkBuildSonameLibrary($$SONAME); \			@@\
		(set -x; \						@@\
		$(RM) $@.$$MAJ.$$MIN; \					@@\
		$(MV) $@.$$MAJ.$$MIN~ $@.$$MAJ.$$MIN; \			@@\
	  	$(RM) $@; \						@@\
	  	$(LN) $@.$$MAJ.$$MIN $@); \				@@\
		LinkBuildLibraryInline($@.$$MAJ.$$MIN); \		@@\
		LinkBuildLibraryInline($@)				@@\
									@@\
clean::									@@\
	@set +e; SetRevisions(rev); \					@@\
		set -xe; \						@@\
		$(RM) Concat(lib,libname.so.$$MAJ); \			@@\
		$(RM) Concat(lib,libname.so.$$MAJ.$$MIN)		@@\
	$(RM) Concat(lib,libname.so)

# endif /* SharedLibtoolLibraryTarget */

/*
 * SharedDepLibraryTarget - generate rules to create a shared library.
 */
# ifndef SharedDepLibraryTarget
#   define SharedDepLibraryTarget(libname,rev,deplist,solist,down,up)	@@\
AllTarget(Concat(lib,libname.so.rev))					@@\
									@@\
Concat(lib,libname.so.rev):  deplist $(EXTRALIBRARYDEPS)		@@\
	$(RM) $@~							@@\
	@SONAME=`echo $@ | sed 's/\(lib[^\.]*\.so\.[0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`; set -x; \		@@\
		(cd down; $(CC) -o up/$@~ $(SHLIBLDFLAGS) -Wl,-soname,$$SONAME solist $(REQUIREDLIBS) BaseShLibReqs); \ @@\
		$(RM) $$SONAME; $(LN) $@ $$SONAME; \			@@\
		LinkBuildSonameLibrary($$SONAME)			@@\
	$(RM) $@ 							@@\
	$(MV) $@~ $@							@@\
	@if $(SOSYMLINK); then (set -x; \				@@\
	  $(RM) Concat(lib,libname.so); \				@@\
	  $(LN) $@ Concat(lib,libname.so)); fi				@@\
	LinkBuildLibrary($@)						@@\
	LinkBuildLibraryMaybe(Concat(lib,libname.so),$(SOSYMLINK))	@@\
									@@\
clean::									@@\
	@MAJREV=`echo rev | sed 's/\([0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`; \	@@\
	set -x; $(RM) Concat(lib,libname.so.$$MAJREV)			@@\
	$(RM) Concat(lib,libname.so.rev) Concat(lib,libname.so)

#endif /* SharedDepLibraryTarget */

/*
 * SharedDepCplusplusLibraryTarget - generate rules to create a shared library.
 */
#ifndef SharedDepCplusplusLibraryTarget
#define SharedDepCplusplusLibraryTarget(libname,rev,deplist,solist,down,up) @@\
AllTarget(Concat(lib,libname.so.rev))					@@\
									@@\
Concat(lib,libname.so.rev):  deplist $(EXTRALIBRARYDEPS)		@@\
	$(RM) $@~							@@\
	@SONAME=`echo $@ | sed 's/\(lib[^\.]*\.so\.[0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`; set -x; \		@@\
		(cd down; $(CXX) -o up/$@~ $(SHLIBLDFLAGS) -Wl,-soname,$$SONAME solist $(REQUIREDLIBS) BaseShLibReqs); \ @@\
		$(RM) $$SONAME; $(LN) $@ $$SONAME; \			@@\
		LinkBuildSonameLibrary($$SONAME)			@@\
	$(RM) $@ 							@@\
	$(MV) $@~ $@							@@\
	@if $(SOSYMLINK); then (set -x; \				@@\
	  $(RM) Concat(lib,libname.so); \				@@\
	  $(LN) $@ Concat(lib,libname.so)); fi				@@\
	LinkBuildLibrary($@)						@@\
	LinkBuildLibraryMaybe(Concat(lib,libname.so),$(SOSYMLINK))	@@\
									@@\
clean::									@@\
	@MAJREV=`echo rev | sed 's/\([0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`; \	@@\
	set -x; $(RM) Concat(lib,libname.so.$$MAJREV)			@@\
	$(RM) Concat(lib,libname.so.rev) Concat(lib,libname.so)

#endif /* SharedDepCplusplusLibraryTarget */

# ifndef SharedDepModuleTarget
#  define SharedDepModuleTarget(name,deps,solist)			@@\
AllTarget(name)								@@\
									@@\
name: deps								@@\
	$(RM) $@~							@@\
	$(CC) -o $@~ $(SHLIBLDFLAGS) solist $(REQUIREDLIBS) BaseShLibReqs @@\
	$(RM) $@							@@\
	$(MV) $@~ $@							@@\
									@@\
clean::									@@\
	$(RM) name

# endif /* SharedDepModuleTarget */

# ifndef SharedDriModuleTarget
#  define SharedDriModuleTarget(name,deps,solist)			@@\
AllTarget(name)								@@\
									@@\
name: deps								@@\
	$(RM) $@~ $@.map						@@\
	@(echo 'DRI_MODULE { global: __dri*; local: *; };' > $@.map)	@@\
	$(CC) -o $@~ -Wl,--version-script=$@.map $(SHLIBLDFLAGS) solist $(REQUIREDLIBS) BaseShLibReqs @@\
	$(RM) $@ $@.map							@@\
	$(MV) $@~ $@							@@\
									@@\
clean::									@@\
	$(RM) name							@@\
	$(RM) name.map

# endif /* SharedDriModuleTarget */

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

#else /* UseElfFormat */

# ifndef SharedDataSeparation
#  define SharedDataSeparation NO
# endif
# ifndef SharedCodeDef
#  define SharedCodeDef /**/
# endif
# ifndef SharedLibraryDef
#  define SharedLibraryDef /**/
# endif
# ifndef ShLibIncludeFile
#  define ShLibIncludeFile <lnxLib.tmpl>
# endif
# ifndef SharedLibraryLoadFlags
#  define SharedLibraryLoadFlags /**/
# endif
# ifndef PositionIndependentCFlags
#  define PositionIndependentCFlags -B/usr/bin/jump
# endif

/*
 * These definitions are now extended to work with the X sources and
 * external sources wishing to build shared libs.
 *
 * A library can create it's own shlibs (.so) or can be incorporated into
 * another "host" lib. All libraries generate stub (.sa) files.
 * A "host" lib does all the work to generate the stubs for itself and its
 * "guests", invoking the "guest" Makefiles to create the objects for
 * inclusion into the "host" shlib. A "guest" lib will ask the "host" to
 * create the stubfiles, then copy its own into its directory.
 * Most external libs are "host" libs; the concept of "guest" is a holdover
 * from older libs during the days of scarce shared library address space.
 *
 * To create a simple "host" shared lib, Xfoo, define:
 *
 *  JUMP_ROOT_Xfoo = <source directory>
 *  JUMP_IS_HOST_Xfoo = YES
 *  JUMP_STUBLIBS_Xfoo = libXfoo.sa
 *  JUMP_DIR_Xfoo = $(JUMP_ROOT_Xfoo)/shared		<work directory>
 *  JUMP_DEFS_Xfoo = -DFOO				<defs for jump files>
 *  JUMP_VARS_Xfoo = $(JUMP_ROOT_Xfoo)/jump_vars	<see DLL docs>
 *  JUMP_FUNCS_Xfoo = $(JUMP_ROOT_Xfoo)/jump_funcs	<see DLL docs>
 *  JUMP_IGNORE_Xfoo = $(JUMP_ROOT_Xfoo)/jump_ignore	<see DLL docs>
 *  JUMP_EXPORT_Xfoo = $(JUMP_DIR_Xfoo)/jump.vars	<exported symbols>
 *  JUMP_IMPORT_Xfoo = $(JUMP_EXPORT_Xbar)		<imported symbols>
 *  JUMP_ADDRESS_Xfoo = 0xXXXXXXXX			<fill in with address>
 *  JUMP_JUMPTABLESIZE_Xfoo = 0x4000			<adjust if necessary>
 *  JUMP_GOTSIZE_Xfoo = 4096				<adjust if necessary>
 *  JUMP_STUBNAMES_Xfoo = libXfoo			<and others>
 *  JUMP_STUBS_IMPORT_Xfoo = /usr/lib/libc.sa		<and others>
 *  JUMP_LDLIBS_Xfoo = `$(CC) --print-libgcc-file-name` -lc <and others>
 *
 * To create a complex "host", you need to add
 *  JUMP_SIBARS_Xt = jump/libXbar.a~			<and others>
 * These are the archives of the shared objects of the "guest" libs. They
 * need to be added to the JUMP_LDLIBS_Xfoo lines.
 *
 * For further clarification, study the definitions of libXaw, a simple "host"
 * lib, libXt, a complex "host" lib, and libXmu, one of libXts "guests".
 *
 * As a hint of how to start (with the DLL docs), touch jump_vars, jump_funcs
 * and jump_ignore, then compile. Then massage the jump.vars and jump.funcs
 * files in the shared subdirectory into jump_xxx files.
 */

# ifndef UseInstalled
XCOMM These are only needed to build the server

#  if LinuxElfDefault
LIBC_SA = /usr/i486-linuxaout/lib/libc.sa
LIBM_SA = /usr/i486-linuxaout/lib/libm.sa
#  else
LIBC_SA = /usr/lib/libc.sa
LIBM_SA = /usr/lib/libm.sa
#  endif

JUMP_LDLIBS_libc = `$(CC) --print-libgcc-file-name` -lc

XCOMM libX11.so (X11, SM, ICE)
JUMP_ROOT_X11 = $(XLIBSRC)
JUMP_IS_HOST_X11 = YES
JUMP_STUBLIBS_X11 = libX11.sa libSM.sa libICE.sa
JUMP_SIBDIRS_X11 = $(JUMP_ROOT_SM) $(JUMP_ROOT_ICE)
JUMP_DIR_X11 = $(JUMP_ROOT_X11)/shared
JUMP_DEFS_X11 = $(XDMAUTHDEFS) $(XKB_DEFINES)
JUMP_VARS_X11 = $(JUMP_ROOT_X11)/jump_vars
JUMP_FUNCS_X11 = $(JUMP_ROOT_X11)/jump_funcs
JUMP_IGNORE_X11 = $(JUMP_ROOT_X11)/jump_ignore
JUMP_EXPORT_X11 = $(JUMP_DIR_X11)/jump.vars
JUMP_ADDRESS_X11 = 0x60200000
JUMP_JUMPTABLESIZE_X11 = 0x4000
JUMP_GOTSIZE_X11 = 4096
JUMP_STUBNAMES_X11 = libX11 libSM libICE
JUMP_STUBS_IMPORT_X11 = $(LIBC_SA)
JUMP_SIBARS_X11 = jump/libSM.a~ jump/libICE.a~
JUMP_LDLIBS_X11 = $(JUMP_SIBARS_X11) $(JUMP_LDLIBS_libc)

XCOMM libSM (part of libX11.so)
JUMP_ROOT_SM = $(SMSRC)
JUMP_IS_HOST_SM = NO
JUMP_HOST_SM = $(JUMP_ROOT_X11)
JUMP_DIR_SM = $(JUMP_DIR_X11)

XCOMM libICE (part of libX11.so)
JUMP_ROOT_ICE = $(ICESRC)
JUMP_IS_HOST_ICE = NO
JUMP_HOST_ICE = $(JUMP_ROOT_X11)
JUMP_DIR_ICE = $(JUMP_DIR_X11)

XCOMM libXt.so (Xt, Xmu, Xext, Xi, Xtst, Xp)
JUMP_ROOT_Xt = $(TOOLKITSRC)
JUMP_IS_HOST_Xt = YES
JUMP_STUBLIBS_Xt = libXt.sa libXmu.sa libXext.sa libXi.sa libXtst.sa libXp.sa
JUMP_SUBDIRS_Xt = $(JUMP_ROOT_X11)
JUMP_SIBDIRS_Xt = $(JUMP_ROOT_Xmu) $(JUMP_ROOT_Xext) \
	$(JUMP_ROOT_Xi) $(JUMP_ROOT_Xtst) $(JUMP_ROOT_Xp)
JUMP_DIR_Xt = $(JUMP_ROOT_Xt)/shared
JUMP_VARS_Xt = $(JUMP_ROOT_Xt)/jump_vars
JUMP_FUNCS_Xt = $(JUMP_ROOT_Xt)/jump_funcs
JUMP_IGNORE_Xt = $(JUMP_ROOT_Xt)/jump_ignore
JUMP_EXPORT_Xt = $(JUMP_DIR_Xt)/jump.vars
JUMP_IMPORT_Xt = $(JUMP_EXPORT_X11)
JUMP_ADDRESS_Xt = 0x602a0000
JUMP_JUMPTABLESIZE_Xt = 0x4000
JUMP_GOTSIZE_Xt = 4096
JUMP_STUBNAMES_Xt = libXt libXmu libXext libXi libXtst libXp
JUMP_STUBS_IMPORT_Xt = $(JUMP_STUBS_IMPORT_X11)
JUMP_SIBARS_Xt = jump/libXmu.a~ jump/libXext.a~ jump/libXi.a~ jump/libXtst.a~ jump/libXp.a~
JUMP_LDLIBS_Xt = $(JUMP_SIBARS_Xt) $(JUMP_ROOT_ICE)/libICE.sa \
	$(JUMP_ROOT_SM)/libSM.sa $(JUMP_ROOT_X11)/libX11.sa $(JUMP_LDLIBS_libc)

XCOMM libXmu (part of libXt.so)
JUMP_ROOT_Xmu = $(XMUSRC)
JUMP_IS_HOST_Xmu = NO
JUMP_HOST_Xmu = $(JUMP_ROOT_Xt)
JUMP_DIR_Xmu = $(JUMP_DIR_Xt)

XCOMM libXext (part of libXt.so)
JUMP_ROOT_Xext = $(XEXTLIBSRC)
JUMP_IS_HOST_Xext = NO
JUMP_HOST_Xext = $(JUMP_ROOT_Xt)
JUMP_DIR_Xext = $(JUMP_DIR_Xt)

XCOMM libXi (part of libXt.so)
JUMP_ROOT_Xi = $(XILIBSRC)
JUMP_IS_HOST_Xi = NO
JUMP_HOST_Xi = $(JUMP_ROOT_Xt)
JUMP_DIR_Xi = $(JUMP_DIR_Xt)

XCOMM libXtst (part of libXt.so)
JUMP_ROOT_Xtst = $(XTESTLIBSRC)
JUMP_IS_HOST_Xtst = NO
JUMP_HOST_Xtst = $(JUMP_ROOT_Xt)
JUMP_DIR_Xtst = $(JUMP_DIR_Xt)

XCOMM libXp (part of libXt.so)
JUMP_ROOT_Xp = $(XPLIBSRC)
JUMP_IS_HOST_Xp = NO
JUMP_HOST_Xp = $(JUMP_ROOT_Xt)
JUMP_DIR_Xp = $(JUMP_DIR_Xt)

XCOMM libXaw.so (Xaw)
JUMP_ROOT_Xaw = $(AWIDGETSRC)
JUMP_IS_HOST_Xaw = YES
JUMP_STUBLIBS_Xaw = libXaw.sa
JUMP_SUBDIRS_Xaw = $(JUMP_ROOT_Xt)
JUMP_DIR_Xaw = $(JUMP_ROOT_Xaw)/shared
JUMP_VARS_Xaw = $(JUMP_ROOT_Xaw)/jump_vars
JUMP_FUNCS_Xaw = $(JUMP_ROOT_Xaw)/jump_funcs
JUMP_IGNORE_Xaw = $(JUMP_ROOT_Xaw)/jump_ignore
JUMP_EXPORT_Xaw = $(JUMP_DIR_Xaw)/jump.vars
JUMP_IMPORT_Xaw = $(JUMP_EXPORT_Xt) $(JUMP_EXPORT_X11)
JUMP_ADDRESS_Xaw = 0x60300000
JUMP_JUMPTABLESIZE_Xaw = 0x4000
JUMP_GOTSIZE_Xaw = 4096
JUMP_STUBNAMES_Xaw = libXaw
JUMP_STUBS_IMPORT_Xaw = $(JUMP_STUBS_IMPORT_X11)
JUMP_LDLIBS_Xaw = $(JUMP_ROOT_Xt)/libXt.sa $(JUMP_ROOT_Xt)/libXmu.sa \
	$(JUMP_ROOT_Xt)/libXext.sa $(JUMP_ROOT_X11)/libX11.sa \
	$(JUMP_LDLIBS_libc)

# endif /* !UseInstalled */

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

/*
 * SharedLibraryTarget - generate rules to create a shared library;
 * There are two basic flavors of libs: self-generating, which create
 * their own (and possibly other) libs, and hosted, which rely on another
 * lib for all the work.
 */
# ifndef SharedLibraryTarget
#  define SharedLibraryTarget(libname,rev,solist,down,up)		@@\
XCOMM This logic is such to compile the libs in their proper order,	@@\
XCOMM remain dependent on subsidiary libs, and yet minimize local work	@@\
									@@\
JUMP_DIR=./jump								@@\
JUMP_LIB=Concat(lib,libname)						@@\
									@@\
XCOMM  this is needed for newer gnumake versions			@@\
export JUMP_DIR JUMP_LIB						@@\
									@@\
JUMP_IS_HOST=$(Concat(JUMP_IS_HOST_,libname))				@@\
JUMP_AR=$(JUMP_DIR)/Concat(lib,libname.a~)				@@\
JUMP_SA=Concat(lib,libname.sa)						@@\
JUMP_SO=Concat(lib,libname.so.rev)					@@\
									@@\
JUMP_HOST=$(Concat(JUMP_HOST_,libname))					@@\
									@@\
INSTSOLIBFLAGS=-m 0555							@@\
									@@\
AllTarget($(BUILDLIBDIR)/$(JUMP_SA))					@@\
									@@\
$(BUILDLIBDIR)/$(JUMP_SA): $(JUMP_SA)					@@\
	LinkBuildLibrary($(JUMP_SA))					@@\
									@@\
$(JUMP_SA) $(Concat(JUMP_STUBLIBS_,libname)) do_JUMP_SA: \
		down/mk_JUMP_SA_$(JUMP_IS_HOST)				@@\
									@@\
down/mk_JUMP_SA_0:: mk_JUMP_HOST					@@\
									@@\
down/mk_JUMP_SA_0:: $(JUMP_HOST)/$(JUMP_SA)				@@\
	$(RM) $(JUMP_SA)						@@\
	$(LN) $(JUMP_HOST)/$(JUMP_SA) $(JUMP_SA)			@@\
	touch $@							@@\
									@@\
down/mk_JUMP_SA_1:: $(JUMP_SO)						@@\
									@@\
down/mk_JUMP_SA_1:: down/mk_JUMP_SO_2					@@\
	$(RM) $(Concat(JUMP_STUBLIBS_,libname))				@@\
	mkstubs -v rev -l $(JUMP_LIB) \
		-a $(Concat(JUMP_ADDRESS_,libname)) \
		-j $(Concat(JUMP_JUMPTABLESIZE_,libname)) \
		-g $(Concat(JUMP_GOTSIZE_,libname)) \
		-- $(Concat(JUMP_STUBNAMES_,libname))			@@\
	verify-shlib -l $(JUMP_SO) \
		$(Concat(JUMP_STUBLIBS_,libname))			@@\
	$(MV) verify.out $(JUMP_DIR)					@@\
	touch $@							@@\
									@@\
mk_JUMP_HOST:								@@\
	@echo checking stub library $(JUMP_SA) in $(JUMP_HOST)...	@@\
	@(cd $(JUMP_HOST); $(MAKE) $(MFLAGS) $(JUMP_SA)) || exit 1	@@\
	@echo ok. continuing in $(Concat(JUMP_ROOT_,libname))...	@@\
									@@\
$(JUMP_SO): down/mk_JUMP_SO_$(JUMP_IS_HOST)				@@\
									@@\
down/mk_JUMP_SO_0:							@@\
									@@\
down/mk_JUMP_SO_1:: $(JUMP_AR) mk_JUMP_SIBDIRS down/mk_JUMP_SO_2	@@\
									@@\
down/mk_JUMP_SO_2: down/mk_JUMP_AR $(Concat(JUMP_SIBARS_,libname))	@@\
	$(RM) $(JUMP_SO)						@@\
	mkimage -f -v rev -l $(JUMP_LIB) \
		-a $(Concat(JUMP_ADDRESS_,libname)) \
		-j $(Concat(JUMP_JUMPTABLESIZE_,libname)) \
		-g $(Concat(JUMP_GOTSIZE_,libname)) \
		-- $(JUMP_AR) $(Concat(JUMP_LDLIBS_,libname))		@@\
	$(RM) $(JUMP_DIR)/__jump.s $(JUMP_DIR)/__jump.o			@@\
	LinkBuildLibrary($(JUMP_SO))					@@\
	touch $@							@@\
									@@\
mk_JUMP_SIBDIRS:							@@\
	@for d in $(Concat(JUMP_SIBDIRS_,libname)); do \
		echo checking ar library in $$d...; \
		(cd $$d ; $(MAKE) $(MFLAGS) fastdo_JUMP_AR) || exit 1; \
		echo ok. continuing in $(Concat(JUMP_ROOT_,libname))...;done@@\
									@@\
fastdo_JUMP_AR: $(JUMP_DIR) down/mk_JUMP_AR				@@\
									@@\
$(JUMP_AR) do_JUMP_AR:: jumpsetup down/mk_JUMP_AR			@@\
									@@\
jumpsetup: $(JUMP_DIR) jumpsetup_$(JUMP_IS_HOST)			@@\
									@@\
$(JUMP_DIR):								@@\
	$(RM) jump							@@\
	LibMkdir($(Concat(JUMP_DIR_,libname)))				@@\
	$(LN) $(Concat(JUMP_DIR_,libname)) jump				@@\
									@@\
jumpsetup_0:								@@\
	@echo doing jump setup in host $(JUMP_HOST)...			@@\
	@(cd $(JUMP_HOST); $(MAKE) $(MFLAGS) jumpsetup) || exit 1	@@\
	@echo ok. continuing in $(Concat(JUMP_ROOT_,libname))...	@@\
									@@\
jumpsetup_1::								@@\
	@for d in $(Concat(JUMP_SUBDIRS_,libname)); do \
		echo checking stub library in $$d...; \
		(cd $$d ; $(MAKE) $(MFLAGS) do_JUMP_SA) || exit 1; \
		echo ok. continuing in $(Concat(JUMP_ROOT_,libname))...;done@@\
									@@\
jumpsetup_1:: $(JUMP_DIR)/jump.funcs $(JUMP_DIR)/jump.vars \
	$(JUMP_DIR)/jump.ignore $(JUMP_DIR)/jump.import			@@\
									@@\
$(JUMP_DIR)/jump.funcs: $(Concat(JUMP_FUNCS_,libname))			@@\
	$(RM) $(JUMP_DIR)/jump.funcs					@@\
	cat $(Concat(JUMP_FUNCS_,libname)) | \
		$(CPP) $(ALLDEFINES) $(Concat(JUMP_DEFS_,libname)) > $@	@@\
									@@\
$(JUMP_DIR)/jump.vars: $(Concat(JUMP_VARS_,libname))			@@\
	$(RM) $(JUMP_DIR)/jump.vars					@@\
	cat $(Concat(JUMP_VARS_,libname)) | \
		$(CPP) $(ALLDEFINES) $(Concat(JUMP_DEFS_,libname)) > $@	@@\
									@@\
$(JUMP_DIR)/jump.ignore: $(Concat(JUMP_IGNORE_,libname))		@@\
	$(RM) $(JUMP_DIR)/jump.ignore					@@\
	cat $(Concat(JUMP_IGNORE_,libname)) | \
		$(CPP) $(ALLDEFINES) $(Concat(JUMP_DEFS_,libname)) > $@	@@\
									@@\
$(JUMP_DIR)/jump.import: $(JUMP_DIR)/stubs.import \
		$(Concat(JUMP_IMPORT_,libname))				@@\
	$(RM) $(JUMP_DIR)/jump.import					@@\
	cat $(JUMP_DIR)/stubs.import $(Concat(JUMP_IMPORT_,libname)) > $@ @@\
									@@\
$(JUMP_DIR)/stubs.import: $(Concat(JUMP_STUBS_IMPORT_,libname))		@@\
	$(RM) $(JUMP_DIR)/stubs.import					@@\
	nm --no-cplus $(Concat(JUMP_STUBS_IMPORT_,libname)) | grep '__GOT__' | \
		sed 's/__GOT__/_/' > $@					@@\
									@@\
down/mk_JUMP_AR: solist							@@\
	$(RM) $(JUMP_AR)						@@\
	@if [ -s $(JUMP_DIR)/jump.log ]; then \
		echo "Error: Leftover globals for shared lib"; \
		exit 1; fi						@@\
	(cd down; $(AR) up/$(JUMP_AR) solist) || exit 1			@@\
	$(RANLIB) $(JUMP_AR)						@@\
	touch $@							@@\
									@@\
clean:: jumpclean							@@\
									@@\
jumpclean: jumpclean_$(JUMP_IS_HOST)					@@\
	$(RM) $(JUMP_SA) down/mk_JUMP_AR				@@\
	$(RM) -r $(JUMP_DIR)						@@\
									@@\
jumpclean_0:								@@\
	$(RM) down/mk_JUMP_SA_0						@@\
	$(RM) $(JUMP_HOST)/$(JUMP_SA)					@@\
									@@\
jumpclean_1:								@@\
	$(RM) -r $(JUMP_SO) $(Concat(JUMP_DIR_,libname)) \		@@\
		down/mk_JUMP_SA_1 down/mk_JUMP_SO_1 down/mk_JUMP_SO_2
# endif /* SharedLibraryTarget */

/*
 * InstallSharedLibrary - generate rules to install the shared library.
 */
# ifndef InstallSharedLibrary
#  define	InstallSharedLibrary(libname,rev,dest)			@@\
install:: $(JUMP_SA) $(JUMP_SO)						@@\
	MakeDir($(DESTDIR)dest)						@@\
	@if [ "$(JUMP_IS_HOST)" = YES ]; then \
		(T=$(DESTDIR)dest/`echo $(JUMP_SO)|sed '/\(lib[^\.]*\.so\.[0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/`;\
		set -x; \
		$(INSTALL) -s -c $(INSTSOLIBFLAGS) $(JUMP_SO) $(DESTDIR)dest; \
		$(RM) $$T && $(LN) $(JUMP_SO) $$T); fi			@@\
	$(INSTALL) -c $(INSTLIBFLAGS) $(JUMP_SA) $(DESTDIR)dest
# endif /* InstallSharedLibrary */

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

#endif /* UseElfFormat */