1$!------------------------------------------------------------------------------
2$! make Contrib programs of libpng under OpenVMS
3$!
4$!
5$! Look for the compiler used
6$!
7$ zlibsrc = "[---.zlib]"
8$ ccopt="/include=(''zlibsrc',[--])"
9$ if f$getsyi("HW_MODEL").ge.1024
10$ then
11$  ccopt = "/prefix=all"+ccopt
12$  comp  = "__decc__=1"
13$  if f$trnlnm("SYS").eqs."" then define sys sys$library:
14$ else
15$  if f$search("SYS$SYSTEM:DECC$COMPILER.EXE").eqs.""
16$   then
17$    if f$trnlnm("SYS").eqs."" then define sys sys$library:
18$    if f$search("SYS$SYSTEM:VAXC.EXE").eqs.""
19$     then
20$      comp  = "__gcc__=1"
21$      CC :== GCC
22$     else
23$      comp = "__vaxc__=1"
24$     endif
25$   else
26$    if f$trnlnm("SYS").eqs."" then define sys decc$library_include:
27$    ccopt = "/decc/prefix=all"+ccopt
28$    comp  = "__decc__=1"
29$  endif
30$ endif
31$ open/write lopt lib.opt
32$ write lopt "[--]libpng.olb/lib"
33$ write lopt "''zlibsrc'libz.olb/lib"
34$ close lopt
35$ open/write xopt x11.opt
36$ write xopt "sys$library:decw$xlibshr.exe/share"
37$ close xopt
38$ write sys$output "Compiling PNG contrib programs ..."
39$   write sys$output "Building pnm2png..."
40$   CALL MAKE pnm2png.OBJ "cc ''CCOPT' pnm2png" -
41	pnm2png.c
42$   call make pnm2png.exe -
43	"LINK pnm2png,lib.opt/opt" -
44	pnm2png.obj
45$   write sys$output "Building png2pnm..."
46$   CALL MAKE png2pnm.OBJ "cc ''CCOPT' png2pnm" -
47	png2pnm.c
48$   call make png2pnm.exe -
49	"LINK png2pnm,lib.opt/opt" -
50	png2pnm.obj
51$ exit
52$!
53$!
54$MAKE: SUBROUTINE   !SUBROUTINE TO CHECK DEPENDENCIES
55$ V = 'F$Verify(0)
56$! P1 = What we are trying to make
57$! P2 = Command to make it
58$! P3 - P8  What it depends on
59$
60$ If F$Search(P1) .Eqs. "" Then Goto Makeit
61$ Time = F$CvTime(F$File(P1,"RDT"))
62$arg=3
63$Loop:
64$       Argument = P'arg
65$       If Argument .Eqs. "" Then Goto Exit
66$       El=0
67$Loop2:
68$       File = F$Element(El," ",Argument)
69$       If File .Eqs. " " Then Goto Endl
70$       AFile = ""
71$Loop3:
72$       OFile = AFile
73$       AFile = F$Search(File)
74$       If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl
75$       If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit
76$       Goto Loop3
77$NextEL:
78$       El = El + 1
79$       Goto Loop2
80$EndL:
81$ arg=arg+1
82$ If arg .Le. 8 Then Goto Loop
83$ Goto Exit
84$
85$Makeit:
86$ VV=F$VERIFY(0)
87$ write sys$output P2
88$ 'P2
89$ VV='F$Verify(VV)
90$Exit:
91$ If V Then Set Verify
92$ENDSUBROUTINE
93