| 1 | $!
|
|---|
| 2 | $! Makefile.com - builds GNU Make for VMS
|
|---|
| 3 | $!
|
|---|
| 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)
|
|---|
| 9 | $!
|
|---|
| 10 | $! In case of problems with the install you might contact me at
|
|---|
| 11 | $! zinser@decus.de (preferred) or zinser@sysdev.deutsche-boerse.com
|
|---|
| 12 | $
|
|---|
| 13 | $! hb
|
|---|
| 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)
|
|---|
| 19 | $!
|
|---|
| 20 | $! Just some general constants...
|
|---|
| 21 | $!
|
|---|
| 22 | $ true = 1
|
|---|
| 23 | $ false = 0
|
|---|
| 24 | $ tmpnam = "temp_" + f$getjpi("","pid")
|
|---|
| 25 | $ tt = tmpnam + ".txt"
|
|---|
| 26 | $ tc = tmpnam + ".c"
|
|---|
| 27 | $!
|
|---|
| 28 | $! Look for the compiler used
|
|---|
| 29 | $!
|
|---|
| 30 | $ lval = ""
|
|---|
| 31 | $ if f$search("SYS$SYSTEM:DECC$COMPILER.EXE").eqs.""
|
|---|
| 32 | $ then
|
|---|
| 33 | $ if f$trnlnm("SYS").eqs."" then def/nolog sys sys$library:
|
|---|
| 34 | $ ccopt = ""
|
|---|
| 35 | $ else
|
|---|
| 36 | $ ccopt = "/decc/prefix=(all,except=(globfree,glob))"
|
|---|
| 37 | $ if f$trnlnm("SYS").eqs.""
|
|---|
| 38 | $ then
|
|---|
| 39 | $ if f$trnlnm("DECC$LIBRARY_INCLUDE").nes.""
|
|---|
| 40 | $ then
|
|---|
| 41 | $ define sys decc$library_include:
|
|---|
| 42 | $ else
|
|---|
| 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:"
|
|---|
| 48 | $ define sys 'lval
|
|---|
| 49 | $ endif
|
|---|
| 50 | $ endif
|
|---|
| 51 | $ endif
|
|---|
| 52 | $!
|
|---|
| 53 | $! Should we build a debug image
|
|---|
| 54 | $!
|
|---|
| 55 | $ if (p2.eqs."DEBUG")
|
|---|
| 56 | $ then
|
|---|
| 57 | $ ccopt = ccopt + "/noopt/debug"
|
|---|
| 58 | $ lopt = "/debug"
|
|---|
| 59 | $ else
|
|---|
| 60 | $ lopt = ""
|
|---|
| 61 | $ endif
|
|---|
| 62 | $!
|
|---|
| 63 | $! Do we want to see all warnings
|
|---|
| 64 | $!
|
|---|
| 65 | $ if (p3.nes."WALL")
|
|---|
| 66 | $ then
|
|---|
| 67 | $ gosub check_cc_qual
|
|---|
| 68 | $ endif
|
|---|
| 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 strcache"
|
|---|
| 73 | $ copy config.h-vms config.h
|
|---|
| 74 | $ n=0
|
|---|
| 75 | $ open/write optf make.opt
|
|---|
| 76 | $ loop:
|
|---|
| 77 | $ cfile = f$elem(n," ",filelist)
|
|---|
| 78 | $ if cfile .eqs. " " then goto linkit
|
|---|
| 79 | $ write sys$output "Compiling ''cfile'..."
|
|---|
| 80 | $ call compileit 'cfile' 'p1'
|
|---|
| 81 | $ n = n + 1
|
|---|
| 82 | $ goto loop
|
|---|
| 83 | $ linkit:
|
|---|
| 84 | $ close optf
|
|---|
| 85 | $ if p1 .nes. "" then goto link_using_library
|
|---|
| 86 | $ link/exe=make make.opt/opt'lopt
|
|---|
| 87 | $ goto cleanup
|
|---|
| 88 | $
|
|---|
| 89 | $ link_using_library:
|
|---|
| 90 | $ link/exe=make make.opt/opt,sys$library:vaxcrtl/lib'lopt
|
|---|
| 91 | $
|
|---|
| 92 | $ cleanup:
|
|---|
| 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;*
|
|---|
| 96 | $ exit
|
|---|
| 97 | $!
|
|---|
| 98 | $!-----------------------------------------------------------------------------
|
|---|
| 99 | $!
|
|---|
| 100 | $! Check if this is a define relating to the properties of the C/C++
|
|---|
| 101 | $! compiler
|
|---|
| 102 | $!
|
|---|
| 103 | $CHECK_CC_QUAL:
|
|---|
| 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"");}}"
|
|---|
| 110 | $ close tmpc
|
|---|
| 111 | $ gosub cc_qual_check
|
|---|
| 112 | $ return
|
|---|
| 113 | $!
|
|---|
| 114 | $!-----------------------------------------------------------------------------
|
|---|
| 115 | $!
|
|---|
| 116 | $! Check for properties of C/C++ compiler
|
|---|
| 117 | $!
|
|---|
| 118 | $CC_QUAL_CHECK:
|
|---|
| 119 | $ cc_qual = false
|
|---|
| 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
|
|---|
| 126 | $ return
|
|---|
| 127 | $!-----------------------------------------------------------------------------
|
|---|
| 128 | $!
|
|---|
| 129 | $ compileit : subroutine
|
|---|
| 130 | $ ploc = f$locate("]",p1)
|
|---|
| 131 | $ filnam = 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") -
|
|---|
| 136 | 'p1'
|
|---|
| 137 | $ exit
|
|---|
| 138 | $ endsubroutine : compileit
|
|---|
| 139 | $!
|
|---|
| 140 | $!-----------------------------------------------------------------------------
|
|---|
| 141 | $!Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
|---|
| 142 | $!2006 Free Software Foundation, Inc.
|
|---|
| 143 | $!This file is part of GNU Make.
|
|---|
| 144 | $!
|
|---|
| 145 | $!GNU Make is free software; you can redistribute it and/or modify it under the
|
|---|
| 146 | $!terms of the GNU General Public License as published by the Free Software
|
|---|
| 147 | $!Foundation; either version 2, or (at your option) any later version.
|
|---|
| 148 | $!
|
|---|
| 149 | $!GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
|
|---|
| 150 | $!WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|---|
| 151 | $!A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|---|
| 152 | $!
|
|---|
| 153 | $!You should have received a copy of the GNU General Public License along with
|
|---|
| 154 | $!GNU Make; see the file COPYING. If not, write to the Free Software
|
|---|
| 155 | $!Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|---|