fukasawa e60969
$!------------------------------------------------------------------------------
fukasawa e60969
$! make "PNG: The Definitive Guide" demo programs (for X) under OpenVMS
fukasawa e60969
$!
fukasawa e60969
$! Script created by Martin Zinser for libpng; modified by Greg Roelofs
fukasawa e60969
$! for standalone pngbook source distribution.
fukasawa e60969
$!
fukasawa e60969
$!
fukasawa e60969
$!    Set locations where zlib and libpng sources live.
fukasawa e60969
$!
fukasawa e60969
$ zpath   = ""
fukasawa e60969
$ pngpath = ""
fukasawa e60969
$!
fukasawa e60969
$ if f$search("[---.zlib]zlib.h").nes."" then zpath = "[---.zlib]"
fukasawa e60969
$ if f$search("[--]png.h").nes."" then pngpath = "[--]"
fukasawa e60969
$!
fukasawa e60969
$ if f$search("[-.zlib]zlib.h").nes."" then zpath = "[-.zlib]"
fukasawa e60969
$ if f$search("[-.libpng]png.h").nes."" then pngpath = "[-.libpng]"
fukasawa e60969
$!
fukasawa e60969
$ if zpath .eqs. ""
fukasawa e60969
$ then
fukasawa e60969
$   write sys$output "zlib include not found. Exiting..."
fukasawa e60969
$   exit 2
fukasawa e60969
$ endif
fukasawa e60969
$!
fukasawa e60969
$ if pngpath .eqs. ""
fukasawa e60969
$ then
fukasawa e60969
$   write sys$output "libpng include not found. Exiting..."
fukasawa e60969
$   exit 2
fukasawa e60969
$ endif
fukasawa e60969
$!
fukasawa e60969
$!    Look for the compiler used.
fukasawa e60969
$!
fukasawa e60969
$ ccopt="/include=(''zpath',''pngpath')"
fukasawa e60969
$ if f$getsyi("HW_MODEL").ge.1024
fukasawa e60969
$ then
fukasawa e60969
$  ccopt = "/prefix=all"+ccopt
fukasawa e60969
$  comp  = "__decc__=1"
fukasawa e60969
$  if f$trnlnm("SYS").eqs."" then define sys sys$library:
fukasawa e60969
$ else
fukasawa e60969
$  if f$search("SYS$SYSTEM:DECC$COMPILER.EXE").eqs.""
fukasawa e60969
$   then
fukasawa e60969
$    if f$trnlnm("SYS").eqs."" then define sys sys$library:
fukasawa e60969
$    if f$search("SYS$SYSTEM:VAXC.EXE").eqs.""
fukasawa e60969
$     then
fukasawa e60969
$      comp  = "__gcc__=1"
fukasawa e60969
$      CC :== GCC
fukasawa e60969
$     else
fukasawa e60969
$      comp = "__vaxc__=1"
fukasawa e60969
$     endif
fukasawa e60969
$   else
fukasawa e60969
$    if f$trnlnm("SYS").eqs."" then define sys decc$library_include:
fukasawa e60969
$    ccopt = "/decc/prefix=all"+ccopt
fukasawa e60969
$    comp  = "__decc__=1"
fukasawa e60969
$  endif
fukasawa e60969
$ endif
fukasawa e60969
$ open/write lopt lib.opt
fukasawa e60969
$ write lopt "''pngpath'libpng.olb/lib"
fukasawa e60969
$ write lopt "''zpath'libz.olb/lib"
fukasawa e60969
$ close lopt
fukasawa e60969
$ open/write xopt x11.opt
fukasawa e60969
$ write xopt "sys$library:decw$xlibshr.exe/share"
fukasawa e60969
$ close xopt
fukasawa e60969
$!
fukasawa e60969
$!    Build 'em.
fukasawa e60969
$!
fukasawa e60969
$ write sys$output "Compiling PNG book programs ..."
fukasawa e60969
$   CALL MAKE readpng.OBJ "cc ''CCOPT' readpng" -
fukasawa e60969
	readpng.c readpng.h
