Verify that backslashes before non-special characters are preserved.
[make.git] / makefile.com
blob809680462d43719034fc438bc885b5c2d80d81dc
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
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)
20 $! Just some general constants...
22 $ true  = 1
23 $ false = 0
24 $ tmpnam = "temp_" + f$getjpi("","pid")
25 $ tt = tmpnam + ".txt"
26 $ tc = tmpnam + ".c"
28 $! Look for the compiler used
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
53 $! Should we build a debug image
55 $ if (p2.eqs."DEBUG")
56 $  then
57 $   ccopt = ccopt + "/noopt/debug"
58 $   lopt = "/debug"
59 $ else
60 $   lopt = ""
61 $ endif
63 $! Do we want to see all warnings
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
89 $ link_using_library:
90 $ link/exe=make make.opt/opt,sys$library:vaxcrtl/lib'lopt
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
98 $!-----------------------------------------------------------------------------
100 $! Check if this is a define relating to the properties of the C/C++
101 $! compiler
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
114 $!-----------------------------------------------------------------------------
116 $! Check for properties of C/C++ compiler
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 $!-----------------------------------------------------------------------------
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
140 $!-----------------------------------------------------------------------------
141 $!Copyright (C) 1996-2012 Free Software Foundation, Inc.
142 $!This file is part of GNU Make.
144 $!GNU Make is free software; you can redistribute it and/or modify it under
145 $!the terms of the GNU General Public License as published by the Free Software
146 $!Foundation; either version 3 of the License, or (at your option) any later
147 $!version.
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
151 $!FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
152 $!details.
154 $!You should have received a copy of the GNU General Public License along with
155 $!this program.  If not, see <http://www.gnu.org/licenses/>.