Fix for SF bug #1908890: window title not updated.
[nedit.git] / makefiles / buildvms.com
blobe688dfd673dfd137b316dabeb990acf508fdc14a
1 $! $Id: buildvms.com,v 1.2 2006/09/27 11:51:44 michaelsmith Exp $
2 $!
3 $! VMS procedure to compile and link modules for NEdit
4 $!
5 $!
6 $! In case of problems with the install you might contact me at
7 $! zinser@zinser.no-ip.info(preferred) or
8 $! zinser@sysdev.deutsche-boerse.com (work)
9 $!
10 $! Make procedure history for NEdit
12 $!------------------------------------------------------------------------------
13 $! Version history
14 $! 0.01 20040229 First version to receive a number
15 $! 0.02 20041109 Init s_case for case sensitive shareable images
16 $! 0.03 20041229 Some more config info (tconfig, conf_check_string)
17 $! 0.04 20050105 Add check for MMS/MMK, does not hurt even for pure DCL build
18 $! 0.05 20060105 Merge in improvements by Michael Smith from NEdit CVS
20 $ ON ERROR THEN GOTO err_exit
21 $ true  = 1
22 $ false = 0
23 $ tmpnam = "temp_" + f$getjpi("","pid")
24 $ tt = tmpnam + ".txt"
25 $ tc = tmpnam + ".c"
26 $ th = tmpnam + ".h"
27 $ define tconfig 'th'
28 $ its_decc = false
29 $ its_vaxc = false
30 $ its_gnuc = false
31 $ s_case   = False
32 $ ver_no   = ""
34 $! Setup variables holding "config" information
36 $ Make    = ""
37 $ ccopt   = ""
38 $ lopts   = ""
39 $ dnsrl   = ""
40 $ aconf_in_file = "config.hin"
41 $ conf_check_string = ""
42 $ name    = "NEdit"
44 $ gosub find_ver
46 $ whoami = f$parse(f$enviornment("Procedure"),,,,"NO_CONCEAL")
47 $ mydef  = F$parse(whoami,,,"DEVICE")
48 $ mydir  = f$parse(whoami,,,"DIRECTORY") - "]["
49 $ myproc = f$parse(whoami,,,"Name") + f$parse(whoami,,,"type")
50 $ xmldir = mydef + mydir - ".MAKEFILES]" + ".MICROLINE.XML]"
51 $ startdir = mydef + mydir - ".MAKEFILES]" +"]"
52 $ target   = ""
54 $! Check for MMK/MMS
56 $ If F$Search ("Sys$System:MMS.EXE") .nes. "" Then Make = "MMS"
57 $ If F$Type (MMK) .eqs. "STRING" Then Make = "MMK"
59 $ gosub check_opts
61 $! Default is to build NEdit. 
62 $! If requested do cleanup, create dist, then exit
64 $ if (target .nes. "")
65 $ then
66 $   gosub 'target'
67 $   exit
68 $ endif
69 $ gosub check_compiler
71 $ if (its_decc) then ccopt = ccopt + "/prefix=all"
72 $ if f$length(make) .gt. 0
73 $ then
74 $   gosub crea_mms
75 $   set def [.util]
76 $   'make'
77 $   set def [-.microline.xml]
78 $   'make'
79 $   set def [--.xlt]
80 $   'make'
81 $   set def [-.source]
82 $   'make'
83 $   set def [-]
84 $ else
85 $   DEFINE SYS DECC$LIBRARY_INCLUDE
86 $   DEFINE XM DECW$INCLUDE
87 $   DEFINE X11 DECW$INCLUDE
88 $   DEFINE XML 'xmldir'
89 $   set def [.util]
90 $   if f$search("LIBNUTIL.OLB") .eqs. "" then library/create/object libNUtil.olb
91 $   if f$search("VMSUTILS.OLB") .eqs. "" then library/create/object vmsutils.olb
92 $   cflags = ccopt
93 $   call COMPILE CLEARCASE   libNUtil                                             
94 $   call COMPILE DIALOGF     libNUtil                                             
95 $   call COMPILE FILEUTILS   libNUtil                                     
96 $   call COMPILE GETFILES    libNUtil                                             
97 $   call COMPILE MISC        libNUtil                                     
98 $   call COMPILE PREFFILE    libNUtil                                             
99 $   call COMPILE PRINTUTILS  libNUtil                                     
100 $   call COMPILE FONTSEL     libNUtil                                             
101 $   call COMPILE MANAGEDLIST libNUtil                                     
102 $   call COMPILE MOTIF       libNUtil                                     
103 $   call COMPILE UTILS       libNUtil                                     
104 $   call COMPILE VMSUTILS    vmsutils                                             
105 $   set def [-.microline.xml]
106 $   if f$search("libXmL.OLB") .eqs. "" then library/create/object libXmL.olb
107 $   call COMPILE Folder   libXmL
108 $   call COMPILE Grid     libXmL
109 $   call COMPILE GridUtil libXmL
110 $   call COMPILE Progress libXmL
111 $   call COMPILE Tree     libXmL
112 $   call COMPILE XmL      libXmL
113 $   set def [--.xlt]
114 $   cflags = ccopt + "/include=[]"
115 $   if f$search("libXlt.OLB") .eqs. "" then library/create/object libXlt.olb
116 $   call COMPILE BubbleButton libXlt
117 $   call COMPILE SlideC       libXlt
118 $   set def [-.source]
119 $   cflags = ccopt + "/DEFINE=(USE_ACCESS)/include=[-.xlt]"
120 $   call COMPILE SELECTION
121 $   call COMPILE FILE
122 $   call COMPILE HELP
123 $   call COMPILE MENU
124 $   call COMPILE NEDIT
125 $   call COMPILE PREFERENCES
126 $   call COMPILE REGULAREXP
127 $   call COMPILE SEARCH
128 $   call COMPILE SHIFT
129 $   call COMPILE TAGS
130 $   call COMPILE UNDO
131 $   call COMPILE WINDOW
132 $   call COMPILE USERCMDS
133 $   call COMPILE MACRO
134 $   call COMPILE TEXT
135 $   call COMPILE TEXTSEL
136 $   call COMPILE TEXTDISP
137 $   call COMPILE TEXTBUF
138 $   call COMPILE TEXTDRAG
139 $   call COMPILE SERVER
140 $   call COMPILE HIGHLIGHT
141 $   call COMPILE HIGHLIGHTDATA
142 $   call COMPILE INTERPRET
143 $   call COMPILE SMARTINDENT
144 $   call COMPILE REGEXCONVERT
145 $   call COMPILE RBTREE
146 $   call COMPILE WINDOWTITLE
147 $   call COMPILE LINKDATE
148 $   call COMPILE CALLTIPS
149 $   call COMPILE RANGESET
150 $   call COMPILE SERVER_COMMON
151 $   !
152 $   if f$search("PARSE.C") .nes. "" then DELETE PARSE.C;*
153 $   COPY PARSE_NOYACC.C PARSE.C
154 $   call COMPILE PARSE
155 $   !
156 $   call COMPILE NC
157 $   OBJS :=       nedit, file, menu, window, selection, search, undo, shift, -
158           help, preferences, tags, userCmds, regularExp, macro, text, -
159           textSel, textDisp, textBuf, textDrag, server, highlight, -
160           highlightData, interpret, parse, smartIndent, regexconvert, -
161           rbTree, windowtitle, linkdate, calltips, rangeset, server_common
163 $   LINK 'lopts' 'OBJS', NEDIT_OPTIONS_FILE/OPT, -
164                           [-.microline.xml]libxml/lib, [-.xlt]libXlt/lib, -
165                           [-.util]vmsUtils/lib, libNUtil/lib
166 $   LINK 'lopts' nc, server_common.obj, NEDIT_OPTIONS_FILE/OPT, -
167                           [-.util]vmsUtils/lib, libNUtil/lib
168 $   set def 'startdir'
169 $ endif
170 $ if f$type(dnrsl) .eqs. "STRING" then -
171     define decc$no_rooted_search_lists 'dnrsl'
172 $ exit
173 $CC_ERR:
174 $ write sys$output "C compiler required to build ''name'"
175 $ goto err_exit
176 $ERR_EXIT:
177 $ if f$type(dnrsl) .eqs. "STRING" then -
178     define decc$no_rooted_search_lists 'dnrsl'
179 $ close/nolog ver_h
180 $ write sys$output "Error building ''name'. Exiting..."
181 $ exit 2
182 $!------------------------------------------------------------------------------
184 $! If MMS/MMK are available dump out the descrip.mms if required
186 $CREA_MMS:
187 $ write sys$output "Creating [.util]descrip.mms..."
188 $ create [.util]descrip.mms
189 $ open/append out [.util]descrip.mms
190 $ write out "CFLAGS=", ccopt
191 $ copy sys$input: out
192 $ deck
193 CC=cc
194 AR=lib
195 .FIRST
196         DEFINE SYS DECC$LIBRARY_INCLUDE
197         DEFINE XM DECW$INCLUDE
198         DEFINE X11 DECW$INCLUDE
200 OBJS = clearcase.obj, DialogF.obj, getfiles.obj, printUtils.obj, misc.obj,\
201        fileUtils.obj, prefFile.obj, fontsel.obj, managedlist.obj, utils.obj,\
202        motif.obj
204 all : libNUtil.olb VMSUTILS.olb
205         sh def
207 libNUtil.olb : $(OBJS)
208         $(AR) /CREATE/OBJ libNUtil.olb $(OBJS)
210 VMSUTILS.olb : VMSUTILS.obj
211         $(AR) /CREATE/OBJ VMSUTILS VMSUTILS
212 $ eod
213 $ close out
214 $ write sys$output "Creating [.microline.xml]descrip.mms..."
215 $ create [.microline.xml]descrip.mms
216 $ open/append out [.microline.xml]descrip.mms
217 $ write out "CFLAGS=", ccopt
218 $ copy sys$input: out
219 $ deck
220 CC=cc
221 AR=lib
222 .FIRST
223         DEFINE SYS DECC$LIBRARY_INCLUDE
224         DEFINE XM DECW$INCLUDE
225         DEFINE X11 DECW$INCLUDE
226 $ eod
227 $ write out "        DEFINE XML ", xmldir
228 $ copy sys$input: out
229 $ deck
231 OBJS =  Folder.obj, Grid.obj, GridUtil.obj, Progress.obj, Tree.obj, XmL.obj
233 all : libXmL.olb
234         sh def
236 libXmL.olb : $(OBJS)
237         $(AR) /CREATE/OBJ libXmL.olb $(OBJS)
238 $ eod
239 $ close out
240 $ write sys$output "Creating [.xlt]descrip.mms..."
241 $ create [.xlt]descrip.mms
242 $ open/append out [.xlt]descrip.mms
243 $ write out "CFLAGS=", ccopt, "/include=[]" 
244 $ copy sys$input: out
245 $ deck
246 CC=cc
247 AR=lib
249 .FIRST
250         DEFINE SYS DECC$LIBRARY_INCLUDE
251         DEFINE XM DECW$INCLUDE
252         DEFINE X11 DECW$INCLUDE
254 OBJS = BubbleButton.obj, SlideC.obj
256 all : libXlt.olb
257         sh def
259 libXlt.olb : $(OBJS)
260         $(AR) /CREATE/OBJ libXlt.olb $(OBJS)
261 $ eod
262 $ close out
263 $ write sys$output "Creating [.source]descrip.mms..."
264 $ create [.source]descrip.mms
265 $ open/append out [.source]descrip.mms
266 $ write out "CFLAGS=", ccopt, "/define=(USE_ACCESS)/include=[-.xlt]"
267 $ write out "LFLAGS=", lopts
268 $ copy sys$input: out
269 $ deck
271 # Makefile for VMS/MMS
274 CC=cc
276 .FIRST
277         DEFINE SYS DECC$LIBRARY_INCLUDE
278         DEFINE XM DECW$INCLUDE
279         DEFINE X11 DECW$INCLUDE
280 $ eod
281 $ write out "        DEFINE XML ", xmldir
282 $ copy sys$input: out
283 $ deck
284         copy parse_noyacc.c parse.c
286 SRCS =  nedit.c selection.c file.c help.c menu.c preferences.c regularExp.c\
287         search.c shift.c tags.c undo.c window.c userCmds.c macro.c text.c\
288         textSel.c textDisp.c textBuf.c textDrag.c server.c highlight.c\
289         highlightData.c interpret.c smartIndent.c parse.c nc.c regexconvert.c\
290         rbtree.c linkdate.c windowTitle.c calltips.c\
291         rangeset.c, server_common.c
293 OBJS =  selection.obj, file.obj, help.obj, menu.obj, preferences.obj, \
294         regularExp.obj, search.obj, shift.obj, tags.obj, undo.obj, window.obj,\
295         userCmds.obj, macro.obj, text.obj, textSel.obj, textDisp.obj,\
296         textBuf.obj, textDrag.obj, server.obj, highlight.obj,\
297         highlightData.obj, interpret.obj, smartIndent.obj, parse.obj,\
298         regexconvert.obj, rbtree.obj, linkdate.obj, windowTitle.obj, \
299         calltips.obj, rangeset.obj, server_common.obj
301 NEOBJS = nedit.obj
303 NCOBJS = nc.obj
305 all : nedit.exe nc.exe
306       @ write sys$output "Nedit build completed"
308 nedit.exe : $(NEOBJS) $(OBJS)
309         link/exe=nedit.exe  $(NEOBJS),$(OBJS), NEDIT_OPTIONS_FILE/OPT, -
310         [-.microline.xml]libxml/lib, [-.xlt]libXlt/lib, -
311         [-.util]vmsUtils/lib, libNUtil.olb/lib
313 nc.exe : $(NCOBJS)
314         LINK $(NCOBJS), NEDIT_OPTIONS_FILE/OPT, -
315         [-.util]vmsUtils/lib,libNUtil.olb/lib
316 $ eod
317 $ close out
318 $ return
319 $!------------------------------------------------------------------------------
321 $! Check command line options and set symbols accordingly
323 $!------------------------------------------------------------------------------
324 $! Version history
325 $! 0.01 20041206 First version to receive a number
326 $ CHECK_OPTS:
327 $ i = 1
328 $ OPT_LOOP:
329 $ if i .lt. 9
330 $ then
331 $   cparm = f$edit(p'i',"upcase")
333 $! Check if parameter actually contains something
335 $   if f$edit(cparm,"trim") .nes. ""
336 $   then
337 $     if cparm .eqs. "DEBUG"
338 $     then
339 $       ccopt = ccopt + "/noopt/deb"
340 $       lopts = lopts + "/deb"
341 $     endif
342 $     if f$locate("CCOPT=",cparm) .lt. f$length(cparm)
343 $     then
344 $       start = f$locate("=",cparm) + 1
345 $       len   = f$length(cparm) - start
346 $       ccopt = ccopt + f$extract(start,len,cparm)
347 $       if f$locate("AS_IS",f$edit(ccopt,"UPCASE")) .lt. f$length(ccopt) -
348           then s_case = true
349 $     endif
350 $     if cparm .eqs. "LINK" then linkonly = true
351 $     if f$locate("LOPTS=",cparm) .lt. f$length(cparm)
352 $     then
353 $       start = f$locate("=",cparm) + 1
354 $       len   = f$length(cparm) - start
355 $       lopts = lopts + f$extract(start,len,cparm)
356 $     endif
357 $     if f$locate("CC=",cparm) .lt. f$length(cparm)
358 $     then
359 $       start  = f$locate("=",cparm) + 1
360 $       len    = f$length(cparm) - start
361 $       cc_com = f$extract(start,len,cparm)
362         if (cc_com .nes. "DECC") .and. -
363            (cc_com .nes. "VAXC") .and. -
364            (cc_com .nes. "GNUC")
365 $       then
366 $         write sys$output "Unsupported compiler choice ''cc_com' ignored"
367 $         write sys$output "Use DECC, VAXC, or GNUC instead"
368 $       else
369 $         if cc_com .eqs. "DECC" then its_decc = true
370 $         if cc_com .eqs. "VAXC" then its_vaxc = true
371 $         if cc_com .eqs. "GNUC" then its_gnuc = true
372 $       endif
373 $     endif
374 $     if f$locate("MAKE=",cparm) .lt. f$length(cparm)
375 $     then
376 $       start  = f$locate("=",cparm) + 1
377 $       len    = f$length(cparm) - start
378 $       mmks = f$extract(start,len,cparm)
379 $       if (mmks .eqs. "MMK") .or. (mmks .eqs. "MMS")
380 $       then
381 $         make = mmks
382 $       else
383 $         write sys$output "Unsupported make choice ''mmks' ignored"
384 $         write sys$output "Use MMK or MMS instead"
385 $       endif
386 $     endif
387 $     if cparm .eqs. "CLEAN" then target = "CLEAN"
388 $     if cparm .eqs. "DISTBIN" then target = "DISTBIN"
389 $   endif
390 $   i = i + 1
391 $   goto opt_loop
392 $ endif
393 $ return
394 $!------------------------------------------------------------------------------
396 $! Look for the compiler used
398 $! Version history
399 $! 0.01 20040223 First version to receive a number
400 $! 0.02 20040229 Save/set value of decc$no_rooted_search_lists
401 $CHECK_COMPILER:
402 $ if (.not. (its_decc .or. its_vaxc .or. its_gnuc))
403 $ then
404 $   its_decc = (f$search("SYS$SYSTEM:DECC$COMPILER.EXE") .nes. "")
405 $   its_vaxc = .not. its_decc .and. (F$Search("SYS$System:VAXC.Exe") .nes. "")
406 $   its_gnuc = .not. (its_decc .or. its_vaxc) .and. (f$trnlnm("gnu_cc") .nes. "")
407 $ endif
409 $! Exit if no compiler available
411 $ if (.not. (its_decc .or. its_vaxc .or. its_gnuc))
412 $ then goto CC_ERR
413 $ else
414 $   if its_decc
415 $   then
416 $     write sys$output "CC compiler check ... Compaq C"
417 $     if f$trnlnm("decc$no_rooted_search_lists") .nes. ""
418 $     then
419 $       dnrsl = f$trnlnm("decc$no_rooted_search_lists")
420 $     endif
421 $     define decc$no_rooted_search_lists 1
422 $   else
423 $     if its_vaxc then write sys$output "CC compiler check ... VAX C"
424 $     if its_gnuc then write sys$output "CC compiler check ... GNU C"
425 $     if f$trnlnm(topt) then write topt "sys$share:vaxcrtl.exe/share"
426 $     if f$trnlnm(optf) then write optf "sys$share:vaxcrtl.exe/share"
427 $   endif
428 $ endif
429 $ return
430 $!------------------------------------------------------------------------------
432 $! Cleanup files created during compilation
434 $CLEAN:
435 $ delete/noconfirm/log [.util]*.obj;*,[.util]*.olb;*,[.util]*.mms;*
436 $ delete/noconfirm/log [.Xlt]*.obj;*,[.Xlt]*.olb;*,[.Xlt]*.mms;*
437 $ delete/noconfirm/log [.Microline.XmL]*.obj;*,[.Microline.XmL]*.olb;*,-
438                        [.Microline.XmL]*.mms;*
439 $ delete/noconfirm/log [.source]*.obj;*,[.source]*.exe;*,[.source]*.mms;*
440 $ return
441 $!------------------------------------------------------------------------------
443 $! Create backup saveset with binaries and other files needed to run NEdit
445 $DISTBIN:
446 $ on error then continue
447 $ arch = f$getsyi("arch_name")
448 $ name_ver = -
449         f$fao("!AS!AS_!AS",name,f$element(0,".",ver_no),f$element(0,".",ver_no))
450 $ purge/log [...]
451 $ delete 'name_ver'-vms-'arch'.bck;*
452 $ create/directory [.'name_ver']
453 $ set protection=w:rwed [-.'name_ver'...]*.*;*
454 $ delete [.'name_ver'...]*.*;*
455 $ delete [.'name_ver'...]*.*;*
456 $ delete [.'name_ver'...]*.*;*
457 $ delete [.'name_ver'...]*.*;*
458 $ delete [.'name_ver'...]*.*;*
459 $ delete [.'name_ver']*.*;*
460 $ create/directory [.'name_ver']
461 $ copy [.source]nedit.exe [.'name_ver']
462 $ copy [.source]nc.exe    [.'name_ver']
463 $ copy README             [.'name_ver']
464 $ copy COPYRIGHT          [.'name_ver']
465 $ copy ReleaseNotes       [.'name_ver']
466 $ copy [.doc]NEDIT.DOC    [.'name_ver']
467 $ copy [.doc]NEDIT.HTML   [.'name_ver']
468 $ copy [.doc]NEDIT.MAN    [.'name_ver']
469 $ copy [.doc]NC.MAN       [.'name_ver']
470 $ copy [.doc]FAQ.TXT      [.'name_ver']
471 $ backup/log [.'name_ver'...] 'name_ver'-vms-'arch'.bck/save_set
472 $ return
473 $!------------------------------------------------------------------------------
475 $! Check and find version of NEdit
477 $FIND_VER:
478 $ open/read ver_h [.source]help_data.h
479 $FVLOOP:
480 $ read/end=end_fvloop ver_h line
481 $ if f$locate("NEditVersion",line) .nes. f$length(line)
482 $ then
483 $  ver_no = f$element(0,"\",f$element(1," ",f$element(1,"""",line)))
484 $  goto end_fvloop
485 $ endif
486 $ goto fvloop
487 $END_FVLOOP:
488 $ close ver_h
489 $ return
490 $!------------------------------------------------------------------------------
492 $! Subroutine to compile a source file
494 $compile: subroutine
495 $ crdt = F$CVTIME(F$FILE_ATTRIBUTES("''p1'.c","RDT"))
496 $ ordt = ""
497 $ if f$search("''p1'.obj") .nes. "" then - 
498      ordt = F$CVTIME(F$FILE_ATTRIBUTES("''p1'.obj","RDT"))
499 $ if "''crdt'" .gts. "''ordt'"
500 $ then
501 $   write sys$output "Compiling ", p1
502 $   cc 'cflags' /object='p1' 'p1'.c
503 $   if p2 .nes."" then  library/replace/object 'p2'.olb 'p1'.obj
504 $ endif
505 $ exit
506 $ endsubroutine
507 $!------------------------------------------------------------------------------