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
13 $! 0.02 20061008 Adapt to new Makefile.in
15 $ on error then goto err_exit
18 $! Just some general constants...
22 $ tmpnam = "temp_" + f$getjpi("","pid")
28 $! Setup variables holding "config" information
33 $ v_string = "ZLIB_VERSION"
39 $ optfile = name + ".opt"
40 $ axp = f$getsyi("HW_MODEL").ge.1024
44 $ If F$Search ("Sys$System:MMS.EXE") .nes. "" Then Make = "MMS"
45 $ If F$Type (MMK) .eqs. "STRING" Then Make = "MMK"
52 $! Look for the compiler used
54 $ gosub check_compiler
57 $ ccopt = "/prefix=all" + ccopt
58 $ if f$trnlnm("SYS") .eqs. ""
62 $ define sys sys$library:
64 $ ccopt = "/decc" + ccopt
65 $ define sys decc$library_include:
69 $ if its_vaxc .or. its_gnuc
71 $ if f$trnlnm("SYS").eqs."" then define sys sys$library:
74 $! Build the thing plain or with mms
76 $ write sys$output "Compiling Zlib sources ..."
79 $ dele example.obj;*,minigzip.obj;*
80 $ CALL MAKE adler32.OBJ "CC ''CCOPT' adler32" -
81 adler32.c zlib.h zconf.h zlibdefs.h
82 $ CALL MAKE compress.OBJ "CC ''CCOPT' compress" -
83 compress.c zlib.h zconf.h zlibdefs.h
84 $ CALL MAKE crc32.OBJ "CC ''CCOPT' crc32" -
85 crc32.c zlib.h zconf.h zlibdefs.h
86 $ CALL MAKE deflate.OBJ "CC ''CCOPT' deflate" -
87 deflate.c deflate.h zutil.h zlib.h zconf.h zlibdefs.h
88 $ CALL MAKE gzio.OBJ "CC ''CCOPT' gzio" -
89 gzio.c zutil.h zlib.h zconf.h zlibdefs.h
90 $ CALL MAKE infback.OBJ "CC ''CCOPT' infback" -
91 infback.c zutil.h inftrees.h inflate.h inffast.h inffixed.h
92 $ CALL MAKE inffast.OBJ "CC ''CCOPT' inffast" -
93 inffast.c zutil.h zlib.h zconf.h zlibdefs.h inffast.h
94 $ CALL MAKE inflate.OBJ "CC ''CCOPT' inflate" -
95 inflate.c zutil.h zlib.h zconf.h zlibdefs.h infblock.h
96 $ CALL MAKE inftrees.OBJ "CC ''CCOPT' inftrees" -
97 inftrees.c zutil.h zlib.h zconf.h zlibdefs.h inftrees.h
98 $ CALL MAKE trees.OBJ "CC ''CCOPT' trees" -
99 trees.c deflate.h zutil.h zlib.h zconf.h zlibdefs.h
100 $ CALL MAKE uncompr.OBJ "CC ''CCOPT' uncompr" -
101 uncompr.c zlib.h zconf.h zlibdefs.h
102 $ CALL MAKE zutil.OBJ "CC ''CCOPT' zutil" -
103 zutil.c zutil.h zlib.h zconf.h zlibdefs.h
104 $ write sys$output "Building Zlib ..."
105 $ CALL MAKE libz.OLB "lib/crea libz.olb *.obj" *.OBJ
106 $ write sys$output "Building example..."
107 $ CALL MAKE example.OBJ "CC ''CCOPT' example" -
108 example.c zlib.h zconf.h zlibdefs.h
109 $ call make example.exe "LINK example,libz.olb/lib" example.obj libz.olb
110 $ if f$search("x11vms:xvmsutils.olb") .nes. ""
112 $ write sys$output "Building minigzip..."
113 $ CALL MAKE minigzip.OBJ "CC ''CCOPT' minigzip" -
114 minigzip.c zlib.h zconf.h zlibdefs.h
115 $ call make minigzip.exe -
116 "LINK minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib" -
117 minigzip.obj libz.olb
121 $ write sys$output "Make ''name' ''version' with ''Make' "
125 $! Alpha gets a shareable image
130 $ write sys$output "Creating libzshr.exe"
131 $ call anal_obj_axp modules.opt _link.opt
134 $ open/append optf modules.opt
135 $ write optf "case_sensitive=YES"
138 $ LINK_'lopts'/SHARE=libzshr.exe modules.opt/opt,_link.opt/opt
140 $ write sys$output "Zlib build completed"
143 $ write sys$output "C compiler required to build ''name'"
146 $ set message/facil/ident/sever/text
148 $ write sys$output "Exiting..."
152 $MAKE: SUBROUTINE !SUBROUTINE TO CHECK DEPENDENCIES
154 $! P1 = What we are trying to make
155 $! P2 = Command to make it
156 $! P3 - P8 What it depends on
158 $ If F$Search(P1) .Eqs. "" Then Goto Makeit
159 $ Time = F$CvTime(F$File(P1,"RDT"))
163 $ If Argument .Eqs. "" Then Goto Exit
166 $ File = F$Element(El," ",Argument)
167 $ If File .Eqs. " " Then Goto Endl
171 $ AFile = F$Search(File)
172 $ If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl
173 $ If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit
180 $ If arg .Le. 8 Then Goto Loop
185 $ write sys$output P2
189 $ If V Then Set Verify
191 $!------------------------------------------------------------------------------
193 $! Check command line options and set symbols accordingly
200 $ cparm = f$edit(p'i',"upcase")
201 $ if cparm .eqs. "DEBUG"
203 $ ccopt = ccopt + "/noopt/deb"
204 $ lopts = lopts + "/deb"
206 $ if f$locate("CCOPT=",cparm) .lt. f$length(cparm)
208 $ start = f$locate("=",cparm) + 1
209 $ len = f$length(cparm) - start
210 $ ccopt = ccopt + f$extract(start,len,cparm)
211 $ if f$locate("AS_IS",f$edit(ccopt,"UPCASE")) .lt. f$length(ccopt) -
214 $ if cparm .eqs. "LINK" then linkonly = true
215 $ if f$locate("LOPTS=",cparm) .lt. f$length(cparm)
217 $ start = f$locate("=",cparm) + 1
218 $ len = f$length(cparm) - start
219 $ lopts = lopts + f$extract(start,len,cparm)
221 $ if f$locate("CC=",cparm) .lt. f$length(cparm)
223 $ start = f$locate("=",cparm) + 1
224 $ len = f$length(cparm) - start
225 $ cc_com = f$extract(start,len,cparm)
226 if (cc_com .nes. "DECC") .and. -
227 (cc_com .nes. "VAXC") .and. -
228 (cc_com .nes. "GNUC")
230 $ write sys$output "Unsupported compiler choice ''cc_com' ignored"
231 $ write sys$output "Use DECC, VAXC, or GNUC instead"
233 $ if cc_com .eqs. "DECC" then its_decc = true
234 $ if cc_com .eqs. "VAXC" then its_vaxc = true
235 $ if cc_com .eqs. "GNUC" then its_gnuc = true
238 $ if f$locate("MAKE=",cparm) .lt. f$length(cparm)
240 $ start = f$locate("=",cparm) + 1
241 $ len = f$length(cparm) - start
242 $ mmks = f$extract(start,len,cparm)
243 $ if (mmks .eqs. "MMK") .or. (mmks .eqs. "MMS")
247 $ write sys$output "Unsupported make choice ''mmks' ignored"
248 $ write sys$output "Use MMK or MMS instead"
255 $!------------------------------------------------------------------------------
257 $! Look for the compiler used
260 $! 0.01 20040223 First version to receive a number
261 $! 0.02 20040229 Save/set value of decc$no_rooted_search_lists
263 $ if (.not. (its_decc .or. its_vaxc .or. its_gnuc))
265 $ its_decc = (f$search("SYS$SYSTEM:DECC$COMPILER.EXE") .nes. "")
266 $ its_vaxc = .not. its_decc .and. (F$Search("SYS$System:VAXC.Exe") .nes. "")
267 $ its_gnuc = .not. (its_decc .or. its_vaxc) .and. (f$trnlnm("gnu_cc") .nes. "")
270 $! Exit if no compiler available
272 $ if (.not. (its_decc .or. its_vaxc .or. its_gnuc))
277 $ write sys$output "CC compiler check ... Compaq C"
278 $ if f$trnlnm("decc$no_rooted_search_lists") .nes. ""
280 $ dnrsl = f$trnlnm("decc$no_rooted_search_lists")
282 $ define decc$no_rooted_search_lists 1
284 $ if its_vaxc then write sys$output "CC compiler check ... VAX C"
285 $ if its_gnuc then write sys$output "CC compiler check ... GNU C"
286 $ if f$trnlnm(topt) then write topt "sys$share:vaxcrtl.exe/share"
287 $ if f$trnlnm(optf) then write optf "sys$share:vaxcrtl.exe/share"
291 $!------------------------------------------------------------------------------
293 $! If MMS/MMK are available dump out the descrip.mms if required
296 $ write sys$output "Creating descrip.mms..."
298 $ open/append out descrip.mms
299 $ copy sys$input: out
301 # descrip.mms: MMS description file for building zlib on VMS
302 # written by Martin P.J. Zinser
303 # <zinser@zinser.no-ip.info or zinser@sysdev.deutsche-boerse.com>
305 OBJS = adler32.obj, compress.obj, crc32.obj, gzio.obj, uncompr.obj, infback.obj\
306 deflate.obj, trees.obj, zutil.obj, inflate.obj, \
307 inftrees.obj, inffast.obj
310 $ write out "CFLAGS=", ccopt
311 $ write out "LOPTS=", lopts
312 $ copy sys$input: out
315 all : example.exe minigzip.exe libz.olb
316 @ write sys$output " Example applications available"
318 libz.olb : libz.olb($(OBJS))
319 @ write sys$output " libz available"
321 example.exe : example.obj libz.olb
322 link $(LOPTS) example,libz.olb/lib
324 minigzip.exe : minigzip.obj libz.olb
325 link $(LOPTS) minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib
328 delete *.obj;*,libz.olb;*,*.opt;*,*.exe;*
331 # Other dependencies.
332 adler32.obj : adler32.c zutil.h zlib.h zconf.h zlibdefs.h
333 compress.obj : compress.c zlib.h zconf.h zlibdefs.h
334 crc32.obj : crc32.c zutil.h zlib.h zconf.h zlibdefs.h
335 deflate.obj : deflate.c deflate.h zutil.h zlib.h zconf.h zlibdefs.h
336 example.obj : example.c zlib.h zconf.h zlibdefs.h
337 gzio.obj : gzio.c zutil.h zlib.h zconf.h zlibdefs.h
338 inffast.obj : inffast.c zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inffast.h
339 inflate.obj : inflate.c zutil.h zlib.h zconf.h zlibdefs.h
340 inftrees.obj : inftrees.c zutil.h zlib.h zconf.h zlibdefs.h inftrees.h
341 minigzip.obj : minigzip.c zlib.h zconf.h zlibdefs.h
342 trees.obj : trees.c deflate.h zutil.h zlib.h zconf.h zlibdefs.h
343 uncompr.obj : uncompr.c zlib.h zconf.h zlibdefs.h
344 zutil.obj : zutil.c zutil.h zlib.h zconf.h zlibdefs.h
345 infback.obj : infback.c zutil.h inftrees.h inflate.h inffast.h inffixed.h
349 $!------------------------------------------------------------------------------
351 $! Read list of core library sources from makefile.in and create options
352 $! needed to build shareable image
355 $ open/read min makefile.in
356 $ open/write mod modules.opt
357 $ src_check = "OBJC ="
359 $ read/end=mrdone min rec
360 $ if (f$extract(0,6,rec) .nes. src_check) then goto mrloop
361 $ rec = rec - src_check
363 $ if (f$element(1,"\",rec) .eqs. "\") then goto mrdone
365 $ read/end=mrdone min rec
367 $ if (f$element(1,"\",rec) .nes. "\") then goto mrsloop
372 $!------------------------------------------------------------------------------
374 $! Take record extracted in crea_olist and split it into single filenames
377 $ myrec = f$edit(rec - "\", "trim,compress")
380 $ srcfil = f$element(i," ", myrec)
381 $ if (srcfil .nes. " ")
383 $ write mod f$parse(srcfil,,,"NAME"), ".obj"
388 $!------------------------------------------------------------------------------
390 $! Find current Zlib version number
393 $ open/read h_in 'v_file'
395 $ read/end=hdone h_in rec
396 $ rec = f$edit(rec,"TRIM")
397 $ if (f$extract(0,1,rec) .nes. "#") then goto hloop
398 $ rec = f$edit(rec - "#", "TRIM")
399 $ if f$element(0," ",rec) .nes. "define" then goto hloop
400 $ if f$element(1," ",rec) .eqs. v_string
402 $ version = 'f$element(2," ",rec)'
409 $!------------------------------------------------------------------------------
411 $! Analyze Object files for OpenVMS AXP to extract Procedure and Data
412 $! information to build a symbol vector for a shareable image
413 $! All the "brains" of this logic was suggested by Hartmut Becker
414 $! (Hartmut.Becker@compaq.com). All the bugs were introduced by me
415 $! (zinser@zinser.no-ip.info), so if you do have problem reports please do not
416 $! bother Hartmut/HP, but get in touch with me
419 $! 0.01 20040406 Skip over shareable images in option file
420 $! 0.02 20041109 Fix option file for shareable images with case_sensitive=YES
421 $! 0.03 20050107 Skip over Identification labels in option file
422 $! 0.04 20060117 Add uppercase alias to code compiled with /name=as_is
424 $ ANAL_OBJ_AXP: Subroutine
426 $ SAY := "WRITE_ SYS$OUTPUT"
428 $ IF F$SEARCH("''P1'") .EQS. ""
430 $ SAY "ANAL_OBJ_AXP-E-NOSUCHFILE: Error, inputfile ''p1' not available"
433 $ IF "''P2'" .EQS. ""
435 $ SAY "ANAL_OBJ_AXP: Error, no output file provided"
441 $ open/append atmp a.tmp
443 $ read/end=end_loop in line
444 $ if f$locate("/SHARE",f$edit(line,"upcase")) .lt. f$length(line)
446 $ write sys$output "ANAL_SKP_SHR-i-skipshare, ''line'"
449 $ if f$locate("IDENTIFICATION=",f$edit(line,"upcase")) .lt. f$length(line)
451 $ write sys$output "ANAL_OBJ_AXP-i-ident: Identification ", -
452 f$element(1,"=",line)
458 $ write sys$output "ANAL_OBJ_AXP-w-nosuchfile, ''line'"
461 $ define/user sys$output nl:
462 $ define/user sys$error nl:
463 $ anal/obj/gsd 'f /out=x.tmp
464 $ open/read xtmp x.tmp
466 $ read/end=end_xloop xtmp xline
467 $ xline = f$edit(xline,"compress")
476 $ if f$search("a.tmp") .eqs. "" -
478 $ ! all global definitions
479 $ search a.tmp "symbol:","EGSY$V_DEF 1","EGSY$V_NORM 1"/out=b.tmp
481 $ search b.tmp "EGSY$V_NORM 1"/wind=(0,1) /out=c.tmp
482 $ search c.tmp "symbol:"/out=d.tmp
483 $ define/user sys$output nl:
484 $ edito/edt/command=sys$input d.tmp
485 sub/symbol: "/symbol_vector=(/whole
486 sub/"/=PROCEDURE)/whole
489 $ search b.tmp "EGSY$V_DEF 1"/wind=(0,1) /out=e.tmp
490 $ search e.tmp "symbol:"/out=f.tmp
491 $ define/user sys$output nl:
492 $ edito/edt/command=sys$input f.tmp
493 sub/symbol: "/symbol_vector=(/whole
496 $ sort/nodupl d.tmp,f.tmp g.tmp
497 $ open/read raw_vector g.tmp
498 $ open/write case_vector 'p2'
500 $ read/end=end_rawloop raw_vector raw_element
501 $ write case_vector raw_element
502 $ if f$locate("=PROCEDURE)",raw_element) .lt. f$length(raw_element)
504 $ name = f$element(1,"=",raw_element) - "("
505 $ if f$edit(name,"UPCASE") .nes. name then -
506 write case_vector f$fao(" symbol_vector=(!AS/!AS=PROCEDURE)", -
507 f$edit(name,"UPCASE"), name)
509 $ if f$locate("=DATA)",raw_element) .lt. f$length(raw_element)
511 $ name = f$element(1,"=",raw_element) - "("
512 $ if f$edit(name,"UPCASE") .nes. name then -
513 write case_vector f$fao(" symbol_vector=(!AS/!AS=DATA)", -
514 f$edit(name,"UPCASE"), name)
520 $ delete a.tmp;*,b.tmp;*,c.tmp;*,d.tmp;*,e.tmp;*,f.tmp;*,g.tmp;*
521 $ if f$search("x.tmp") .nes. "" -
522 then $ delete x.tmp;*
525 $ if V then set verify
527 $!------------------------------------------------------------------------------