2 $! Makefile.com - builds GNU Make for VMS
4 $! P1 is non-empty if you want to link with the VAXCRTL library instead
5 $! of the shareable executable
6 $! P2 = DEBUG will build an image with debug information
7 $! P3 = WALL will enable all warning messages (some are suppressed since
8 $! one macro intentionally causes an error condition)
10 $! In case of problems with the install you might contact me at
11 $! zinser@decus.de (preferred) or zinser@sysdev.deutsche-boerse.com
14 $! But don't ask Martin Zinser about the lines, I added/changed.
15 $! In case of an error do some cleanup
16 $ on error then $ goto cleanup
17 $! in case somebody set up her/his own symbol for cc
18 $ set symbol/scope=(nolocal,noglobal)
20 $! Just some general constants...
24 $ tmpnam = "temp_" + f$getjpi("","pid")
25 $ tt = tmpnam + ".txt"
28 $! Look for the compiler used
31 $ if f$search("SYS$SYSTEM:DECC$COMPILER.EXE").eqs.""
33 $ if f$trnlnm("SYS").eqs."" then def/nolog sys sys$library:
36 $ ccopt = "/decc/prefix=all"
37 $ if f$trnlnm("SYS").eqs.""
39 $ if f$trnlnm("DECC$LIBRARY_INCLUDE").nes.""
41 $ define sys decc$library_include:
43 $ if f$search("SYS$COMMON:[DECC$LIB.REFERENCE]DECC$RTLDEF.DIR").nes."" -
44 then lval = "SYS$COMMON:[DECC$LIB.REFERENCE.DECC$RTLDEF],"
45 $ if f$search("SYS$COMMON:[DECC$LIB.REFERENCE]SYS$STARLET_C.DIR").nes."" -
46 then lval = lval+"SYS$COMMON:[DECC$LIB.REFERENCE.SYS$STARLET_C],"
47 $ lval=lval+"SYS$LIBRARY:"
53 $! Should we build a debug image
57 $ ccopt = ccopt + "/noopt/debug"
63 $! Do we want to see all warnings
69 $ filelist = "alloca ar arscan commands default dir expand file function " + -
70 "hash implicit job main misc read remake remote-stub rule " + -
71 "signame variable version vmsfunctions vmsify vpath " + -
72 "[.glob]glob [.glob]fnmatch getopt1 getopt"
73 $ copy config.h-vms config.h
75 $ open/write optf make.opt
77 $ cfile = f$elem(n," ",filelist)
78 $ if cfile .eqs. " " then goto linkit
79 $ write sys$output "Compiling ''cfile'..."
80 $ call compileit 'cfile' 'p1'
85 $ if p1 .nes. "" then goto link_using_library
86 $ link/exe=make make.opt/opt'lopt
90 $ link/exe=make make.opt/opt,sys$library:vaxcrtl/lib'lopt
93 $ if f$trnlnm("SYS").nes."" then $ deassign sys
94 $ if f$trnlnm("OPTF").nes."" then $ close optf
95 $ if f$search("make.opt").nes."" then $ del make.opt;*
98 $!------------------------------------------------------------------------------
100 $! Check if this is a define relating to the properties of the C/C++
104 $ open/write tmpc 'tc
105 $ ccqual = "/warn=(disable=questcompare)"
106 $ write tmpc "#include <stdio.h>"
107 $ write tmpc "unsigned int i = 1;"
108 $ write tmpc "int main(){"
109 $ write tmpc "if (i < 0){printf(""Mission impossible\n"");}}"
111 $ gosub cc_qual_check
114 $!------------------------------------------------------------------------------
116 $! Check for properties of C/C++ compiler
120 $ set message/nofac/noident/nosever/notext
121 $ cc 'ccqual' 'tmpnam'
122 $ if $status then cc_qual = true
123 $ set message/fac/ident/sever/text
124 $ delete/nolog 'tmpnam'.*;*
125 $ if cc_qual then ccopt = ccopt + ccqual
127 $!------------------------------------------------------------------------------
129 $ compileit : subroutine
130 $ ploc = f$locate("]",p1)
132 $ if ploc .lt. f$length(p1) then filnam=f$extract(ploc+1,100,p1)
133 $ write optf "''filnam'"
134 $ cc'ccopt'/include=([],[.glob]) -
135 /define=("allocated_variable_expand_for_file=alloc_var_expand_for_file","unlink=remove","HAVE_CONFIG_H","VMS") -
138 $ endsubroutine : compileit