1 $! make libz under VMS written by
4 $! In case of problems with the install you might contact me at
5 $! zinser@zinser.no-ip.info(preferred) or
6 $! zinser@sysdev.deutsche-boerse.com (work)
8 $! Make procedure history for Zlib
10 $!------------------------------------------------------------------------------
12 $! 0.01 20060120 First version to receive a number
14 $ on error then goto err_exit
17 $! Just some general constants...
21 $ tmpnam = "temp_" + f$getjpi("","pid")
27 $! Setup variables holding "config" information
32 $ v_string = "ZLIB_VERSION"
38 $ optfile = name + ".opt"
39 $ axp = f$getsyi("HW_MODEL").ge.1024
43 $ If F$Search ("Sys$System:MMS.EXE") .nes. "" Then Make = "MMS"
44 $ If F$Type (MMK) .eqs. "STRING" Then Make = "MMK"
51 $! Look for the compiler used
53 $ gosub check_compiler
56 $ ccopt = "/prefix=all" + ccopt
57 $ if f$trnlnm("SYS") .eqs. ""
61 $ define sys sys$library:
63 $ ccopt = "/decc" + ccopt
64 $ define sys decc$library_include:
68 $ if its_vaxc .or. its_gnuc
70 $ if f$trnlnm("SYS").eqs."" then define sys sys$library:
73 $! Build the thing plain or with mms
75 $ write sys$output "Compiling Zlib sources ..."
78 $ dele example.obj;*,minigzip.obj;*
79 $ CALL MAKE adler32.OBJ "CC ''CCOPT' adler32" -
80 adler32.c zlib.h zconf.h
81 $ CALL MAKE compress.OBJ "CC ''CCOPT' compress" -
82 compress.c zlib.h zconf.h
83 $ CALL MAKE crc32.OBJ "CC ''CCOPT' crc32" -
84 crc32.c zlib.h zconf.h
85 $ CALL MAKE deflate.OBJ "CC ''CCOPT' deflate" -
86 deflate.c deflate.h zutil.h zlib.h zconf.h
87 $ CALL MAKE gzio.OBJ "CC ''CCOPT' gzio" -
88 gzio.c zutil.h zlib.h zconf.h
89 $ CALL MAKE infback.OBJ "CC ''CCOPT' infback" -
90 infback.c zutil.h inftrees.h inflate.h inffast.h inffixed.h
91 $ CALL MAKE inffast.OBJ "CC ''CCOPT' inffast" -
92 inffast.c zutil.h zlib.h zconf.h inffast.h
93 $ CALL MAKE inflate.OBJ "CC ''CCOPT' inflate" -
94 inflate.c zutil.h zlib.h zconf.h infblock.h
95 $ CALL MAKE inftrees.OBJ "CC ''CCOPT' inftrees" -
96 inftrees.c zutil.h zlib.h zconf.h inftrees.h
97 $ CALL MAKE trees.OBJ "CC ''CCOPT' trees" -
98 trees.c deflate.h zutil.h zlib.h zconf.h
99 $ CALL MAKE uncompr.OBJ "CC ''CCOPT' uncompr" -
100 uncompr.c zlib.h zconf.h
101 $ CALL MAKE zutil.OBJ "CC ''CCOPT' zutil" -
102 zutil.c zutil.h zlib.h zconf.h
103 $ write sys$output "Building Zlib ..."
104 $ CALL MAKE libz.OLB "lib/crea libz.olb *.obj" *.OBJ
105 $ write sys$output "Building example..."
106 $ CALL MAKE example.OBJ "CC ''CCOPT' example" -
107 example.c zlib.h zconf.h
108 $ call make example.exe "LINK example,libz.olb/lib" example.obj libz.olb
109 $ if f$search("x11vms:xvmsutils.olb") .nes. ""
111 $ write sys$output "Building minigzip..."
112 $ CALL MAKE minigzip.OBJ "CC ''CCOPT' minigzip" -
113 minigzip.c zlib.h zconf.h
114 $ call make minigzip.exe -
115 "LINK minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib" -
116 minigzip.obj libz.olb
120 $ write sys$output "Make ''name' ''version' with ''Make' "
124 $! Alpha gets a shareable image
129 $ write sys$output "Creating libzshr.exe"
130 $ call anal_obj_axp modules.opt _link.opt
133 $ open/append optf modules.opt
134 $ write optf "case_sensitive=YES"
137 $ LINK_'lopts'/SHARE=libzshr.exe modules.opt/opt,_link.opt/opt
139 $ write sys$output "Zlib build completed"
142 $ write sys$output "C compiler required to build ''name'"
145 $ set message/facil/ident/sever/text
147 $ write sys$output "Exiting..."
151 $MAKE: SUBROUTINE !SUBROUTINE TO CHECK DEPENDENCIES
153 $! P1 = What we are trying to make
154 $! P2 = Command to make it
155 $! P3 - P8 What it depends on
157 $ If F$Search(P1) .Eqs. "" Then Goto Makeit
158 $ Time = F$CvTime(F$File(P1,"RDT"))
162 $ If Argument .Eqs. "" Then Goto Exit
165 $ File = F$Element(El," ",Argument)
166 $ If File .Eqs. " " Then Goto Endl
170 $ AFile = F$Search(File)
171 $ If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl
172 $ If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit
179 $ If arg .Le. 8 Then Goto Loop
184 $ write sys$output P2
188 $ If V Then Set Verify
190 $!------------------------------------------------------------------------------
192 $! Check command line options and set symbols accordingly
199 $ cparm = f$edit(p'i',"upcase")
200 $ if cparm .eqs. "DEBUG"
202 $ ccopt = ccopt + "/noopt/deb"
203 $ lopts = lopts + "/deb"
205 $ if f$locate("CCOPT=",cparm) .lt. f$length(cparm)
207 $ start = f$locate("=",cparm) + 1
208 $ len = f$length(cparm) - start
209 $ ccopt = ccopt + f$extract(start,len,cparm)
210 $ if f$locate("AS_IS",f$edit(ccopt,"UPCASE")) .lt. f$length(ccopt) -
213 $ if cparm .eqs. "LINK" then linkonly = true
214 $ if f$locate("LOPTS=",cparm) .lt. f$length(cparm)
216 $ start = f$locate("=",cparm) + 1
217 $ len = f$length(cparm) - start
218 $ lopts = lopts + f$extract(start,len,cparm)
220 $ if f$locate("CC=",cparm) .lt. f$length(cparm)
222 $ start = f$locate("=",cparm) + 1
223 $ len = f$length(cparm) - start
224 $ cc_com = f$extract(start,len,cparm)
225 if (cc_com .nes. "DECC") .and. -
226 (cc_com .nes. "VAXC") .and. -
227 (cc_com .nes. "GNUC")
229 $ write sys$output "Unsupported compiler choice ''cc_com' ignored"
230 $ write sys$output "Use DECC, VAXC, or GNUC instead"
232 $ if cc_com .eqs. "DECC" then its_decc = true
233 $ if cc_com .eqs. "VAXC" then its_vaxc = true
234 $ if cc_com .eqs. "GNUC" then its_gnuc = true
237 $ if f$locate("MAKE=",cparm) .lt. f$length(cparm)
239 $ start = f$locate("=",cparm) + 1
240 $ len = f$length(cparm) - start
241 $ mmks = f$extract(start,len,cparm)
242 $ if (mmks .eqs. "MMK") .or. (mmks .eqs. "MMS")
246 $ write sys$output "Unsupported make choice ''mmks' ignored"
247 $ write sys$output "Use MMK or MMS instead"
254 $!------------------------------------------------------------------------------
256 $! Look for the compiler used
259 $! 0.01 20040223 First version to receive a number
260 $! 0.02 20040229 Save/set value of decc$no_rooted_search_lists
262 $ if (.not. (its_decc .or. its_vaxc .or. its_gnuc))
264 $ its_decc = (f$search("SYS$SYSTEM:DECC$COMPILER.EXE") .nes. "")
265 $ its_vaxc = .not. its_decc .and. (F$Search("SYS$System:VAXC.Exe") .nes. "")
266 $ its_gnuc = .not. (its_decc .or. its_vaxc) .and. (f$trnlnm("gnu_cc") .nes. "")
269 $! Exit if no compiler available
271 $ if (.not. (its_decc .or. its_vaxc .or. its_gnuc))
276 $ write sys$output "CC compiler check ... Compaq C"
277 $ if f$trnlnm("decc$no_rooted_search_lists") .nes. ""
279 $ dnrsl = f$trnlnm("decc$no_rooted_search_lists")
281 $ define decc$no_rooted_search_lists 1
283 $ if its_vaxc then write sys$output "CC compiler check ... VAX C"
284 $ if its_gnuc then write sys$output "CC compiler check ... GNU C"
285 $ if f$trnlnm(topt) then write topt "sys$share:vaxcrtl.exe/share"
286 $ if f$trnlnm(optf) then write optf "sys$share:vaxcrtl.exe/share"
290 $!------------------------------------------------------------------------------
292 $! If MMS/MMK are available dump out the descrip.mms if required
295 $ write sys$output "Creating descrip.mms..."
297 $ open/append out descrip.mms
298 $ copy sys$input: out
300 # descrip.mms: MMS description file for building zlib on VMS
301 # written by Martin P.J. Zinser
302 # <zinser@zinser.no-ip.info or zinser@sysdev.deutsche-boerse.com>
304 OBJS = adler32.obj, compress.obj, crc32.obj, gzio.obj, uncompr.obj, infback.obj\
305 deflate.obj, trees.obj, zutil.obj, inflate.obj, \
306 inftrees.obj, inffast.obj
309 $ write out "CFLAGS=", ccopt
310 $ write out "LOPTS=", lopts
311 $ copy sys$input: out
314 all : example.exe minigzip.exe libz.olb
315 @ write sys$output " Example applications available"
317 libz.olb : libz.olb($(OBJS))
318 @ write sys$output " libz available"
320 example.exe : example.obj libz.olb
321 link $(LOPTS) example,libz.olb/lib
323 minigzip.exe : minigzip.obj libz.olb
324 link $(LOPTS) minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib
327 delete *.obj;*,libz.olb;*,*.opt;*,*.exe;*
330 # Other dependencies.
331 adler32.obj : adler32.c zutil.h zlib.h zconf.h
332 compress.obj : compress.c zlib.h zconf.h
333 crc32.obj : crc32.c zutil.h zlib.h zconf.h
334 deflate.obj : deflate.c deflate.h zutil.h zlib.h zconf.h
335 example.obj : example.c zlib.h zconf.h
336 gzio.obj : gzio.c zutil.h zlib.h zconf.h
337 inffast.obj : inffast.c zutil.h zlib.h zconf.h inftrees.h inffast.h
338 inflate.obj : inflate.c zutil.h zlib.h zconf.h
339 inftrees.obj : inftrees.c zutil.h zlib.h zconf.h inftrees.h
340 minigzip.obj : minigzip.c zlib.h zconf.h
341 trees.obj : trees.c deflate.h zutil.h zlib.h zconf.h
342 uncompr.obj : uncompr.c zlib.h zconf.h
343 zutil.obj : zutil.c zutil.h zlib.h zconf.h
344 infback.obj : infback.c zutil.h inftrees.h inflate.h inffast.h inffixed.h
348 $!------------------------------------------------------------------------------
350 $! Read list of core library sources from makefile.in and create options
351 $! needed to build shareable image
354 $ open/read min makefile.in
355 $ open/write mod modules.opt
356 $ src_check = "OBJS ="
358 $ read/end=mrdone min rec
359 $ if (f$extract(0,6,rec) .nes. src_check) then goto mrloop
360 $ rec = rec - src_check
362 $ if (f$element(1,"\",rec) .eqs. "\") then goto mrdone
364 $ read/end=mrdone min rec
366 $ if (f$element(1,"\",rec) .nes. "\") then goto mrsloop
371 $!------------------------------------------------------------------------------
373 $! Take record extracted in crea_olist and split it into single filenames
376 $ myrec = f$edit(rec - "\", "trim,compress")
379 $ srcfil = f$element(i," ", myrec)
380 $ if (srcfil .nes. " ")
382 $ write mod f$parse(srcfil,,,"NAME"), ".obj"
387 $!------------------------------------------------------------------------------
389 $! Find current Zlib version number
392 $ open/read h_in 'v_file'
394 $ read/end=hdone h_in rec
395 $ rec = f$edit(rec,"TRIM")
396 $ if (f$extract(0,1,rec) .nes. "#") then goto hloop
397 $ rec = f$edit(rec - "#", "TRIM")
398 $ if f$element(0," ",rec) .nes. "define" then goto hloop
399 $ if f$element(1," ",rec) .eqs. v_string
401 $ version = 'f$element(2," ",rec)'
408 $!------------------------------------------------------------------------------
410 $! Analyze Object files for OpenVMS AXP to extract Procedure and Data
411 $! information to build a symbol vector for a shareable image
412 $! All the "brains" of this logic was suggested by Hartmut Becker
413 $! (Hartmut.Becker@compaq.com). All the bugs were introduced by me
414 $! (zinser@zinser.no-ip.info), so if you do have problem reports please do not
415 $! bother Hartmut/HP, but get in touch with me
418 $! 0.01 20040406 Skip over shareable images in option file
419 $! 0.02 20041109 Fix option file for shareable images with case_sensitive=YES
420 $! 0.03 20050107 Skip over Identification labels in option file
421 $! 0.04 20060117 Add uppercase alias to code compiled with /name=as_is
423 $ ANAL_OBJ_AXP: Subroutine
425 $ SAY := "WRITE_ SYS$OUTPUT"
427 $ IF F$SEARCH("''P1'") .EQS. ""
429 $ SAY "ANAL_OBJ_AXP-E-NOSUCHFILE: Error, inputfile ''p1' not available"
432 $ IF "''P2'" .EQS. ""
434 $ SAY "ANAL_OBJ_AXP: Error, no output file provided"
440 $ open/append atmp a.tmp
442 $ read/end=end_loop in line
443 $ if f$locate("/SHARE",f$edit(line,"upcase")) .lt. f$length(line)
445 $ write sys$output "ANAL_SKP_SHR-i-skipshare, ''line'"
448 $ if f$locate("IDENTIFICATION=",f$edit(line,"upcase")) .lt. f$length(line)
450 $ write sys$output "ANAL_OBJ_AXP-i-ident: Identification ", -
451 f$element(1,"=",line)
457 $ write sys$output "ANAL_OBJ_AXP-w-nosuchfile, ''line'"
460 $ define/user sys$output nl:
461 $ define/user sys$error nl:
462 $ anal/obj/gsd 'f /out=x.tmp
463 $ open/read xtmp x.tmp
465 $ read/end=end_xloop xtmp xline
466 $ xline = f$edit(xline,"compress")
475 $ if f$search("a.tmp") .eqs. "" -
477 $ ! all global definitions
478 $ search a.tmp "symbol:","EGSY$V_DEF 1","EGSY$V_NORM 1"/out=b.tmp
480 $ search b.tmp "EGSY$V_NORM 1"/wind=(0,1) /out=c.tmp
481 $ search c.tmp "symbol:"/out=d.tmp
482 $ define/user sys$output nl:
483 $ edito/edt/command=sys$input d.tmp
484 sub/symbol: "/symbol_vector=(/whole
485 sub/"/=PROCEDURE)/whole
488 $ search b.tmp "EGSY$V_DEF 1"/wind=(0,1) /out=e.tmp
489 $ search e.tmp "symbol:"/out=f.tmp
490 $ define/user sys$output nl:
491 $ edito/edt/command=sys$input f.tmp
492 sub/symbol: "/symbol_vector=(/whole
495 $ sort/nodupl d.tmp,f.tmp g.tmp
496 $ open/read raw_vector g.tmp
497 $ open/write case_vector 'p2'
499 $ read/end=end_rawloop raw_vector raw_element
500 $ write case_vector raw_element
501 $ if f$locate("=PROCEDURE)",raw_element) .lt. f$length(raw_element)
503 $ name = f$element(1,"=",raw_element) - "("
504 $ if f$edit(name,"UPCASE") .nes. name then -
505 write case_vector f$fao(" symbol_vector=(!AS/!AS=PROCEDURE)", -
506 f$edit(name,"UPCASE"), name)
508 $ if f$locate("=DATA)",raw_element) .lt. f$length(raw_element)
510 $ name = f$element(1,"=",raw_element) - "("
511 $ if f$edit(name,"UPCASE") .nes. name then -
512 write case_vector f$fao(" symbol_vector=(!AS/!AS=DATA)", -
513 f$edit(name,"UPCASE"), name)
519 $ delete a.tmp;*,b.tmp;*,c.tmp;*,d.tmp;*,e.tmp;*,f.tmp;*,g.tmp;*
520 $ if f$search("x.tmp") .nes. "" -
521 then $ delete x.tmp;*
524 $ if V then set verify
526 $!------------------------------------------------------------------------------