*** empty log message ***

From-SVN: r804
This commit is contained in:
Richard Stallman 1992-04-20 14:43:07 +00:00
parent 7025258008
commit 7f21178924
3 changed files with 382 additions and 295 deletions

View File

@ -2,11 +2,36 @@ $! Set the def dir to proper place for use in batch. Works for interactive too.
$flnm = f$enviroment("PROCEDURE") ! get current procedure name
$set default 'f$parse(flnm,,,"DEVICE")''f$parse(flnm,,,"DIRECTORY")'
$!
$ v=f$verify(0)
$set symbol/scope=(nolocal,noglobal)
$!
$! CAUTION: If you want to link gcc-cc1 to the sharable image library
$! VAXCRTL, see the notes in gcc.texinfo (or INSTALL) first.
$!
$! Build a GNU compiler on VMS
$! Build the GNU "C" compiler on VMS
$!
$! C compiler
$!
$ CC := gcc
$! CC := cc !uncomment for VAXC
$ BISON := bison
$ RENAME := rename/new_vers
$ LINK := link
$!
$! Compiler options
$!
$ CFLAGS = "/debug/cc1_options=""-mpcc-alignment""/incl=([],[.config])"
$! CFLAGS = "/noopt/incl=([],[.config])"
$!
$! Link options
$!
$ LDFLAGS := /nomap
$!
$! Link libraries
$!
$ LIBS := gnu_cc:[000000]gcclib.olb/libr,sys$library:vaxcrtl.olb/libr
$! LIBS := alloca.obj,sys$library:vaxcrtl.olb/libr
$!
$!
$! 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
@ -39,15 +64,18 @@ $!
$! If you do not specify which compiler you want to build, it is assumed that
$! you want to build GNU-C ("CC1").
$!
$! Now figure out what we have been requested to do.
$p1 = p1+" "+p2+" "+p3+" "+p4+" "+p5+" "+p6+" "+p7
$p1 = f$edit(p1,"COMPRESS")
$i=0
$DO_ALL = 0
$DO_LINK = 0
$DO_DEBUG = 0
$DO_CC1 = 0
$DO_CC1PLUS = 0
$DO_CC1OBJ = 0
$open cfile$ compilers.list
$cinit:read cfile$ compilername/end=cinit_done
$DO_'compilername'=0
$goto cinit
$cinit_done: close cfile$
$DO_INDEPENDENT = 1
$DO_DEFAULT = 1
$loop:
@ -66,27 +94,37 @@ $goto loop
$!
$done:
$if DO_DEFAULT.eq.1 then DO_CC1 = 1
$if DO_ALL.eq.1 then DO_CC1 = 1
$if DO_ALL.eq.1 then DO_CC1PLUS = 1
$if DO_ALL.eq.1 then DO_CC1OBJ = 1
$say:==write sys$Output
$say "This command file will now perform the following actions:
$echo := write sys$Output
$echo "This command file will now perform the following actions:
$if DO_LINK.eq.1 then goto link_only
$if DO_CC1.eq.1 then say " Compile C specific object modules."
$if DO_CC1PLUS.eq.1 then say " Compile C++ specific object modules."
$if DO_CC1OBJ.eq.1 then say " Compile obj-C specific object modules."
$if DO_INDEPENDENT.eq.1 then say " Compile language independent object modules."
$if DO_ALL.eq.1 then echo " Compile all language specific object modules."
$if DO_CC1.eq.1 then echo " Compile C specific object modules."
$if DO_CC1PLUS.eq.1 then echo " Compile C++ specific object modules."
$if DO_CC1OBJ.eq.1 then echo " Compile obj-C specific object modules."
$if DO_INDEPENDENT.eq.1 then echo " Compile language independent object modules."
$link_only:
$if DO_CC1.eq.1 then say " Link C compiler (gcc-cc1.exe)."
$if DO_CC1PLUS.eq.1 then say " Link C++ compiler (gcc-cc1plus.exe)."
$if DO_CC1OBJ.eq.1 then say " Link objective-C compiler (gcc-cc1obj.exe)."
$if DO_DEBUG.eq.1 then say " Link images to run under debugger."
$if DO_CC1.eq.1 then echo " Link C compiler (gcc-cc1.exe)."
$if DO_CC1PLUS.eq.1 then echo " Link C++ compiler (gcc-cc1plus.exe)."
$if DO_CC1OBJ.eq.1 then echo " Link objective-C compiler (gcc-cc1obj.exe)."
$if DO_DEBUG.eq.1 then echo " Link images to run under debugger."
$!
$! Test and see if we need these messages or not. The -1 switch gives it away.
$!
$gas := $gnu_cc:[000000]gcc-as.exe
$if f$search(gas-"$").eqs."" then goto gas_message !must be VAXC
$define/user sys$error sys$scratch:gas_test.tmp
$gas -1 nla0: -o nla0:
$size=f$file_attributes("sys$scratch:gas_test.tmp","ALQ")
$delete/nolog sys$scratch:gas_test.tmp;*
$if size.eq.0 then goto no_message
$gas_message:
$type sys$input
Note: GCC 2.0 treats external variables differently than GCC 1.40 does.
Before you use GCC 2.0, you should obtain a version of the assembler which
contains the patches to work with GCC 2.0 (GCC-AS 1.38 does not contain
these patches - whatever comes after this probably will).
these patches - whatever comes after this probably will). The assembler
in gcc-vms-1.40.tar.Z from prep does contain the proper patches.
If you do not update the assembler, the compiler will still work,
but `extern const' variables will be treated as `extern'. This will result
@ -94,300 +132,149 @@ in linker warning messages about mismatched psect attributes, and these
variables will be placed in read/write storage.
$!
$no_message:
$!
$!
$! CAUTION: If you want to link gcc-cc1 to the sharable image library
$! VAXCRTL, see the notes in gcc.texinfo (or INSTALL) first.
$!
$! Build the GNU "C" compiler on VMS
$! (To try to build with VAX C, replace `gcc' with `cc/noopt'
$! and delete `cc1_options="-mpcc-alignment"'.
$! Also add `/sel' after `gcclib/lib' except in the last link.
$! You also need to get alloca.mar from Bison
$! and to make definitions for bzero, bcopy and bcmp.)
$!
$! C compiler
$!
$ CC := gcc
$ BISON := bison
$ RENAME := rename
$ LINK := link
$!
$! Compiler options
$!
$ CFLAGS = "/debug/cc1_options=""-mpcc-alignment""/inc=([],[.config])"
$!
$! Link options
$!
$ LDFLAGS := /nomap
$ if DO_DEBUG.eq.1 then LDFLAGS :='LDFLAGS'/debug
$!
$! Link libraries
$if DO_LINK.eq.1 then goto compile_cc1
$if DO_INDEPENDENT.eq.1
$ THEN
$!
$ LIBS := gnu_cc:[000000]gcclib/libr,sys$share:vaxcrtl/libr
$! Build alloca if necessary (in 'LIBS for use with VAXC)
$!
$!
$!
$!
$! Language independent object and header files.
$!
$! create a linker options file that lists all of the language independent
$! object modules.
$!
$create independent.opt
!
! List of object files for the linker - these are language independent
! (i.e. the same files will be used for all of the compilers).
!
toplev,tree,print-tree,stor-layout,fold-const,varasm,rtl,rtlanal,expr,stmt
expmed,explow,optabs,emit-rtl,insn-emit,jump,cse,loop,flow,stupid,combine
regclass,local-alloc,global-alloc,reload,reload1,insn-peep,final,recog
insn-recog,insn-extract,insn-output,obstack,integrate,caller-save,calls
dwarfout,xcoffout,function,insn-attrtab,reorg,sched,sdbout,dbxout,unroll
reg-stack,aux-output,print-rtl,getpwd,version
$!
$pur/nolog independent.opt
$!
$ if DO_LINK.eq.1 then goto compile_cc1
$if DO_INDEPENDENT.eq.0 THEN GOTO compile_cc1
$ if f$locate("alloca.obj",f$edit(LIBS,"lowercase")).ge.f$length(LIBS) then -
goto skip_alloca
$ 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.-
f$cvtime(f$file_attributes("alloca.c","RDT")) then goto skip_alloca
$set verify
$ 'CC 'CFLAGS /define="STACK_DIRECTION=(-1)" alloca.c
$!'f$verify(0)
$skip_alloca:
$!
$! 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.
$!
$ 'CC 'CFLAGS rtl.c
$ 'CC 'CFLAGS obstack.c
$ 'CC 'CFLAGS print-rtl.c
$set verify
$ 'CC 'CFLAGS rtl.C
$ 'CC 'CFLAGS obstack.C
$!'f$verify(0)
$! Generate insn-attr.h
$ 'CC 'CFLAGS genattr.c
$ link 'LDFLAGS' genattr,rtl,obstack, 'LIBS'
$ assign/user insn-attr.h sys$output:
$ mcr sys$disk:[]genattr md
$! Generate insn-flags.h
$ 'CC 'CFLAGS genflags.c
$ link 'LDFLAGS' genflags,rtl,obstack, 'LIBS'
$ assign/user insn-flags.h sys$output:
$ mcr sys$disk:[]genflags md
$! Generate insn-codes.h
$ 'CC 'CFLAGS gencodes.c
$ link 'LDFLAGS' gencodes,rtl,obstack, 'LIBS'
$ assign/user insn-codes.h sys$output:
$ mcr sys$disk:[]gencodes md
$! Generate insn-config.h
$ 'CC 'CFLAGS genconfig.c
$ link 'LDFLAGS' genconfig,rtl,obstack, 'LIBS'
$ assign/user insn-config.h sys$output:
$ mcr sys$disk:[]genconfig md
$ call generate insn-attr.h
$ call generate insn-flags.h
$ call generate insn-codes.h
$ call generate insn-config.h
$!
$! Now compile the source modules
$call compile independent.opt "rtl,obstack,insn-attrtab"
$!
$ 'CC 'CFLAGS toplev.c
$ 'CC 'CFLAGS version.c
$ 'CC 'CFLAGS tree.c
$ 'CC 'CFLAGS print-tree.c
$ 'CC 'CFLAGS stor-layout.c
$ 'CC 'CFLAGS fold-const.c
$ 'CC 'CFLAGS varasm.c
$ 'CC 'CFLAGS expr.c
$ 'CC 'CFLAGS stmt.c
$ 'CC 'CFLAGS expmed.c
$ 'CC 'CFLAGS explow.c
$ 'CC 'CFLAGS optabs.c
$ 'CC 'CFLAGS rtlanal.c
$ 'CC 'CFLAGS emit-rtl.c
$! Generate insn-emit.c
$ 'CC 'CFLAGS genemit.c
$ link 'LDFLAGS' genemit,rtl,obstack, 'LIBS'
$ assign/user insn-emit.c sys$output:
$ mcr sys$disk:[]genemit md
$!
$ 'CC 'CFLAGS insn-emit.c
$ 'CC 'CFLAGS jump.c
$ 'CC 'CFLAGS cse.c
$ 'CC 'CFLAGS loop.c
$ 'CC 'CFLAGS flow.c
$ 'CC 'CFLAGS stupid.c
$ 'CC 'CFLAGS combine.c
$ 'CC 'CFLAGS regclass.c
$ 'CC 'CFLAGS local-alloc.c
$ 'CC 'CFLAGS global-alloc.c
$ 'CC 'CFLAGS reload.c
$ 'CC 'CFLAGS reload1.c
$! Generate insn-peep.c
$ 'CC 'CFLAGS genpeep.c
$ link 'LDFLAGS' genpeep,rtl,obstack, 'LIBS'
$ assign/user insn-peep.c sys$output:
$ mcr sys$disk:[]genpeep md
$!
$ 'CC 'CFLAGS insn-peep.c
$ 'CC 'CFLAGS final.c
$ 'CC 'CFLAGS recog.c
$! Generate insn-recog.c
$ 'CC 'CFLAGS genrecog.c
$ link 'LDFLAGS' genrecog,rtl,obstack, 'LIBS'
$ assign/user insn-recog.c sys$output:
$ mcr sys$disk:[]genrecog md
$!
$ 'CC 'CFLAGS insn-recog.c
$! Generate insn-extract.c
$ 'CC 'CFLAGS genextract.c
$ link 'LDFLAGS' genextract,rtl,obstack, 'LIBS'
$ assign/user insn-extract.c sys$output:
$ mcr sys$disk:[]genextract md
$!
$ 'CC 'CFLAGS insn-extract.c
$! Generate insn-output.c
$ 'CC 'CFLAGS genoutput.c
$ link 'LDFLAGS' genoutput,rtl,obstack, 'LIBS'
$ assign/user insn-output.c sys$output:
$ mcr sys$disk:[]genoutput md
$!
$ 'CC 'CFLAGS insn-output.c
$ 'CC 'CFLAGS integrate.c
$ 'CC 'CFLAGS caller-save.c
$ 'CC 'CFLAGS calls.c
$ 'CC 'CFLAGS dwarfout.c
$ 'CC 'CFLAGS dbxout.c
$ 'CC 'CFLAGS xcoffout.c
$ 'CC 'CFLAGS reg-stack.c
$ 'CC 'CFLAGS function.c
$ 'CC 'CFLAGS reorg.c
$ 'CC 'CFLAGS sched.c
$ 'CC 'CFLAGS sdbout.c
$ 'CC 'CFLAGS unroll.c
$! Generate insn-attrtab.c
$ 'CC 'CFLAGS genattrtab.c
$ link 'LDFLAGS' genattrtab,rtl,rtlanal,obstack, 'LIBS'
$ assign/user insn-attrtab.c sys$output:
$ mcr sys$disk:[]genattrtab md
$ 'CC 'CFLAGS insn-attrtab.c
$ 'CC 'CFLAGS aux-output.c
$ 'CC 'CFLAGS getpwd.c
$ call generate insn-attrtab.c "rtlanal,"
$set verify
$ 'CC 'CFLAGS insn-attrtab.c
$!'f$verify(0)
$ endif
$!
$compile_cc1:
$open cfile$ compilers.list
$cloop:read cfile$ compilername/end=cdone
$! language specific modules
$!
$! C language specific modules
$if (DO_ALL + DO_'compilername').eq.0 then goto cloop
$if DO_LINK.eq.0 then call compile 'compilername'-objs.opt "obstack"
$!
$if DO_CC1.eq.0 then goto compile_cc1plus
$if DO_LINK.eq.1 then goto link_cc1
$!
$ if (f$search("C-PARSE.C") .eqs. "") then goto gcc_bison
$ if (f$cvtime(f$file_attributes("C-PARSE.Y","RDT")).les. -
f$cvtime(f$file_attributes("C-PARSE.C","RDT"))) -
then goto gcc_nobison
$gcc_bison: 'BISON' /define /verbose c-parse.y
$ 'RENAME' c-parse_tab.c c-parse.c
$ 'RENAME' c-parse_tab.h c-parse.h
$gcc_nobison:
$ 'CC 'CFLAGS c-parse.c
$ 'CC 'CFLAGS c-lex.c
$ 'CC 'CFLAGS c-decl.c
$ 'CC 'CFLAGS c-typeck.c
$ 'CC 'CFLAGS c-convert.c
$ 'CC 'CFLAGS c-aux-info.c
$ 'CC 'CFLAGS c-common.c
$ 'CC 'CFLAGS c-lang.c
$!
$! CAUTION: If you want to link gcc-cc1 to the sharable image library
$! CAUTION: If you want to link gcc-cc1* to the sharable image library
$! VAXCRTL, see the notes in gcc.texinfo (or INSTALL) first.
$!
$link_cc1:
$ link 'LDFLAGS' /exe=gcc-cc1 version.opt/opt,sys$input:/opt, -
independent.opt/opt,'LIBS'
!
! "CC1" Linker options file
!
!
c-parse,c-decl,c-typeck,c-convert,c-aux-info,c-common,c-lang,c-lex
$!
$! C++ language specific modules
$!
$compile_cc1plus:
$!
$if DO_CC1PLUS.eq.0 then goto compile_cc1obj
$if DO_LINK.eq.1 then goto link_cc1plus
$!
$ if (f$search("CP-PARSE.C") .eqs. "") then goto cplus_bison
$ if (f$cvtime(f$file_attributes("CP-PARSE.Y","RDT")).les. -
f$cvtime(f$file_attributes("CP-PARSE.C","RDT"))) -
then goto cplus_nobison
$cplus_bison:
$ 'BISON' /define /verbose cp-parse.y
$ 'RENAME' cp-parse_tab.c cp-parse.c
$ 'RENAME' cp-parse_tab.h cp-parse.h
$cplus_nobison:
$!
$ 'CC 'CFLAGS cp-parse.c
$ 'CC 'CFLAGS cp-decl.c
$ 'CC 'CFLAGS cp-decl2.c
$ 'CC 'CFLAGS cp-typeck.c
$ 'CC 'CFLAGS cp-type2.c
$ 'CC 'CFLAGS cp-tree.c
$ 'CC 'CFLAGS cp-ptree.c
$ 'CC 'CFLAGS cp-cvt.c
$ 'CC 'CFLAGS cp-search.c
$ 'CC 'CFLAGS cp-lex.c
$ 'CC 'CFLAGS cp-gc.c
$ 'CC 'CFLAGS cp-call.c
$ 'CC 'CFLAGS cp-class.c
$ 'CC 'CFLAGS cp-init.c
$ 'CC 'CFLAGS cp-method.c
$ 'CC 'CFLAGS cp-except.c
$ 'CC 'CFLAGS cp-expr.c
$ 'CC 'CFLAGS cp-pt.c
$ 'CC 'CFLAGS cp-edsel.c
$ 'CC 'CFLAGS cp-xref.c
$ 'CC 'CFLAGS cp-spew.c
$ 'CC 'CFLAGS c-common.c
$!
$link_cc1plus:
$ link 'LDFLAGS' /exe=gcc-cc1plus version.opt/opt,sys$input:/opt, -
independent.opt/opt,'LIBS'
!
! "CC1PLUS" Linker options file
!
cp-parse,cp-decl,cp-decl2,cp-typeck,cp-type2,cp-tree
cp-ptree,cp-cvt,cp-search,cp-lex,cp-gc,cp-call,cp-class
cp-init,cp-method,cp-except,cp-expr,cp-pt,cp-edsel
cp-xref,cp-spew,c-common
$!
$! objective language specific modules
$!
$compile_cc1obj:
$if DO_CC1OBJ.eq.0 then goto all_done
$if DO_LINK.eq.1 then goto LINK_CC1OBJ
$!
$ if (f$search("OBJC-PARSE.C") .eqs. "") then goto objc_bison
$ if (f$cvtime(f$file_attributes("OBJC-PARSE.Y","RDT")).les. -
f$cvtime(f$file_attributes("OBJC-PARSE.C","RDT"))) -
then goto objc_nobison
$objc_bison:
$ 'BISON' /define /verbose OBJC-PARSE.y
$ 'RENAME' OBJC-PARSE_tab.c OBJC-PARSE.c
$ 'RENAME' OBJC-PARSE_tab.h OBJC-PARSE.h
$objc_nobison:
$ 'CC 'CFLAGS objc-parse.c
$ 'CC 'CFLAGS objc-actions.c
$!
$! If have also built CC1, we do not need to recompile these modules.
$!
$if DO_CC1.eq.1 then goto LINK_CC1OBJ
$ 'CC 'CFLAGS c-lex.c
$ 'CC 'CFLAGS c-decl.c
$ 'CC 'CFLAGS c-typeck.c
$ 'CC 'CFLAGS c-convert.c
$ 'CC 'CFLAGS c-aux-info.c
$ 'CC 'CFLAGS c-common.c
$set verify
$ link 'LDFLAGS' /exe=gcc-'compilername' version.opt/opt, -
'compilername'-objs.opt/opt, independent.opt/opt, -
'LIBS'
$!'f$verify(0)
$goto cloop
$!
$!
$LINK_CC1OBJ:
$ link 'LDFLAGS' /exe=gcc-cc1obj version.opt/opt,sys$input:/opt, -
independent.opt/opt,'LIBS'
!
! "Objective C" Linker options file
!
objc-parse,objc-actions,c-lex,c-decl,c-typeck,c-convert,c-aux-info,c-common
$!
$all_done:
$cdone: close cfile$
$!
$! Done
$!
$! 'f$verify(v)
$exit
$!
$! Various DCL subroutines follow...
$!
$! This routine takes parameter p1 to be a linker options file with a list
$! of object files that are needed. It extracts the names, and compiles
$! each source module, one by one. File names that begin with an
$! "INSN-" are assumed to be generated by a GEN*.C program.
$!
$! Parameter P2 is a list of files which will appear in the options file
$! that should not be compiled. This allows us to handle special cases.
$!
$compile:
$subroutine
$open ifile$ 'p1'
$loop: read ifile$ line/end=c_done
$!
$i=0
$loop1:
$flnm=f$element(i,",",line)
$i=i+1
$if flnm.eqs."" then goto loop
$if flnm.eqs."," then goto loop
$if f$locate(flnm,"''p2'").nes.f$length("''p2'") then goto loop1
$!
$if f$locate("-parse",flnm).nes.f$length(flnm)
$ then
$ if (f$search("''flnm'.C") .eqs. "") then goto yes_bison
$ if (f$cvtime(f$file_attributes("''flnm'.Y","RDT")).les. -
f$cvtime(f$file_attributes("''flnm'.C","RDT"))) -
then goto no_bison
$yes_bison:
$set verify
$ 'BISON' /define /verbose 'flnm'.y
$ 'RENAME' 'flnm'_tab.c 'flnm'.c
$ 'RENAME' 'flnm'_tab.h 'flnm'.h
$!'f$verify(0)
$no_bison:
$ endif
$!
$if f$extract(0,5,flnm).eqs."insn-" then call generate 'flnm'.c
$!
$set verify
$ 'CC 'CFLAGS 'flnm'.c
$!'f$verify(0)
$goto loop1
$!
$goto loop
$c_done:
$close ifile$
$endsubroutine
$!
$! This subroutine generates the insn-* files. The first argument is the
$! 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
$! program.
$!
$! If a previous version of insn-* exists, it is compared to the new one,
$! and if it has not changed, then the new one is discarded. This is
$! done so that make like programs do not get thrown off.
$!
$generate:
$subroutine
$if f$extract(0,5,p1).nes."INSN-"
$ then
$ write sys$error "Unknown file passed to generate."
$ exit 1
$ endif
$root1=f$parse(f$extract(5,255,p1),,,"NAME")
$ set verify
$ 'CC 'CFLAGS GEN'root1'.C
$ link 'LDFLAGS' GEN'root1',rtl,obstack,'p2' -
'LIBS'
$! 'f$verify(0)
$!
$set verify
$ assign/user 'p1' sys$output:
$ mcr sys$disk:[]GEN'root1' md
$!'f$verify(0)
$endsubroutine

View File

@ -2,8 +2,6 @@ $! Set the def dir to proper place for use in batch. Works for interactive too.
$flnm = f$enviroment("PROCEDURE") ! get current procedure name
$set default 'f$parse(flnm,,,"DEVICE")''f$parse(flnm,,,"DIRECTORY")'
$!
$set symbol/scope=(nolocal,noglobal)
$!
$! Command file to build libgcc2.olb. You should only run this once you
$! have the current compiler installed, otherwise some of the builtins will
$! not be recognized. Once you have built libgcc2.olb, you can merge this
@ -28,6 +26,9 @@ $!
$gcc_as:=$gnu_cc:[000000]gcc-as
$cpp_file:=sys$scratch:gcc_'f$getjpi(0,"pid")'.cpp
$s_file:=sys$scratch:gcc_'f$getjpi(0,"pid")'.s
$!
$set symbol/scope=(nolocal,noglobal)
$!
$goto compile
$!
$nocompile:
@ -79,10 +80,10 @@ $! We do this by hand, since the VMS compiler driver does not have a way
$! of specifying an alternate location for the compiler executables.
$!
$ gcc_cpp "-I[]" "-I[.CONFIG]" "-D''p1'" LIBGCC2.C 'cpp_file'
$ gcc_cc1 'cpp_file' -dumpbase LIBGCC2 -
$ gcc_cc1 'cpp_file' -dumpbase 'objname' -
-quiet -mgnu -g "-O1" -mvaxc-alignment -o 's_file'
$ delete/nolog 'cpp_file';
$ gcc_as 's_file' -o 'p1'.OBJ
$ gcc_as 's_file' -o 'objname'.OBJ
$ delete/nolog 's_file';
$!
$lib libgcc2.olb 'objname'.obj

View File

@ -1,6 +1,12 @@
$ !
$ ! Set up to compile GCC on VMS
$ !
$! Set the def dir to proper place for use in batch. Works for interactive too.
$flnm = f$enviroment("PROCEDURE") ! get current procedure name
$set default 'f$parse(flnm,,,"DEVICE")''f$parse(flnm,,,"DIRECTORY")'
$ !
$set symbol/scope=(nolocal,noglobal)
$ !
$ echo = "write sys$output"
$ !
$ if f$search("config.h") .nes. "" then delete config.h.*
@ -54,8 +60,201 @@ $close ifile$
$pur version.opt/nolog
$!
$!
$! create linker options files that lists all of the components for all
$! possible compilers. We do this by editing the file Makefile.in, and
$! generating the relevant files from it.
$!
$!
$echo "Now processing Makefile.in to generate linker option files."
$edit/tpu/nojournal/nosection/nodisplay/command=sys$input
PROCEDURE generate_option_file (TAG_NAME, outfile)
position (beginning_of (newbuffer));
recursive_fetch_tag (TAG_NAME);
!
! Now fix up a few things in the output buffer
!
pat_replace (".o ",",");
pat_replace (".o",""); !appear at end of lines.
!
! Remove trailing commas, if present.
!
position (beginning_of (newbuffer));
LOOP
range1:=search_quietly("," & ((SPAN(" ") & LINE_END) | LINE_END), FORWARD, EXACT);
exitif range1 = 0;
position (beginning_of (range1));
erase(range1);
split_line;
ENDLOOP;
! get rid of leading spaces on lines.
position (beginning_of (current_buffer)) ;
LOOP
range1 := search_quietly ( LINE_BEGIN & " ", FORWARD, EXACT) ;
EXITIF range1 = 0;
position (end_of (range1));
erase_character(1);
ENDLOOP;
!
! Now write the output file.
!
SET(OUTPUT_FILE, newbuffer, outfile);
write_file (newbuffer);
erase (newbuffer);
ENDPROCEDURE;
!
! Looks up a tag, copies it to newbuffer, and then translates any $(...)
! definitions that appear. The translation is put at the current point.
!
PROCEDURE recursive_fetch_tag (TAG_N);
fetch_tag (TAG_N);
!
! substitute any makefile symbols $(...)
!
position (beginning_of (current_buffer)) ;
LOOP
range1 := search_quietly ("$(" &
SPAN("abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ#~0123456789") & ")", FORWARD, EXACT) ;
EXITIF range1 = 0;
position (beginning_of (range1));
move_horizontal(2);
mark_1 := MARK (NONE);
position (end_of (range1));
move_horizontal(-1);
mark_2 := MARK (NONE);
tag_range := CREATE_RANGE(MARK_1, MARK_2, NONE);
position (end_of (range1));
tag_string := STR (tag_range);
erase (range1);
fetch_tag (LINE_BEGIN & tag_string & ((SPAN(" ") & "=") | "="));
position (beginning_of (current_buffer)) ;
ENDLOOP;
ENDPROCEDURE;
!
! Looks up the translation of a tag, and inserts it at the current location
! in the buffer
!
PROCEDURE fetch_tag (TAG_N);
LOCAL mark1, mark2, mark3, range2;
mark3 := MARK(NONE) ;
position (beginning_of (mainbuffer)) ;
range2 := search_quietly (TAG_N, FORWARD, EXACT) ;
IF (range2 = 0) then
position (mark3);
return;
endif;
position (end_of (range2)) ;
MOVE_HORIZONTAL(1);
mark1 := MARK(NONE) ;
position (beginning_of (range2)) ;
MOVE_VERTICAL(1);
MOVE_HORIZONTAL(-2);
LOOP
EXITIF CURRENT_CHARACTER <> "\" ;
ERASE_CHARACTER(1);
MOVE_HORIZONTAL(1);
MOVE_VERTICAL(1);
MOVE_HORIZONTAL(-2);
ENDLOOP;
MOVE_HORIZONTAL(1);
mark2 := MARK(NONE) ;
range2 := CREATE_RANGE(mark1, mark2, NONE) ;
position (mark3);
if (length(range2) = 0) then return; endif;
copy_text(range2);
ENDPROCEDURE;
PROCEDURE pat_replace (
oldstring, !
newstring) !
LOCAL range2;
position (beginning_of (current_buffer)) ;
LOOP
range2 := search_quietly (oldstring, FORWARD, EXACT) ;
EXITIF range2 = 0 ;
position (beginning_of (range2)) ;
erase (range2) ;
copy_text (newstring) ;
ENDLOOP ;
ENDPROCEDURE ;
! this is the start of the main procedure
filename := GET_INFO (COMMAND_LINE, 'file_name') ;
mainbuffer := CREATE_BUFFER ("Makefile.in", "Makefile.in") ;
newbuffer := CREATE_BUFFER("outfile");
compiler_list := CREATE_BUFFER("compilers");
!
! Add to this list, as required. The file "Makefile.in" is searched for a
! tag that looks like "LINE_BEGIN + 'tag + (optional space) + "="". The
! contents are assumed to be a list of object files, and from this list a
! VMS linker options file is generated.
!
position (beginning_of (compiler_list));
recursive_fetch_tag(LINE_BEGIN & "COMPILERS" & ((SPAN(" ") & "=") | "="));
position (beginning_of (compiler_list));
LOOP ! kill leading spaces.
exitif current_character <> " ";
erase_character(1);
ENDLOOP;
position (beginning_of (compiler_list));
LOOP ! remove any double spaces.
range1 := search_quietly (" ", FORWARD, EXACT) ; EXITIF range1 = 0 ;
position (beginning_of (range1)) ;
erase_character(1);
ENDLOOP ;
position (end_of (compiler_list));
move_horizontal(-1);
LOOP ! kill trailing spaces.
exitif current_character <> " ";
erase_character(1);
move_horizontal(-1);
ENDLOOP;
position (beginning_of (compiler_list));
LOOP
range1 := search_quietly (" ", FORWARD, EXACT) ;
EXITIF range1 = 0 ;
position (beginning_of (range1)) ;
erase (range1) ;
split_line;
ENDLOOP ;
!
! We now have a list of supported compilers. Now write it, and use it.
!
SET(OUTPUT_FILE, compiler_list, "compilers.list");
write_file (compiler_list);
generate_option_file(LINE_BEGIN & "OBJS" & ((SPAN(" ") & "=") | "="),"independent.opt");
!
! Now change OBJS in the Makefile, so each language specific options file
! does not pick up all of the language independent files.
!
position (beginning_of (mainbuffer));
range1 := search_quietly (LINE_BEGIN & "OBJS" & ((SPAN(" ") & "=") | "="), FORWARD, EXACT) ;
position (end_of (range1));
split_line;
position (beginning_of (compiler_list));
LOOP
cmark := mark(NONE);
exitif cmark = end_of(compiler_list);
message(current_line);
generate_option_file(LINE_BEGIN & Current_line & ((SPAN(" ") & ":") | ":"),
current_line+"-objs.opt");
position (cmark);
move_vertical(1);
ENDLOOP ;
quit ;
$ echo ""
$!
$! Remove excessive versions of the options file...
$!
$purge/nolog *.opt
$purge/nolog compilers.list
$!
$!
$!
$ if f$search("config.status") .nes. "" then delete config.status.*
$ open/write file config.status
$ write file "Links are now set up for use with a vax running VMS."
$ close file
$ type config.status
$ echo ""