Commit c14685bf by Richard Kenner

Support building with GNU C vs VAX C vs DEC C from the DCL command line.

From-SVN: r13531
parent d7fd1073
$! Set the def dir to proper place for use in batch. Works for interactive too. $v='f$verify(0) !make-cc1.com
$flnm = f$enviroment("PROCEDURE") ! get current procedure name
$set default 'f$parse(flnm,,,"DEVICE")''f$parse(flnm,,,"DIRECTORY")'
$! $!
$ v=f$verify(0) $! Build the GNU C compiler on VMS.
$! $!
$! CAUTION: If you want to link gcc-cc1 to the sharable image library $! Usage:
$! VAXCRTL, see the notes in gcc.texinfo (or INSTALL) first. $! $ @make-cc1.com [host-compiler] [various]
$! $!
$! Build the GNU "C" compiler on VMS $! where [host-compiler] is one of "GNUC", "VAXC", "DECC";
$! default when none specified is "GNUC",
$! and where [various] is one or more of "CC1", "CC1PLUS",
$! "CC1OBJ", "OBJCLIB", "INDEPENDENT", "BC", "ALL", "LINK", "DEBUG".
$! "CC1" (C compiler) is the default; of the others, only
$! "CC1PLUS" (C++ compiler), "CC1OBJ" (Objective-C compiler),
$! and "OBJCLIB" (Objective-C run-time library) are of interest
$! for normal installation.
$! If both [host-compiler] and other option(s) are specified,
$! the host compiler argument must come first.
$! $!
$! Note: to build with DEC's VAX C compiler, uncomment the 2nd CC, CFLAGS, $ if f$type(gcc_debug).eqs."INTEGER" then if gcc_debug.and.1 then set verify
$! and LIBS alternatives, and also execute the following command: $
$! DEFINE SYS SYS$LIBRARY: $ p1 = f$edit(p1,"UPCASE,TRIM")
$! After a successful build, restore those items and rebuild with gcc. $ if p1.eqs."" then p1 = "GNUC"
$!
$! Compiler-specific setup (assume GNU C, then override as necessary):
$!
$ CC = "gcc"
$ CFLAGS = "/Debug/noVerbos/CC1=""-mpcc-alignment"""
$ LIBS = "gnu_cc:[000000]gcclib.olb/Libr,sys$library:vaxcrtl.olb/Libr"
$ if p1.eqs."GNUC"
$ then
$ p1 = ""
$ else
$ CC = "cc"
$ CFLAGS = "/noOpt" !disable optimizer when bootstrapping with native cc
$ if p2.eqs."DEBUG" .or. p3.eqs."DEBUG" then CFLAGS = CFLAGS + "/Debug"
$ if p1.eqs."VAXC"
$ then
$ p1 = ""
$ if f$trnlnm("DECC$CC_DEFAULT").nes."" then CC = "cc/VAXC"
$ LIBS = "alloca.obj,sys$library:vaxcrtl.olb/Libr"
$ define/noLog SYS SYS$LIBRARY:
$ else
$ if p1.eqs."DECC"
$ then
$ p1 = ""
$ if f$trnlnm("DECC$CC_DEFAULT").nes."" then CC = "cc/DECC"
$ CC = CC + "/Prefix=All/Warn=Disabl=(ImplicitFunc)"
$ LIBS = "alloca.obj" !DECC$SHR will be found implicitly by linker
$ define/noLog SYS DECC$LIBRARY_INCLUDE:
$ endif !DECC
$ endif !VAXC
$ endif !GNUC
$ $
$! C compiler
$!
$ CC = "gcc"
$! CC = "cc" !uncomment for VAXC
$ BISON = "bison"
$ BISON_FLAGS= "/Define/Verbose"
$ RENAME= "rename/New_Version"
$ LINK = "link"
$ EDIT = "edit"
$ SEARCH= "search"
$ ABORT = "exit %x002C"
$ echo = "write sys$output"
$!
$! Compiler options
$!
$ CFLAGS = "/Debug/noVerbos/CC1=""-mpcc-alignment"""
$! CFLAGS = "/noOpt" !uncomment for VAXC
$ CINCL1 = "/Incl=[]" !stage 1 -I flags
$ CINCL2 = "/Incl=([],[.ginclude])" !stage 2,3,... flags
$ CINCL_SUB = "/Incl=([],[-],[-.ginclude])" ![.cp] flags
$! $!
$! Link options $! Other setup:
$! $!
$ LDFLAGS = "/noMap" $ LDFLAGS = "/noMap"
$ PARSER = "bison"
$ PARSER_FLAGS= "/Define/Verbose"
$ RENAME = "rename/New_Version"
$ LINK = "link"
$ EDIT = "edit"
$ SEARCH = "search"
$ ABORT = "exit %x002C"
$ echo = "write sys$output"
$! $!
$! Link libraries $! Stage[123] options
$! $!
$ LIBS = "gnu_cc:[000000]gcclib.olb/Libr,sys$library:vaxcrtl.olb/Libr" $ CINCL1 = "/Incl=[]" !stage 1 -I flags
$! LIBS = "alloca.obj,sys$library:vaxcrtl.olb/Libr" !uncomment for VAXC $ CINCL2 = "/Incl=([],[.ginclude])" !stage 2,3,... flags
$ CINCL_SUB = "/Incl=([],[-],[-.ginclude])" ![.cp] flags
$ $
$!!!!!!! $!!!!!!!
$! Nothing beyond this point should need any local configuration changes. $! Nothing beyond this point should need any local configuration changes.
$!!!!!!! $!!!!!!!
$ $
$! Set the default directory to the same place as this command procedure.
$ flnm = f$enviroment("PROCEDURE") !get current procedure name
$ set default 'f$parse(flnm,,,"DEVICE")''f$parse(flnm,,,"DIRECTORY")'
$
$! $!
$! First we figure out what needs to be done. This is sort of like a limited $! First we figure out what needs to be done. This is sort of like a limited
$! make facility - the command line options specify exactly what components $! make facility - the command line options specify exactly what components
...@@ -70,6 +100,9 @@ $! ...@@ -70,6 +100,9 @@ $!
$! BC: $! BC:
$! Compile byte compiler source modules. (On by default). $! Compile byte compiler source modules. (On by default).
$! $!
$! OBJCLIB:
$! Compile Objective-C run-time library.
$!
$! DEBUG: Link images with /debug. $! DEBUG: Link images with /debug.
$! $!
$! If you want to list more than one option, you should use a spaces to $! If you want to list more than one option, you should use a spaces to
...@@ -84,7 +117,7 @@ $! If you do not specify which compiler you want to build, it is assumed that ...@@ -84,7 +117,7 @@ $! If you do not specify which compiler you want to build, it is assumed that
$! you want to build GNU-C ("CC1"). $! you want to build GNU-C ("CC1").
$! $!
$! Now figure out what we have been requested to do. $! Now figure out what we have been requested to do.
$p1 = p1+" "+p2+" "+p3+" "+p4+" "+p5+" "+p6+" "+p7 $p1 = p1+" "+p2+" "+p3+" "+p4+" "+p5+" "+p6+" "+p7+" "+p8
$p1 = f$edit(p1,"COMPRESS,TRIM") $p1 = f$edit(p1,"COMPRESS,TRIM")
$i=0 $i=0
$DO_ALL = 0 $DO_ALL = 0
...@@ -207,12 +240,12 @@ $ if f$search("alloca.obj").nes."" then - !does .obj exist? is it up to date? ...@@ -207,12 +240,12 @@ $ if f$search("alloca.obj").nes."" then - !does .obj exist? is it up to date?
if f$cvtime(f$file_attributes("alloca.obj","RDT")).gts.- if f$cvtime(f$file_attributes("alloca.obj","RDT")).gts.-
f$cvtime(f$file_attributes("alloca.c","RDT")) then goto skip_alloca f$cvtime(f$file_attributes("alloca.c","RDT")) then goto skip_alloca
$set verify $set verify
$ 'CC''CFLAGS'/Define="STACK_DIRECTION=(-1)" alloca.c $ 'CC''CFLAGS'/Defi=("HAVE_CONFIG_H","STACK_DIRECTION=(-1)") alloca.c
$!'f$verify(0) $!'f$verify(0)
$skip_alloca: $skip_alloca:
$! $!
$if DO_BC.eq.1 $if DO_BC.eq.1
$ THEN $ then
$ call compile bi_all.opt "" $ call compile bi_all.opt ""
$ if f$trnlnm("ifile$").nes."" then close/noLog ifile$ $ if f$trnlnm("ifile$").nes."" then close/noLog ifile$
$ open ifile$ bc_all.list $ open ifile$ bc_all.list
...@@ -229,8 +262,8 @@ $bc_done: ...@@ -229,8 +262,8 @@ $bc_done:
$ endif $ endif
$! $!
$! $!
$if DO_INDEPENDENT.eq.1 $if DO_INDEPENDENT.eq.1
$ THEN $ then
$! $!
$! First build a couple of header files from the machine description $! First build a couple of header files from the machine description
$! These are used by many of the source modules, so we build them now. $! These are used by many of the source modules, so we build them now.
...@@ -415,27 +448,26 @@ $ save_cflags = CFLAGS ...@@ -415,27 +448,26 @@ $ save_cflags = CFLAGS
$ CFLAGS = CFLAGS - CINCL1 - CINCL2 + CINCL_SUB $ CFLAGS = CFLAGS - CINCL1 - CINCL2 + CINCL_SUB
$ endif $ endif
$! $!
$if f$locate("parse",flnm).nes.f$length(flnm) $ if f$locate("parse",flnm).nes.f$length(flnm)
$ then $ then
$ if (f$search("''flnm'.C") .eqs. "") then goto yes_bison $ if f$search("''flnm'.c").nes."" then -
$ if (f$cvtime(f$file_attributes("''flnm'.Y","RDT")).les. - if f$cvtime(f$file_attributes("''flnm'.c","RDT")).ges. -
f$cvtime(f$file_attributes("''flnm'.C","RDT"))) - f$cvtime(f$file_attributes("''flnm'.y","RDT")) then goto skip_yacc
then goto no_bison $ set verify
$yes_bison: $ 'PARSER' 'PARSER_FLAGS' 'flnm'.y
$set verify $ 'RENAME' 'flnm'_tab.c 'flnm'.c
$ 'BISON''BISON_FLAGS' 'flnm'.y $ 'RENAME' 'flnm'_tab.h 'flnm'.h
$ 'RENAME' 'flnm'_tab.c 'flnm'.c
$ 'RENAME' 'flnm'_tab.h 'flnm'.h
$!'f$verify(0) $!'f$verify(0)
$ if flnm.eqs."cp-parse" .or. (prfx.eqs."cp" .and. flnm.eqs."parse") $ if flnm.eqs."cp-parse" .or. (prfx.eqs."cp" .and. flnm.eqs."parse")
$ then ! fgrep '#define YYEMPTY' cp-parse.c >>cp-parse.h $ then ! fgrep '#define YYEMPTY' cp-parse.c >>cp-parse.h
$ if f$trnlnm("JFILE$").nes."" then close/noLog jfile$
$ open/Append jfile$ 'flnm'.h $ open/Append jfile$ 'flnm'.h
$ 'SEARCH'/Exact/Output=jfile$ 'flnm'.c "#define YYEMPTY" $ 'SEARCH'/Exact/Output=jfile$ 'flnm'.c "#define YYEMPTY"
$ close jfile$ $ close jfile$
$ endif $ endif
$no_bison: $skip_yacc:
$ echo " (Ignore any warning about not finding file ""bison.simple"".)" $ echo " (Ignore any warning about not finding file ""bison.simple"".)"
$ endif $ endif
$! $!
$if f$extract(0,5,flnm).eqs."insn-" then call generate 'flnm'.c $if f$extract(0,5,flnm).eqs."insn-" then call generate 'flnm'.c
$! $!
...@@ -461,7 +493,7 @@ $close ifile$ ...@@ -461,7 +493,7 @@ $close ifile$
$endsubroutine $endsubroutine
$! $!
$! This subroutine generates the insn-* files. The first argument is the $! This subroutine generates the insn-* files. The first argument is the
$! name of the insn-* file to generate. The second argument contains a $! name of the insn-* file to generate. The second argument contains a
$! list of any other object modules which must be linked to the gen*.c $! list of any other object modules which must be linked to the gen*.c
$! program. $! program.
$! $!
...@@ -475,7 +507,7 @@ $ endif ...@@ -475,7 +507,7 @@ $ endif
$root1=f$parse(f$extract(5,255,p1),,,"NAME") $root1=f$parse(f$extract(5,255,p1),,,"NAME")
$ set verify $ set verify
$ 'CC''CFLAGS' GEN'root1'.C $ 'CC''CFLAGS' GEN'root1'.C
$ 'LINK''LDFLAGS' GEN'root1'.OBJ,rtl.obj,obstack.obj,'p2' - $ 'LINK''f$string(LDFLAGS - "/Debug")' GEN'root1'.OBJ,rtl.obj,obstack.obj,'p2' -
'LIBS' 'LIBS'
$! 'f$verify(0) $! 'f$verify(0)
$! $!
...@@ -486,7 +518,7 @@ $!'f$verify(0) ...@@ -486,7 +518,7 @@ $!'f$verify(0)
$endsubroutine $endsubroutine
$! $!
$! This subroutine generates the bc-* files. The first argument is the $! This subroutine generates the bc-* files. The first argument is the
$! name of the bc-* file to generate. The second argument contains a $! name of the bc-* file to generate. The second argument contains a
$! list of any other object modules which must be linked to the bi*.c $! list of any other object modules which must be linked to the bi*.c
$! program. $! program.
$! $!
...@@ -500,7 +532,7 @@ $ endif ...@@ -500,7 +532,7 @@ $ endif
$root1=f$parse(f$extract(3,255,p1),,,"NAME") $root1=f$parse(f$extract(3,255,p1),,,"NAME")
$ set verify $ set verify
$ 'CC''CFLAGS' BI-'root1'.C $ 'CC''CFLAGS' BI-'root1'.C
$ 'LINK''LDFLAGS' BI-'root1'.OBJ,'p2' - $ 'LINK''f$string(LDFLAGS - "/Debug")' BI-'root1'.OBJ,'p2' -
'LIBS' 'LIBS'
$! 'f$verify(0) $! 'f$verify(0)
$! $!
......
$! Set the def dir to proper place for use in batch. Works for interactive too. $v='f$verify(0) !make-cccp.com
$flnm = f$enviroment("PROCEDURE") ! get current procedure name
$set default 'f$parse(flnm,,,"DEVICE")''f$parse(flnm,,,"DIRECTORY")'
$! $!
$! Build the GNU "C" pre-processor on VMS $! Build the GNU C preprocessor on VMS.
$! $!
$! Note: to build with DEC's VAX C compiler, uncomment the 2nd CC, CFLAGS, $! Usage:
$! and LIBS alternatives, and also execute the following command: $! $ @make-cccp.com [compiler] [link-only]
$! DEFINE SYS SYS$LIBRARY:
$
$! $!
$! C compiler $! where [compiler] is one of "GNUC", "VAXC", "DECC";
$! default when none specified is "GNUC",
$! and where [link-only] is "LINK" or omitted.
$! If both options are specified, the compiler must come first.
$! $!
$ CC = "gcc" $ if f$type(gcc_debug).eqs."INTEGER" then if gcc_debug.and.1 then set verify
$! CC = "cc" !uncomment for VAXC $
$ BISON = "bison" $ p1 = f$edit(p1,"UPCASE,TRIM")
$ RENAME= "rename/New_Version" $ if p1.eqs."" then p1 = "GNUC"
$ LINK = "link"
$ echo = "write sys$output"
$! $!
$! Compiler options $! Compiler-specific setup (assume GNU C, then override as necessary):
$! $!
$ CFLAGS = "/Debug/noVerbos" $ CC = "gcc"
$! CFLAGS = "/noOpt" !uncomment for VAXC $ CFLAGS = "/Debug/noVerbos"
$ LIBS = "gnu_cc:[000000]gcclib.olb/Libr,sys$library:vaxcrtl.olb/Libr"
$ if p1.nes."GNUC"
$ then
$ CC = "cc"
$ CFLAGS = "/noOpt" !disable optimizer when bootstrapping with native cc
$ if p1.eqs."VAXC"
$ then
$ if f$trnlnm("DECC$CC_DEFAULT").nes."" then CC = "cc/VAXC"
$ LIBS = "alloca.obj,sys$library:vaxcrtl.olb/Libr"
$ define/noLog SYS SYS$LIBRARY:
$ else
$ if p1.eqs."DECC"
$ then
$ if f$trnlnm("DECC$CC_DEFAULT").nes."" then CC = "cc/DECC"
$ LIBS = "alloca.obj" !DECC$SHR will be found implicitly by linker
$ define/noLog SYS DECC$LIBRARY_INCLUDE:
$ else
$ if p1.nes."LINK"
$ then
$ type sys$input: /Output=sys$error:
$DECK
[compiler] argument should be one of "GNUC", "VAXC", or "DECC".
Usage:
$ @make-cccp.com [compiler] [link-only]
$EOD
$ exit %x1000002C + 0*f$verify(v) !%SYSTEM-F-ABORT
$ endif !!LINK
$ endif !DECC
$ endif !VAXC
$ endif !!GNUC
$
$! $!
$! Link options $! Other setup:
$! $!
$ LDFLAGS = "/noMap" $ LDFLAGS = "/noMap"
$! $ PARSER = "bison"
$! Link libraries $ RENAME = "rename/New_Version"
$! $ LINK = "link"
$ LIBS = "gnu_cc:[000000]gcclib.olb/Libr,sys$library:vaxcrtl.olb/Libr" $ echo = "write sys$output"
$! LIBS = "alloca.obj,sys$library:vaxcrtl.olb/Libr" !uncomment for VAXC
$ $
$!!!!!!! $!!!!!!!
$! Nothing beyond this point should need any local configuration changes. $! Nothing beyond this point should need any local configuration changes.
$!!!!!!! $!!!!!!!
$ $
$ if "''p1'" .eqs. "LINK" then goto Link $! Set the default directory to the same place as this command procedure.
$ flnm = f$enviroment("PROCEDURE") !get current procedure name
$ set default 'f$parse(flnm,,,"DEVICE")''f$parse(flnm,,,"DIRECTORY")'
$
$ if p1.eqs."LINK" .or. p2.eqs."LINK" then goto Link
$ echo " Building the preprocessor." $ echo " Building the preprocessor."
$
$! Compile the simplest file first, to catch problem with compiler setup early.
$ set verify
$ 'CC''CFLAGS' version.c
$!'f$verify(0)
$
$ set verify $ set verify
$ 'CC''CFLAGS' cccp.c $ 'CC''CFLAGS' cccp.c
$!'f$verify(0) $!'f$verify(0)
$ t1:='f$search("CEXP.C")' $
$ if "''t1'" .eqs. "" then goto 10$ $! Compile preprocessor's parser, possibly making it with yacc first.
$ t1:='f$file_attributes("CEXP.Y","RDT")' $ if f$search("CEXP.C").nes."" then -
$ t1:='f$cvtime(t1)' if f$cvtime(f$file_attributes("CEXP.C","RDT")).ges.-
$ t2:='f$file_attributes("CEXP.C","RDT")' f$cvtime(f$file_attributes("CEXP.Y","RDT")) then goto skip_yacc
$ t2:='f$cvtime(t2)'
$ if t1 .les. t2 then goto 20$
$10$:
$ set verify $ set verify
$ 'BISON' cexp.y $ 'PARSER' cexp.y
$ 'RENAME' cexp_tab.c cexp.c $ 'RENAME' cexp_tab.c cexp.c
$!'f$verify(0) $!'f$verify(0)
$20$: $skip_yacc:
$! $ echo " (Ignore any warning about not finding file ""bison.simple"".)"
$ set verify
$ 'CC''CFLAGS' cexp.c
$!'f$verify(0)
$
$! In case there's no builtin alloca support, use the C simulation.
$ if f$locate("alloca.obj",f$edit(LIBS,"lowercase")).lt.f$length(LIBS) $ if f$locate("alloca.obj",f$edit(LIBS,"lowercase")).lt.f$length(LIBS)
$ then $ then
$ set verify $ set verify
$ 'CC''CFLAGS'/Define="STACK_DIRECTION=(-1)" alloca.c !#'f$verify(1) $ 'CC''CFLAGS'/Incl=[]/Defi=("HAVE_CONFIG_H","STACK_DIRECTION=(-1)") alloca.c
$!'f$verify(0) $!'f$verify(0)
$ endif $ endif
$! $!
$ echo " (Ignore any warning about not finding file ""bison.simple"".)" $
$ set verify
$ 'CC''CFLAGS' cexp.c
$ 'CC''CFLAGS' version.c
$!'f$verify(0)
$Link: $Link:
$ echo " Linking the preprocessor." $ echo " Linking the preprocessor."
$ set verify $ set verify
$ 'LINK''LDFLAGS'/Exe=gcc-cpp.exe cccp.obj,cexp.obj,version.obj,version.opt/Opt,- $ 'LINK''LDFLAGS'/Exe=gcc-cpp.exe -
cccp.obj,cexp.obj,version.obj,version.opt/Opt,-
'LIBS' 'LIBS'
$!'f$verify(0) $!'f$verify(0)
$! $!
$! Done $! Done
$! $!
$ exit $ exit 1+0*f$verify(v)
...@@ -8,7 +8,7 @@ $! ...@@ -8,7 +8,7 @@ $!
$! $!
$! First, build the preprocessor. $! First, build the preprocessor.
$! $!
$ @make-cccp $ @make-cccp.com 'p1' 'p2'
$! $!
$! To build the GNU C++ compiler in addition to the GNU CC compiler, comment $! To build the GNU C++ compiler in addition to the GNU CC compiler, comment
$! out the `@make-cc1' line, and uncomment the `@make-cc1 cc1 cc1plus' line. $! out the `@make-cc1' line, and uncomment the `@make-cc1 cc1 cc1plus' line.
...@@ -16,7 +16,7 @@ $! To also build Objective-C, add "cc1obj" to the list. ...@@ -16,7 +16,7 @@ $! To also build Objective-C, add "cc1obj" to the list.
$! $!
$! See the file make-cc1.com for a complete list of options. $! See the file make-cc1.com for a complete list of options.
$! $!
$ @make-cc1 $ @make-cc1.com 'p1' 'p2' 'p3' 'p4' 'p5' 'p6' 'p7' 'p8'
$! @make-cc1 cc1 cc1plus $! @make-cc1 cc1 cc1plus
$! $!
$! $!
...@@ -28,5 +28,5 @@ $! these same routines with different module names. ...@@ -28,5 +28,5 @@ $! these same routines with different module names.
$! $!
$! Now build gcclib2.olb $! Now build gcclib2.olb
$! $!
$ @make-l2 $ @make-l2.com
$! $!
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment