[53] | 1 | $!
|
---|
| 2 | $! Makefile.com - builds GNU Make for VMS
|
---|
| 3 | $!
|
---|
[3138] | 4 | $! P1 = LIST will provide compiler listings.
|
---|
[53] | 5 | $! P2 = DEBUG will build an image with debug information
|
---|
| 6 | $! P3 = WALL will enable all warning messages (some are suppressed since
|
---|
| 7 | $! one macro intentionally causes an error condition)
|
---|
| 8 | $!
|
---|
| 9 | $! In case of problems with the install you might contact me at
|
---|
| 10 | $! zinser@decus.de (preferred) or zinser@sysdev.deutsche-boerse.com
|
---|
| 11 | $
|
---|
| 12 | $! hb
|
---|
| 13 | $! But don't ask Martin Zinser about the lines, I added/changed.
|
---|
[501] | 14 | $! In case of an error do some cleanup
|
---|
[53] | 15 | $ on error then $ goto cleanup
|
---|
| 16 | $! in case somebody set up her/his own symbol for cc
|
---|
| 17 | $ set symbol/scope=(nolocal,noglobal)
|
---|
| 18 | $!
|
---|
| 19 | $! Just some general constants...
|
---|
| 20 | $!
|
---|
| 21 | $ true = 1
|
---|
| 22 | $ false = 0
|
---|
| 23 | $ tmpnam = "temp_" + f$getjpi("","pid")
|
---|
| 24 | $ tt = tmpnam + ".txt"
|
---|
| 25 | $ tc = tmpnam + ".c"
|
---|
| 26 | $!
|
---|
| 27 | $! Look for the compiler used
|
---|
| 28 | $!
|
---|
| 29 | $ lval = ""
|
---|
| 30 | $ if f$search("SYS$SYSTEM:DECC$COMPILER.EXE").eqs.""
|
---|
| 31 | $ then
|
---|
| 32 | $ if f$trnlnm("SYS").eqs."" then def/nolog sys sys$library:
|
---|
| 33 | $ ccopt = ""
|
---|
| 34 | $ else
|
---|
[501] | 35 | $ ccopt = "/decc/prefix=(all,except=(globfree,glob))"
|
---|
[53] | 36 | $ if f$trnlnm("SYS").eqs.""
|
---|
| 37 | $ then
|
---|
| 38 | $ if f$trnlnm("DECC$LIBRARY_INCLUDE").nes.""
|
---|
| 39 | $ then
|
---|
| 40 | $ define sys decc$library_include:
|
---|
| 41 | $ else
|
---|
| 42 | $ if f$search("SYS$COMMON:[DECC$LIB.REFERENCE]DECC$RTLDEF.DIR").nes."" -
|
---|
| 43 | then lval = "SYS$COMMON:[DECC$LIB.REFERENCE.DECC$RTLDEF],"
|
---|
| 44 | $ if f$search("SYS$COMMON:[DECC$LIB.REFERENCE]SYS$STARLET_C.DIR").nes."" -
|
---|
| 45 | then lval = lval+"SYS$COMMON:[DECC$LIB.REFERENCE.SYS$STARLET_C],"
|
---|
| 46 | $ lval=lval+"SYS$LIBRARY:"
|
---|
| 47 | $ define sys 'lval
|
---|
| 48 | $ endif
|
---|
| 49 | $ endif
|
---|
| 50 | $ endif
|
---|
| 51 | $!
|
---|
[3138] | 52 | $!
|
---|
| 53 | $ if (p1 .eqs. "LIST")
|
---|
| 54 | $ then
|
---|
| 55 | $ ccopt = ccopt + "/list/show=(expan,inclu)"
|
---|
| 56 | $ endif
|
---|
| 57 | $!
|
---|
[53] | 58 | $! Should we build a debug image
|
---|
| 59 | $!
|
---|
| 60 | $ if (p2.eqs."DEBUG")
|
---|
| 61 | $ then
|
---|
| 62 | $ ccopt = ccopt + "/noopt/debug"
|
---|
| 63 | $ lopt = "/debug"
|
---|
| 64 | $ else
|
---|
| 65 | $ lopt = ""
|
---|
| 66 | $ endif
|
---|
| 67 | $!
|
---|
| 68 | $! Do we want to see all warnings
|
---|
| 69 | $!
|
---|
| 70 | $ if (p3.nes."WALL")
|
---|
| 71 | $ then
|
---|
| 72 | $ gosub check_cc_qual
|
---|
| 73 | $ endif
|
---|
| 74 | $ filelist = "alloca ar arscan commands default dir expand file function " + -
|
---|
[3138] | 75 | "guile hash implicit job load main misc read remake " + -
|
---|
| 76 | "remote-stub rule output signame variable version " + -
|
---|
| 77 | "vmsfunctions vmsify vpath vms_progname vms_exit " + -
|
---|
| 78 | "vms_export_symbol [.glob]glob [.glob]fnmatch getopt1 " + -
|
---|
| 79 | "getopt strcache"
|
---|
| 80 | $!
|
---|
[53] | 81 | $ copy config.h-vms config.h
|
---|
| 82 | $ n=0
|
---|
| 83 | $ open/write optf make.opt
|
---|
| 84 | $ loop:
|
---|
| 85 | $ cfile = f$elem(n," ",filelist)
|
---|
| 86 | $ if cfile .eqs. " " then goto linkit
|
---|
| 87 | $ write sys$output "Compiling ''cfile'..."
|
---|
[3138] | 88 | $ call compileit 'cfile'
|
---|
[53] | 89 | $ n = n + 1
|
---|
| 90 | $ goto loop
|
---|
| 91 | $ linkit:
|
---|
| 92 | $ close optf
|
---|
| 93 | $ link/exe=make make.opt/opt'lopt
|
---|
| 94 | $ goto cleanup
|
---|
| 95 | $
|
---|
| 96 | $ cleanup:
|
---|
| 97 | $ if f$trnlnm("SYS").nes."" then $ deassign sys
|
---|
| 98 | $ if f$trnlnm("OPTF").nes."" then $ close optf
|
---|
| 99 | $ if f$search("make.opt").nes."" then $ del make.opt;*
|
---|
| 100 | $ exit
|
---|
| 101 | $!
|
---|
[501] | 102 | $!-----------------------------------------------------------------------------
|
---|
[53] | 103 | $!
|
---|
| 104 | $! Check if this is a define relating to the properties of the C/C++
|
---|
| 105 | $! compiler
|
---|
| 106 | $!
|
---|
| 107 | $CHECK_CC_QUAL:
|
---|
[501] | 108 | $ open/write tmpc 'tc
|
---|
[53] | 109 | $ ccqual = "/warn=(disable=questcompare)"
|
---|
| 110 | $ write tmpc "#include <stdio.h>"
|
---|
| 111 | $ write tmpc "unsigned int i = 1;"
|
---|
| 112 | $ write tmpc "int main(){"
|
---|
[501] | 113 | $ write tmpc "if (i < 0){printf(""Mission impossible\n"");}}"
|
---|
[53] | 114 | $ close tmpc
|
---|
| 115 | $ gosub cc_qual_check
|
---|
| 116 | $ return
|
---|
| 117 | $!
|
---|
[501] | 118 | $!-----------------------------------------------------------------------------
|
---|
[53] | 119 | $!
|
---|
| 120 | $! Check for properties of C/C++ compiler
|
---|
| 121 | $!
|
---|
| 122 | $CC_QUAL_CHECK:
|
---|
| 123 | $ cc_qual = false
|
---|
| 124 | $ set message/nofac/noident/nosever/notext
|
---|
| 125 | $ cc 'ccqual' 'tmpnam'
|
---|
| 126 | $ if $status then cc_qual = true
|
---|
| 127 | $ set message/fac/ident/sever/text
|
---|
| 128 | $ delete/nolog 'tmpnam'.*;*
|
---|
[501] | 129 | $ if cc_qual then ccopt = ccopt + ccqual
|
---|
[53] | 130 | $ return
|
---|
[501] | 131 | $!-----------------------------------------------------------------------------
|
---|
[53] | 132 | $!
|
---|
| 133 | $ compileit : subroutine
|
---|
| 134 | $ ploc = f$locate("]",p1)
|
---|
[3138] | 135 | $! filnam = p1
|
---|
| 136 | $ if ploc .lt. f$length(p1)
|
---|
| 137 | $ then
|
---|
| 138 | $ objdir = f$extract(0, ploc+1, p1)
|
---|
| 139 | $ write optf p1
|
---|
| 140 | $ else
|
---|
| 141 | $ objdir := []
|
---|
| 142 | $ write optf objdir+p1
|
---|
| 143 | $ endif
|
---|
| 144 | $ cc'ccopt'/nested=none/include=([],[.glob])/obj='objdir' -
|
---|
| 145 | /define=("allocated_variable_expand_for_file=alloc_var_expand_for_file",-
|
---|
| 146 | "unlink=remove","HAVE_CONFIG_H","VMS") -
|
---|
[53] | 147 | 'p1'
|
---|
| 148 | $ exit
|
---|
| 149 | $ endsubroutine : compileit
|
---|
[501] | 150 | $!
|
---|
| 151 | $!-----------------------------------------------------------------------------
|
---|
[3138] | 152 | $!Copyright (C) 1996-2016 Free Software Foundation, Inc.
|
---|
[501] | 153 | $!This file is part of GNU Make.
|
---|
| 154 | $!
|
---|
[1989] | 155 | $!GNU Make is free software; you can redistribute it and/or modify it under
|
---|
| 156 | $!the terms of the GNU General Public License as published by the Free Software
|
---|
| 157 | $!Foundation; either version 3 of the License, or (at your option) any later
|
---|
| 158 | $!version.
|
---|
[501] | 159 | $!
|
---|
| 160 | $!GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
|
---|
[1989] | 161 | $!WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
---|
| 162 | $!FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
---|
| 163 | $!details.
|
---|
[501] | 164 | $!
|
---|
| 165 | $!You should have received a copy of the GNU General Public License along with
|
---|
[1989] | 166 | $!this program. If not, see <http://www.gnu.org/licenses/>.
|
---|