1$ save_verify='f$verify(0)
2$! set ver
3$!
4$!      Compile and link for xmlink
5$!
6$! USAGE:
7$! @make [debug clobber clean]
8$!       debug : compile with degugger switch
9$!       clean : clean all except executable
10$!       clobber : clean all
11$!
12$! If you have
13$!              XVMSUTILS library (VMS6.2 or lower) <NOT TESTED>
14$! insert the correct directory instead of X11:
15$ xvmsutilsf="X11:XVMSUTILS.OLB"
16$!
17$! Already assumes DEC C on Alpha.
18$! Assume VAX C on VAX.
19$ decc=0
20$! Assume DEC C on VAX.
21$! decc=1
22$!
23$ QUOTE = """""""""
24$ QUOTE = QUOTE + QUOTE + QUOTE
25$ score = "SCOREFILE=" + QUOTE + "[]mlink.scores" + QUOTE
26$ data = "DATAFILE=" + QUOTE + "[]mlink.data" + QUOTE
27$ defscore==''score'
28$ defdata==''data'
29$!
30$! NOTHING SHOULD BE MODIFIED BELOW
31$!
32$ if p1 .eqs. "CLEAN" then goto Clean
33$ if p1 .eqs. "CLOBBER" then goto Clobber
34$!
35$ axp=f$getsyi("HW_MODEL") .ge. 1024
36$ sys_ver=f$edit(f$getsyi("version"),"compress")
37$ if f$extract(0,1,sys_ver) .nes. "V"
38$ then
39$   type sys$input
40This script will assume that the operating system version is at least V7.0.
41$!
42$   sys_ver="V7.0"
43$ endif
44$ sys_maj=0+f$extract(1,1,sys_ver)
45$ if sys_maj .lt. 7
46$ then
47$   xvmsutils=f$search("''xvmsutilsf'") .nes. ""
48$ endif
49$!
50$!
51$! Create .opt file
52$ close/nolog optf
53$ open/write optf xmlink.opt
54$!
55$ defs=="VMS"
56$ if sys_maj .lt. 7
57$ then
58$   if xvmsutils then defs=="''defs',USE_XVMSUTILS"
59$ else
60$   defs=="''defs',SRAND=srand48,LRAND=lrand48,MAXRAND=2147483648.0"
61$ endif
62$ defs=="''defscore',''defdata',''defs'"
63$!
64$!
65$! Establish the Compiling Environment
66$!
67$! Set compiler command
68$ if axp
69$ then
70$   cc=="cc/standar=vaxc/define=(''defs')"
71$ else
72$   if decc
73$   then
74$     cc=="cc/decc/standard=vaxc/define=(''defs')"
75$   else ! VAX C
76$     cc=="cc/define=(''defs')"
77$   endif
78$ endif
79$ if p1 .eqs. "DEBUG" .or. p2 .eqs. "DEBUG" .or. p3 .eqs. "DEBUG"
80$ then
81$   if axp
82$   then
83$     cc=="cc/deb/noopt/standar=vaxc/define=(''defs')/list"
84$   else
85$     if decc
86$     then
87$       cc=="cc/deb/noopt/decc/standar=vaxc/define=(''defs')/list"
88$     else ! VAX C
89$       cc=="cc/deb/noopt/define=(''defs')/list"
90$     endif
91$   endif
92$   link=="link/deb"
93$ endif
94$!
95$ if axp .or. .not. decc
96$ then
97$   define/nolog sys sys$library
98$ endif
99$!
100$ write sys$output "Compiling XMball with ''defs'"
101$ call make Mball.obj   "cc Mball.c"   Mball.c MballP.h Mball.h
102$ call make MballU.obj  "cc MballU.c"  MballU.c MballP.h Mball.h
103$ call make rngs.obj    "cc rngs.c"    rngs.c
104$ call make xmlink.obj  "cc xmlink.c"  xmlink.c Mball.h
105$!
106$! Get libraries
107$ if sys_maj .lt. 7
108$ then
109$   if xvmsutils then write optf "''xvmsutilsf'/lib"
110$ endif
111$! if .not. axp then write optf "sys$library:vaxcrtl/lib"
112$ write optf "sys$library:vaxcrtl/lib"
113$ if axp then write optf "sys$library:ucx$ipc_shr/share"
114$ if axp then write optf "sys$share:decw$xextlibshr/share"
115$ if axp then write optf "sys$share:decw$xtlibshrr5/share"
116$ if .not. axp then write optf "sys$library:ucx$ipc/lib"
117$! write optf "sys$share:decw$dxmlibshr/share"
118$ write optf "sys$share:decw$xmlibshr12/share"
119$ write optf "sys$share:decw$xlibshr/share"
120$ close optf
121$!
122$! LINK
123$ write sys$output "Linking XMball"
124$ link/map xmlink/opt
125$!
126$! Create .opt file
127$ open/write optf xmmlink.opt
128$ write sys$output "Compiling XmMball with ''defs'"
129$ call make Mball.obj   "cc Mball.c"   Mball.c MballP.h Mball.h
130$ call make MballU.obj  "cc MballU.c"  MballU.c MballP.h Mball.h
131$ call make rngs.obj    "cc rngs.c"    rngs.c
132$ call make xmmlink.obj "cc xmmlink.c" xmmlink.c Mball.h
133$! Get libraries
134$! if .not. axp then write optf "sys$library:vaxcrtl/lib"
135$ write optf "sys$library:vaxcrtl/lib"
136$ if axp then write optf "sys$library:ucx$ipc_shr/share"
137$ if axp then write optf "sys$share:decw$xextlibshr/share"
138$ if axp then write optf "sys$share:decw$xtlibshrr5/share"
139$ if .not. axp then write optf "sys$library:ucx$ipc/lib"
140$! write optf "sys$share:decw$dxmlibshr/share"
141$ write optf "sys$share:decw$xmlibshr12/share"
142$ write optf "sys$share:decw$xlibshr/share"
143$ close optf
144$!
145$! LINK
146$ write sys$output "Linking XmMball"
147$ link/map xmmlink/opt
148$!
149$ set noverify
150$ exit
151$!
152$Clobber:      ! Delete executables, Purge directory and clean up object files
153$!                and listings
154$ delete/noconfirm/log xmlink.exe;*
155$ delete/noconfirm/log xmmlink.exe;*
156$!
157$Clean:        ! Purge directory, clean up object files and listings
158$ close/nolog optf
159$ purge
160$ delete/noconfirm/log *.lis;*
161$ delete/noconfirm/log *.obj;*
162$ delete/noconfirm/log *.opt;*
163$ delete/noconfirm/log *.map;*
164$!
165$ exit
166$!
167! SUBROUTINE TO CHECK DEPENDENCIES
168$ make: subroutine
169$   v='f$verify(0)
170$!   p1       What we are trying to make
171$!   p2       Command to make it
172$!   p3 - p8  What it depends on
173$
174$   if (f$extract(0,3,p2) .eqs. "cc ") then write optf "''p1'"
175$   if (f$extract(0,3,p2) .eqs. "CC ") then write optf "''p1'"
176$
177$   if f$search(p1) .eqs. "" then goto MakeIt
178$   time=f$cvtime(f$file(p1,"RDT"))
179$   arg=3
180$Loop:
181$   argument=p'arg
182$   if argument .eqs. "" then goto Exit
183$   el=0
184$Loop2:
185$   file=f$element(el," ",argument)
186$   if file .eqs. " " then goto Endl
187$   afile=""
188$Loop3:
189$   ofile=afile
190$   afile=f$search(file)
191$   if afile .eqs. "" .or. afile .eqs. ofile then goto NextEl
192$   if f$cvtime(f$file(afile,"RDT")) .gts. time then goto MakeIt
193$   goto Loop3
194$NextEL:
195$   el=el+1
196$   goto Loop2
197$EndL:
198$   arg=arg+1
199$   if arg .le. 8 then goto Loop
200$   goto Exit
201$
202$MakeIt:
203$   set verify
204$   'p2
205$   vv='f$verify(0)
206$Exit:
207$   if v then set verify
208$ endsubroutine
209