1$ save_verify='f$verify(0)
2$! set ver
3$!
4$!      Compile and link for xdino
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 + "[]dino.scores" + QUOTE
26$ data = "DATAFILE=" + QUOTE + "[]dino.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 xdino.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 XDino with ''defs'"
101$ call make Dino.obj   "cc Dino.c"   Dino.c DinoP.h Dino.h
102$ call make Dino2d.obj "cc Dino2d.c" Dino2d.c DinoP.h Dino.h Dino2dP.h Dino2d.h
103$ call make Dino3d.obj "cc Dino3d.c" Dino3d.c DinoP.h Dino.h Dino3dP.h Dino3d.h
104$ call make DinoU.obj  "cc DinoU.c"  DinoU.c DinoP.h Dino.h
105$ call make rngs.obj   "cc rngs.c"   rngs.c
106$ call make xdino.obj  "cc xdino.c"  xdino.c Dino.h
107$!
108$! Get libraries
109$ if sys_maj .lt. 7
110$ then
111$   if xvmsutils then write optf "''xvmsutilsf'/lib"
112$ endif
113$! if .not. axp then write optf "sys$library:vaxcrtl/lib"
114$ write optf "sys$library:vaxcrtl/lib"
115$ if axp then write optf "sys$library:ucx$ipc_shr/share"
116$ if axp then write optf "sys$share:decw$xextlibshr/share"
117$ if axp then write optf "sys$share:decw$xtlibshrr5/share"
118$ if .not. axp then write optf "sys$library:ucx$ipc/lib"
119$! write optf "sys$share:decw$dxmlibshr/share"
120$ write optf "sys$share:decw$xmlibshr12/share"
121$ write optf "sys$share:decw$xlibshr/share"
122$ close optf
123$!
124$! LINK
125$ write sys$output "Linking XDino"
126$ link/map xdino/opt
127$!
128$! Create .opt file
129$ open/write optf xmdino.opt
130$ write sys$output "Compiling XmDino with ''defs'"
131$ call make Dino.obj   "cc Dino.c"   Dino.c DinoP.h Dino.h
132$ call make Dino2d.obj "cc Dino2d.c" Dino2d.c DinoP.h Dino.h Dino2dP.h Dino2d.h
133$ call make Dino3d.obj "cc Dino3d.c" Dino3d.c DinoP.h Dino.h Dino3dP.h Dino3d.h
134$ call make DinoU.obj  "cc DinoU.c"  DinoU.c DinoP.h Dino.h
135$ call make rngs.obj   "cc rngs.c"   rngs.c
136$ call make xmdino.obj "cc xmdino.c" xmdino.c Dino.h
137$! Get libraries
138$! if .not. axp then write optf "sys$library:vaxcrtl/lib"
139$ write optf "sys$library:vaxcrtl/lib"
140$ if axp then write optf "sys$library:ucx$ipc_shr/share"
141$ if axp then write optf "sys$share:decw$xextlibshr/share"
142$ if axp then write optf "sys$share:decw$xtlibshrr5/share"
143$ if .not. axp then write optf "sys$library:ucx$ipc/lib"
144$! write optf "sys$share:decw$dxmlibshr/share"
145$ write optf "sys$share:decw$xmlibshr12/share"
146$ write optf "sys$share:decw$xlibshr/share"
147$ close optf
148$!
149$! LINK
150$ write sys$output "Linking XmDino"
151$ link/map xmdino/opt
152$!
153$ set noverify
154$ exit
155$!
156$Clobber:      ! Delete executables, Purge directory and clean up object files
157$!                and listings
158$ delete/noconfirm/log xdino.exe;*
159$ delete/noconfirm/log xmdino.exe;*
160$!
161$Clean:        ! Purge directory, clean up object files and listings
162$ close/nolog optf
163$ purge
164$ delete/noconfirm/log *.lis;*
165$ delete/noconfirm/log *.obj;*
166$ delete/noconfirm/log *.opt;*
167$ delete/noconfirm/log *.map;*
168$!
169$ exit
170$!
171! SUBROUTINE TO CHECK DEPENDENCIES
172$ make: subroutine
173$   v='f$verify(0)
174$!   p1       What we are trying to make
175$!   p2       Command to make it
176$!   p3 - p8  What it depends on
177$
178$   if (f$extract(0,3,p2) .eqs. "cc ") then write optf "''p1'"
179$   if (f$extract(0,3,p2) .eqs. "CC ") then write optf "''p1'"
180$
181$   if f$search(p1) .eqs. "" then goto MakeIt
182$   time=f$cvtime(f$file(p1,"RDT"))
183$   arg=3
184$Loop:
185$   argument=p'arg
186$   if argument .eqs. "" then goto Exit
187$   el=0
188$Loop2:
189$   file=f$element(el," ",argument)
190$   if file .eqs. " " then goto Endl
191$   afile=""
192$Loop3:
193$   ofile=afile
194$   afile=f$search(file)
195$   if afile .eqs. "" .or. afile .eqs. ofile then goto NextEl
196$   if f$cvtime(f$file(afile,"RDT")) .gts. time then goto MakeIt
197$   goto Loop3
198$NextEL:
199$   el=el+1
200$   goto Loop2
201$EndL:
202$   arg=arg+1
203$   if arg .le. 8 then goto Loop
204$   goto Exit
205$
206$MakeIt:
207$   set verify
208$   'p2
209$   vv='f$verify(0)
210$Exit:
211$   if v then set verify
212$ endsubroutine
213