fukasawa e60969
$   CALL MAKE readpng2.OBJ "cc ''CCOPT' readpng2" -
fukasawa e60969
	readpng2.c readpng2.h
fukasawa e60969
$   CALL MAKE writepng.OBJ "cc ''CCOPT' writepng" -
fukasawa e60969
	writepng.c writepng.h
fukasawa e60969
$   write sys$output "Building rpng-x..."
fukasawa e60969
$   CALL MAKE rpng-x.OBJ "cc ''CCOPT' rpng-x" -
fukasawa e60969
	rpng-x.c readpng.h
fukasawa e60969
$   call make rpng-x.exe -
fukasawa e60969
	"LINK rpng-x,readpng,lib.opt/opt,x11.opt/opt" -
fukasawa e60969
	rpng-x.obj readpng.obj
fukasawa e60969
$   write sys$output "Building rpng2-x..."
fukasawa e60969
$   CALL MAKE rpng2-x.OBJ "cc ''CCOPT' rpng2-x" -
fukasawa e60969
	rpng2-x.c readpng2.h
fukasawa e60969
$   call make rpng2-x.exe -
fukasawa e60969
	"LINK rpng2-x,readpng2,lib.opt/opt,x11.opt/opt" -
fukasawa e60969
	rpng2-x.obj readpng2.obj
fukasawa e60969
$   write sys$output "Building wpng..."
fukasawa e60969
$   CALL MAKE wpng.OBJ "cc ''CCOPT' wpng" -
fukasawa e60969
	wpng.c writepng.h
fukasawa e60969
$   call make wpng.exe -
fukasawa e60969
	"LINK wpng,writepng,lib.opt/opt" -
fukasawa e60969
	wpng.obj writepng.obj
fukasawa e60969
$ exit
fukasawa e60969
$!
fukasawa e60969
$!
fukasawa e60969
$MAKE: SUBROUTINE   !SUBROUTINE TO CHECK DEPENDENCIES
fukasawa e60969
$ V = 'F$Verify(0)
fukasawa e60969
$! P1 = What we are trying to make
fukasawa e60969
$! P2 = Command to make it
fukasawa e60969
$! P3 - P8  What it depends on
fukasawa e60969
$
fukasawa e60969
$ If F$Search(P1) .Eqs. "" Then Goto Makeit
fukasawa e60969
$ Time = F$CvTime(F$File(P1,"RDT"))
fukasawa e60969
$arg=3
fukasawa e60969
$Loop:
fukasawa e60969
$       Argument = P'arg
fukasawa e60969
$       If Argument .Eqs. "" Then Goto Exit
fukasawa e60969
$       El=0
fukasawa e60969
$Loop2:
fukasawa e60969
$       File = F$Element(El," ",Argument)
fukasawa e60969
$       If File .Eqs. " " Then Goto Endl
fukasawa e60969
$       AFile = ""
fukasawa e60969
$Loop3:
fukasawa e60969
$       OFile = AFile
fukasawa e60969
$       AFile = F$Search(File)
fukasawa e60969
$       If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl
fukasawa e60969
$       If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit
fukasawa e60969
$       Goto Loop3
fukasawa e60969
$NextEL:
fukasawa e60969
$       El = El + 1
fukasawa e60969
$       Goto Loop2
fukasawa e60969
$EndL:
fukasawa e60969
$ arg=arg+1
fukasawa e60969
$ If arg .Le. 8 Then Goto Loop
fukasawa e60969
$ Goto Exit
fukasawa e60969
$
fukasawa e60969
$Makeit:
fukasawa e60969
$ VV=F$VERIFY(0)
fukasawa e60969
$ write sys$output P2
fukasawa e60969
$ 'P2
fukasawa e60969
$ VV='F$Verify(VV)
fukasawa e60969
$Exit:
fukasawa e60969
$ If V Then Set Verify
fukasawa e60969
$ENDSUBROUTINE