File: vmsbuild.com

package info (click to toggle)
vile 9.4-s1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 10,448 kB
  • ctags: 7,909
  • sloc: ansic: 85,708; lex: 7,137; sh: 2,992; perl: 2,926; cpp: 2,869; makefile: 750; awk: 271
file content (428 lines) | stat: -rw-r--r-- 12,026 bytes parent folder | download
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
$! $Header: /usr/build/vile/vile/RCS/vmsbuild.com,v 1.42 2004/11/03 23:03:35 tom Exp $
$! VMS build-script for vile.  Requires installed C compiler
$!
$! Screen Configurations
$! ---------------------
$! To build vile, type:
$!        $ @vmsbuild [vile [<compiler> [bld_target]]]
$! To build xvile, type
$!        $ @vmsbuild xvile [<compiler> [bld_target]]
$!
$! where:
$!        <compiler> :== { decc | vaxc }
$!
$! The default compiler on VAX hosts is vaxc, else decc (Alpha hosts).
$!
$! Configuration Note
$! ------------------
$! If you elect to build both vile and xvile from the same source
$! directory, be sure to execute these commands before each build:
$!
$!   $ del *.obj;*
$!   $ del ne*.h;*
$!
$! These commands create a clean build environment for the
$! editor's two different screen configurations (X versus SMG).
$!
$! -----------------------------------------------------------
$ hlp = f$edit("''p1'", "UPCASE")
$ if "''hlp'" .eqs. "HELP" .or. -
        "''hlp'" .eqs. "-H" .or. -
                "''hlp'" .eqs. "-?" .or. -
                        "''hlp'" .eqs. "?" then gosub usage
$ if "''hlp'" .eqs. "" .or. -
     "''hlp'" .eqs. "VILE" .or. -
     "''hlp'" .eqs. "VILE.EXE" .or. -
     "''hlp'" .eqs. "XVILE" .or. -
     "''hlp'" .eqs. "XVILE.EXE" then goto start
