|
|
1.1 root 1: $ !
2: $ ! Set up to compile GCC on VMS
3: $ !
1.1.1.2 ! root 4: $! Set the def dir to proper place for use in batch. Works for interactive too.
! 5: $flnm = f$enviroment("PROCEDURE") ! get current procedure name
! 6: $set default 'f$parse(flnm,,,"DEVICE")''f$parse(flnm,,,"DIRECTORY")'
! 7: $ !
! 8: $set symbol/scope=(nolocal,noglobal)
! 9: $ !
1.1 root 10: $ echo = "write sys$output"
11: $ !
12: $ if f$search("config.h") .nes. "" then delete config.h.*
13: $ copy [.config]xm-vms.h []config.h
14: $ echo "Linked `config.h' to `[.config]xm-vms.h'.
15: $ !
16: $ if f$search("tm.h") .nes. "" then delete tm.h.*
17: $ copy [.config]vms.h []tm.h
18: $ echo "Linked `tm.h' to `[.config]vms.h'.
19: $ !
20: $ if f$search("md.") .nes. "" then delete md..*
21: $ copy [.config]vax.md []md.
22: $ echo "Linked `md' to `[.config]vax.md'.
23: $ !
24: $ if f$search("aux-output.c") .nes. "" then delete aux-output.c.*
25: $ copy [.config]vax.c []aux-output.c
26: $ echo "Linked `aux-output.c' to `[.config]vax.c'.
27: $ !
28: $!
29: $!
30: $! Create the file version.opt, which helps identify the executable.
31: $!
32: $search version.c version_string,"="/match=and/output=t.tmp
33: $open ifile$ t.tmp
34: $read ifile$ line
35: $close ifile$
36: $delete/nolog t.tmp;
37: $ijk=f$locate("""",line)+1
38: $line=f$extract(ijk,f$length(line)-ijk,line)
39: $ijk=f$locate("""",line)
40: $line=f$extract(0,ijk,line)
41: $ijk=f$locate("\n",line)
42: $line=f$extract(0,ijk,line)
43: $!
44: $i=0
45: $loop:
46: $elm=f$element(i," ",line)
47: $if elm.eqs."" then goto no_ident
48: $if (elm.les."9").and.(elm.ges."0") then goto write_ident
49: $i=i+1
50: $goto loop
51: $!
52: $no_ident:
53: $elm="?.??"
54: $!
55: $!
56: $write_ident:
57: $open ifile$ version.opt/write
58: $write ifile$ "ident="+""""+elm+""""
59: $close ifile$
60: $pur version.opt/nolog
61: $!
62: $!
1.1.1.2 ! root 63: $! create linker options files that lists all of the components for all
! 64: $! possible compilers. We do this by editing the file Makefile.in, and
! 65: $! generating the relevant files from it.
! 66: $!
! 67: $!
! 68: $! Make a copy of the makefile if the sources are on a disk that is NFS
! 69: $! mounted on a unix machine.
! 70: $if f$search("Makefile.in").eqs."" .and. f$search("$M$akefile.in").nes."" -
! 71: then copy $M$akefile.in Makefile.in
! 72: $!
! 73: $!
! 74: $echo "Now processing Makefile.in to generate linker option files."
! 75: $edit/tpu/nojournal/nosection/nodisplay/command=sys$input
! 76: PROCEDURE generate_option_file (TAG_NAME, outfile)
! 77: position (beginning_of (newbuffer));
! 78: recursive_fetch_tag (TAG_NAME);
! 79: !
! 80: ! Now fix up a few things in the output buffer
! 81: !
! 82: pat_replace (".o ",",");
! 83: pat_replace (".o",""); !appear at end of lines.
! 84: !
! 85: ! Remove trailing commas, if present.
! 86: !
! 87: position (beginning_of (newbuffer));
! 88: LOOP
! 89: range1:=search_quietly("," & ((SPAN(" ") & LINE_END) | LINE_END), FORWARD, EXACT);
! 90: exitif range1 = 0;
! 91: position (beginning_of (range1));
! 92: erase(range1);
! 93: split_line;
! 94: ENDLOOP;
! 95: ! get rid of leading spaces on lines.
! 96: position (beginning_of (current_buffer)) ;
! 97: LOOP
! 98: range1 := search_quietly ( LINE_BEGIN & " ", FORWARD, EXACT) ;
! 99: EXITIF range1 = 0;
! 100: position (end_of (range1));
! 101: erase_character(1);
! 102: ENDLOOP;
! 103: !
! 104: ! Now write the output file.
! 105: !
! 106: SET(OUTPUT_FILE, newbuffer, outfile);
! 107: write_file (newbuffer);
! 108: erase (newbuffer);
! 109: ENDPROCEDURE;
! 110:
! 111: !
! 112: ! Looks up a tag, copies it to newbuffer, and then translates any $(...)
! 113: ! definitions that appear. The translation is put at the current point.
! 114: !
! 115: PROCEDURE recursive_fetch_tag (TAG_N);
! 116: fetch_tag (TAG_N);
! 117: !
! 118: ! substitute any makefile symbols $(...)
! 119: !
! 120: position (beginning_of (current_buffer)) ;
! 121: LOOP
! 122: range1 := search_quietly ("$(" &
! 123: SPAN("abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ#~0123456789") & ")", FORWARD, EXACT) ;
! 124: EXITIF range1 = 0;
! 125: position (beginning_of (range1));
! 126: move_horizontal(2);
! 127: mark_1 := MARK (NONE);
! 128: position (end_of (range1));
! 129: move_horizontal(-1);
! 130: mark_2 := MARK (NONE);
! 131: tag_range := CREATE_RANGE(MARK_1, MARK_2, NONE);
! 132: position (end_of (range1));
! 133: tag_string := STR (tag_range);
! 134: erase (range1);
! 135: fetch_tag (LINE_BEGIN & tag_string & ((SPAN(" ") & "=") | "="));
! 136: position (beginning_of (current_buffer)) ;
! 137: ENDLOOP;
! 138: ENDPROCEDURE;
! 139:
! 140: !
! 141: ! Looks up the translation of a tag, and inserts it at the current location
! 142: ! in the buffer
! 143: !
! 144: PROCEDURE fetch_tag (TAG_N);
! 145: LOCAL mark1, mark2, mark3, range2;
! 146: mark3 := MARK(NONE) ;
! 147: position (beginning_of (mainbuffer)) ;
! 148: range2 := search_quietly (TAG_N, FORWARD, EXACT) ;
! 149: IF (range2 = 0) then
! 150: position (mark3);
! 151: return;
! 152: endif;
! 153: position (end_of (range2)) ;
! 154: MOVE_HORIZONTAL(1);
! 155: mark1 := MARK(NONE) ;
! 156: position (beginning_of (range2)) ;
! 157: MOVE_VERTICAL(1);
! 158: MOVE_HORIZONTAL(-2);
! 159: LOOP
! 160: EXITIF CURRENT_CHARACTER <> "\" ;
! 161: ERASE_CHARACTER(1);
! 162: MOVE_HORIZONTAL(1);
! 163: MOVE_VERTICAL(1);
! 164: MOVE_HORIZONTAL(-2);
! 165: ENDLOOP;
! 166: MOVE_HORIZONTAL(1);
! 167: mark2 := MARK(NONE) ;
! 168: range2 := CREATE_RANGE(mark1, mark2, NONE) ;
! 169: position (mark3);
! 170: if (length(range2) = 0) then return; endif;
! 171: copy_text(range2);
! 172: ENDPROCEDURE;
! 173:
! 174: PROCEDURE pat_replace (
! 175: oldstring, !
! 176: newstring) !
! 177: LOCAL range2;
! 178: position (beginning_of (current_buffer)) ;
! 179: LOOP
! 180: range2 := search_quietly (oldstring, FORWARD, EXACT) ;
! 181: EXITIF range2 = 0 ;
! 182: position (beginning_of (range2)) ;
! 183: erase (range2) ;
! 184: copy_text (newstring) ;
! 185: ENDLOOP ;
! 186: ENDPROCEDURE ;
! 187:
! 188: ! this is the start of the main procedure
! 189: filename := GET_INFO (COMMAND_LINE, 'file_name') ;
! 190: mainbuffer := CREATE_BUFFER ("Makefile.in", "Makefile.in") ;
! 191: newbuffer := CREATE_BUFFER("outfile");
! 192: compiler_list := CREATE_BUFFER("compilers");
! 193: !
! 194: ! Add to this list, as required. The file "Makefile.in" is searched for a
! 195: ! tag that looks like "LINE_BEGIN + 'tag + (optional space) + "="". The
! 196: ! contents are assumed to be a list of object files, and from this list a
! 197: ! VMS linker options file is generated.
! 198: !
! 199: position (beginning_of (compiler_list));
! 200: recursive_fetch_tag(LINE_BEGIN & "COMPILERS" & ((SPAN(" ") & "=") | "="));
! 201: position (beginning_of (compiler_list));
! 202: LOOP ! kill leading spaces.
! 203: exitif current_character <> " ";
! 204: erase_character(1);
! 205: ENDLOOP;
! 206: position (beginning_of (compiler_list));
! 207: LOOP ! remove any double spaces.
! 208: range1 := search_quietly (" ", FORWARD, EXACT) ; EXITIF range1 = 0 ;
! 209: position (beginning_of (range1)) ;
! 210: erase_character(1);
! 211: ENDLOOP ;
! 212: position (end_of (compiler_list));
! 213: move_horizontal(-1);
! 214: LOOP ! kill trailing spaces.
! 215: exitif current_character <> " ";
! 216: erase_character(1);
! 217: move_horizontal(-1);
! 218: ENDLOOP;
! 219: position (beginning_of (compiler_list));
! 220: LOOP
! 221: range1 := search_quietly (" ", FORWARD, EXACT) ;
! 222: EXITIF range1 = 0 ;
! 223: position (beginning_of (range1)) ;
! 224: erase (range1) ;
! 225: split_line;
! 226: ENDLOOP ;
! 227: !
! 228: ! We now have a list of supported compilers. Now write it, and use it.
! 229: !
! 230: SET(OUTPUT_FILE, compiler_list, "compilers.list");
! 231: write_file (compiler_list);
! 232: generate_option_file(LINE_BEGIN & "OBJS" & ((SPAN(" ") & "=") | "="),"independent.opt");
! 233: generate_option_file(LINE_BEGIN & "LIB2FUNCS" & ((SPAN(" ") & "=") | "="),"libgcc2.list");
! 234: !
! 235: ! Now change OBJS in the Makefile, so each language specific options file
! 236: ! does not pick up all of the language independent files.
! 237: !
! 238: position (beginning_of (mainbuffer));
! 239: range1 := search_quietly (LINE_BEGIN & "OBJS" & ((SPAN(" ") & "=") | "="), FORWARD, EXACT) ;
! 240: position (end_of (range1));
! 241: split_line;
! 242: position (beginning_of (compiler_list));
! 243: LOOP
! 244: cmark := mark(NONE);
! 245: exitif cmark = end_of(compiler_list);
! 246: message(current_line);
! 247: generate_option_file(LINE_BEGIN & Current_line & ((SPAN(" ") & ":") | ":"),
! 248: current_line+"-objs.opt");
! 249: position (cmark);
! 250: move_vertical(1);
! 251: ENDLOOP ;
! 252: quit ;
! 253: $ echo ""
! 254: $!
! 255: $! Remove excessive versions of the options file...
! 256: $!
! 257: $purge/nolog *.opt
! 258: $purge/nolog compilers.list
! 259: $!
! 260: $!
! 261: $!
1.1 root 262: $ if f$search("config.status") .nes. "" then delete config.status.*
263: $ open/write file config.status
264: $ write file "Links are now set up for use with a vax running VMS."
265: $ close file
266: $ type config.status
1.1.1.2 ! root 267: $ echo ""
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.