$!
$! handle the <bldtarget>
$ gosub 'p1
$ exit
$!
$ start:
$! -----------------------------------------------------------
$! pickup user's compiler choice, if any
$! -----------------------------------------------------------
$!
$ comp = ""
$ using_vaxc = 0
$ if "''p2'" .nes. ""
$ then
$    comp = f$edit(p2, "UPCASE")
$    if "''comp'" .eqs. "VAXC"
$    then
$        gosub vaxc_config
$    else
$        if "''comp'" .eqs. "DECC"
$        then
$            gosub decc_config
$        else
$            gosub usage
$        endif
$    endif
$ endif
$! -----------------------------------------------------------
$!      Build the option-file
$!
$ open/write optf vms_link.opt
$ write optf "Identification=""Vile 9.4k"""
$ write optf "basic.obj"
$ write optf "bind.obj"
$ write optf "btree.obj"
$ write optf "buffer.obj"
$ write optf "csrch.obj"
$ write optf "display.obj"
$ write optf "dumbterm.obj"
$ write optf "eval.obj"
$ write optf "exec.obj"
$ write optf "externs.obj"
$ write optf "fences.obj"
$ write optf "file.obj"
$ write optf "filec.obj"
$ write optf "fileio.obj"
$ write optf "finderr.obj"
$ write optf "glob.obj"
$ write optf "globals.obj"
$ write optf "history.obj"
$ write optf "input.obj"
$ write optf "insert.obj"
$ write optf "itbuff.obj"
$ write optf "isearch.obj"
$ write optf "line.obj"
$ write optf "map.obj"
$ write optf "modes.obj"
$ write optf "msgs.obj"
$ write optf "npopen.obj"
$ write optf "oneliner.obj"
$ write optf "opers.obj"
$ write optf "path.obj"
$ write optf "random.obj"
$ write optf "regexp.obj"
$ write optf "region.obj"
$ write optf "search.obj"
$ write optf "select.obj"
$ write optf "spawn.obj"
$ write optf "statevar.obj"
$ write optf "tags.obj"
$ write optf "tbuff.obj"
$ write optf "termio.obj"
$ write optf "ucrypt.obj"
$ write optf "undo.obj"
$ write optf "version.obj"
$ write optf "vms2unix.obj"
$ write optf "vmspipe.obj"
$ write optf "watch.obj"
$ write optf "window.obj"
$ write optf "word.obj"
$ write optf "wordmov.obj"
$! ----------------------------------
$! Look for the compiler used and specify architecture.
$!
$ CC = "CC"
$ arch = "UNKNOWN"
$!
$ if f$getsyi("ARCH_NAME") .eqs. "Alpha"
$ then
$  arch = "__alpha__=1"
$  if "''comp'" .eqs. "" then gosub decc_config
$ endif
$!
$ if f$getsyi("ARCH_NAME") .eqs. "IA64"
$ then
$  arch = "__ia64__=1"
$  if "''comp'" .eqs. "" then gosub decc_config
$ endif
$!
$ if f$getsyi("ARCH_NAME") .eqs. "VAX"
$ then
$  arch = "__vax__=1"
$  if "''comp'" .nes. "" then goto screen_config
$  if f$search("SYS$SYSTEM:VAXC.EXE").nes.""
$  then
$   gosub vaxc_config
$  else
$   if f$search("SYS$SYSTEM:DECC$COMPILER.EXE").nes.""
$   then
$    gosub decc_config
$   else
$    DEFS = ",HAVE_STRERROR"
$    if f$trnlnm("GNU_CC").eqs.""
$    then
$     write sys$output "C compiler required to rebuild vile"
$     close optf
$     exit
$    else
$     write optf "gnu_cc:[000000]gcclib.olb/lib"
$     comp = "__gcc__=1"
$     CC = "GCC"
$    endif
$   endif
$  endif
$ endif
$
$ if "''arch'" .eqs. "UNKNOWN"
$ then
$   write sys$output "Cannot determine architecture type"
$   exit 1
$ endif
$!
$ screen_config:
$!
$ MKTBLS :== $SYS$DISK:'F$DIRECTORY()MKTBLS.EXE	! make a foreign command
$!
$ if "''p1'" .nes. "XVILE" .and. "''p1'" .nes. "XVILE.EXE"
$  then
$! for regular vile, use these:
$   SCREEN := vmsvt
$   TARGET := vile
$   SCRDEF := "DISP_VMSVT,scrn_chosen"
$   mmstar = "__vile__=1"
$ else
$! for building the X toolkit version:
$   SCREEN := x11
$   TARGET := xvile
$   SCRDEF = "NO_WIDGETS,XTOOLKIT,DISP_X11,scrn_chosen"
$   mmstar = "__xvile__=1"
$!
$!  Find out which X-Version we're running.  This will fail for older
$!  VMS versions (i.e., v5.5-1).  Therefore, choose DECWindows XUI for
$!  default.
$!
$   On Error Then GoTo XUI
$   @sys$update:decw$get_image_version sys$share:decw$xlibshr.exe decw$version
$   if f$extract(4,3,decw$version).eqs."1.0"
$   then
$     write optf "Sys$share:DECW$DWTLIBSHR.EXE/Share"
$   endif
$   if f$extract(4,3,decw$version).eqs."1.1"
$   then
$     write optf "menu.obj"
$     write optf "x11menu.obj"
$     write optf "sys$share:decw$xmlibshr.exe/share"
$     write optf "sys$share:decw$xtshr.exe/share"
$     SCRDEF := "MOTIF_WIDGETS,XTOOLKIT,DISP_X11,scrn_chosen"
$     mmstar = "__xmvile__=1"
$     GoTo MAIN2
$   endif
$   if f$extract(4,3,decw$version).eqs."1.2"
$   then
$     write optf "menu.obj"
$     write optf "x11menu.obj"
$     write optf "sys$share:decw$xmlibshr12.exe/share"
$     write optf "sys$share:decw$xtlibshrr5.exe/share"
$     SCRDEF := "MOTIF_WIDGETS,XTOOLKIT,DISP_X11,scrn_chosen"
$     mmstar = "__xmvile__=1"
$     GoTo MAIN2
$   endif
$   GoTo MAIN
$!
$XUI :
$   write optf "Sys$share:DECW$DWTLIBSHR.EXE/Share"
$!
$MAIN :
$   write optf "sys$share:decw$xtshr.exe/share"
$   write optf "sys$share:decw$xlibshr.exe/share"
$ endif
$!
$MAIN2 :
$ if using_vaxc .eq. 1 then write optf "sys$library:vaxcrtl.exe/share"
$ close optf
$! -------------- vms_link.opt is created -------------
$ if f$edit("''p1'", "UPCASE") .eqs. "VMS_LINK.OPT"
$ then
$!  mms called this script to build vms_link.opt.  all done
$   exit
$ endif
$!
$ if f$search("SYS$SYSTEM:MMS.EXE").eqs.""
$ then
$!  can also use /Debug /Listing, /Show=All
$
$   CFLAGS := 'CFLAGS/Diagnostics /Define=("os_chosen","''SCRDEF'''DEFS'") /Include=([])
$
$  	if "''p3'" .nes. "" then gosub 'p3
$  	if "''p3'" .nes. "" then exit 1
$!
$	gosub all
$!
$  else
$   mms/ignore=warning/macro=('comp','mmstar','arch') 'p3
$  endif
$ exit
$!
$ all:
$	if f$search("mktbls.exe") .eqs. ""
$	then
$		call make mktbls
$		link /exec=mktbls/map/cross mktbls.obj,SYS$LIBRARY:VAXCRTL/LIB
$	endif
$	if f$search("nebind.h") .eqs. "" then mktbls cmdtbl
$	if f$search("nemode.h") .eqs. "" then mktbls modetbl
$!
$	call make main
$	call make 'SCREEN
$	call make basic
$	call make bind
$	call make btree
$	call make buffer
$	call make csrch
$	call make display
$	call make dumbterm
$	call make eval
$	call make exec
$	call make externs
$	call make fences
$	call make file
$	call make filec
$	call make fileio
$	call make finderr
$	call make glob
$	call make globals
$	call make history
$	call make input
$	call make insert
$	call make itbuff
$	call make isearch
$	call make line
$	call make map
$	if "''mmstar'" .eqs. "__xmvile__=1" then call make menu
$	if "''mmstar'" .eqs. "__xmvile__=1" then call make x11menu
$	call make modes
$	call make msgs
$	call make npopen
$	call make oneliner
$	call make opers
$	call make path
$	call make random
$	call make regexp
$	call make region
$	call make search
$	call make select
$	call make spawn
$	call make statevar
$	call make tags
$	call make tbuff
$	call make termio
$	call make ucrypt
$	call make undo
$	call make version
$	call make vms2unix
$	call make vmspipe
$	call make watch
$	call make window
$	call make word
$	call make wordmov
$!
$	link /exec='target/map/cross main.obj, 'SCREEN.obj, vms_link/opt
$	gosub build_last
$	return
$!
$ install:
$	WRITE SYS$ERROR "** no rule for install"
$	gosub build_last
$	return
$!
$ clobber :
$	write sys$output "clobbering build products"
$	if f$search("vile.com") .nes. "" then delete vile.com;*
$	if f$search("xvile.com") .nes. "" then delete xvile.com;*
$	if f$search("*.exe") .nes. "" then delete *.exe;*
$	gosub clean
$	return
$!
$ clean:
$	write sys$output "cleaning build by-products"
$	if f$search("*.obj") .nes. "" then delete *.obj;*
$	if f$search("*.bak") .nes. "" then delete *.bak;*
$	if f$search("*.lis") .nes. "" then delete *.lis;*
$	if f$search("*.log") .nes. "" then delete *.log;*
$	if f$search("*.map") .nes. "" then delete *.map;*
$	if f$search("*.opt") .nes. "" then delete *.opt;*
$	if f$search("ne*.h") .nes. "" then delete ne*.h;*
$	if f$search("$(MKTBLS)") .nes. "" then delete $(MKTBLS);
$	gosub build_last
$	return
$!
$ build_last :
$	if f$search("*.dia") .nes. "" then delete *.dia;*
$	if f$search("*.lis") .nes. "" then purge *.lis
$	if f$search("*.obj") .nes. "" then purge *.obj
$	if f$search("*.map") .nes. "" then purge *.map
$	if f$search("*.opt") .nes. "" then purge *.opt
$	if f$search("*.exe") .nes. "" then purge *.exe
$	if f$search("*.log") .nes. "" then purge *.log
$	return
$!
$ vms_link_opt :
$	exit 1
$!
$! Runs VILE from the current directory (used for testing)
$ vile_com :
$	if "''f$search("vile.com")'" .nes. "" then delete vile.com;*
$	copy nl: vile.com
$	open/append  test_script vile.com
$	write test_script "$ temp = f$environment(""procedure"")"
$	write test_script "$ temp = temp -"
$	write test_script "		- f$parse(temp,,,""version"",""syntax_only"") -"
$	write test_script "		- f$parse(temp,,,""type"",""syntax_only"")"
$	write test_script "$ vile :== $ 'temp'.exe"
$	write test_script "$ define/user_mode sys$input  sys$command"
$	write test_script "$ define/user_mode sys$output sys$command"
$	write test_script "$ vile 'p1 'p2 'p3 'p4 'p5 'p6 'p7 'p8"
$	close test_script
$	write sys$output "** made vile.com"
$	return
$!
$! Runs XVILE from the current directory (used for testing)
$ xvile_com :
$	if "''f$search("xvile.com")'" .nes. "" then delete xvile.com;*
$	copy nl: xvile.com
$	open/append  test_script xvile.com
$	write test_script "$ temp = f$environment(""procedure"")"
$	write test_script "$ temp = temp -"
$	write test_script "		- f$parse(temp,,,""name"",""syntax_only"") -"
$	write test_script "		- f$parse(temp,,,""version"",""syntax_only"") -"
$	write test_script "		- f$parse(temp,,,""type"",""syntax_only"")"
$	write test_script "$ xvile :== $ 'temp'xvile.exe"
$	write test_script "$ define/user_mode sys$input  sys$command"
$	write test_script "$ define/user_mode sys$output sys$command"
$	write test_script "$ xvile 'p1 'p2 'p3 'p4 'p5 'p6 'p7 'p8"
$	close test_script
$	write sys$output "** made xvile.com"
$	return
$!
$ make: subroutine
$	if f$search("''p1'.obj") .eqs. ""
$	then
$		write sys$output "compiling ''p1'"
$		'CC 'CFLAGS 'p1.c
$		if f$search("''p1'.dia") .nes. "" then delete 'p1.dia;*
$	endif
$exit
$	return
$ endsubroutine
$ vaxc_config:
$    comp       = "__vaxc__=1"
$    CFLAGS     = "/VAXC"
$    DEFS       = ",HAVE_STRERROR"
$    using_vaxc = 1
$    if f$trnlnm("SYS") .eqs. "" then define sys sys$library:
$    return
$!
$ decc_config:
$    comp   = "__decc__=1"
$    CFLAGS = "/DECC/prefix=all"
$    DEFS   = ",HAVE_ALARM,HAVE_STRERROR"
$    if f$trnlnm("SYS") .eqs."" then define sys decc$library_include:
$    return
$!
$ usage:
$    write sys$output "usage: "
$    write sys$output "      $ @vmsbuild [vile [{decc | vaxc} [<bldtarget>]]]"
$    write sys$output "                   or"
$    write sys$output "      $ @vmsbuild xvile [{decc | vaxc} [<bldtarget>]]"
$    write sys$output "bldtarget is one of"
$    write sys$output "      all install clobber clean"
$!    write sys$output "      vms_link.opt vile_com xvile_com"
$    exit 2