summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/gcc/make-cccp.com
blob: 342c71015a4ad3c47df75aff575d42ddb8eeb1dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
$v='f$verify(0)	!make-cccp.com
$!
$!	Build the GNU C preprocessor on VMS.
$!
$!	Usage:
$!	  $ @make-cccp.com [compiler] [link-only]
$!
$!	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.
$!
$ if f$type(gcc_debug).eqs."INTEGER" then  if gcc_debug.and.1 then  set verify
$
$ p1 = f$edit(p1,"UPCASE,TRIM")
$ if p1.eqs."" then  p1 = "GNUC"
$!
$!	Compiler-specific setup (assume GNU C, then override as necessary):
$!
$ CC	 = "gcc"
$ CFLAGS = "/Opt=2/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"
$	CC = CC + "/Prefix=All"
$	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
$
$!
$!	Other setup:
$!
$ LDFLAGS =	"/noMap"
$ PARSER  =	"bison"
$ RENAME  =	"rename/New_Version"
$ LINK	  =	"link"
$ echo	  =	"write sys$output"
$
$!!!!!!!
$!	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")'
$
$ if p1.eqs."LINK" .or. p2.eqs."LINK" then  goto Link
$ 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
$ 'CC''CFLAGS' cccp.c
$!'f$verify(0)
$
$! Compile preprocessor's parser, possibly making it with yacc first.
$ if f$search("CEXP.C").nes."" then -
    if f$cvtime(f$file_attributes("CEXP.C","RDT")).ges.-
       f$cvtime(f$file_attributes("CEXP.Y","RDT")) then  goto skip_yacc
$ set verify
$ 'PARSER' cexp.y
$ 'RENAME' cexp_tab.c cexp.c
$!'f$verify(0)
$skip_yacc:
$ echo " (Ignore any warning about not finding file ""bison.simple"".)"
$ set verify
$ 'CC''CFLAGS' cexp.c
$ 'CC''CFLAGS'/Define="PREFIX=""_dummy_""" prefix.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)
$ then
$  set verify
$ 'CC''CFLAGS'/Incl=[]/Defi=("HAVE_CONFIG_H","STACK_DIRECTION=(-1)") alloca.c
$!'f$verify(0)
$ endif
$!
$
$Link:
$ echo " Linking the preprocessor."
$ set verify
$ 'LINK''LDFLAGS'/Exe=gcc-cpp.exe -
	  cccp.obj,cexp.obj,prefix.obj,version.obj,version.opt/Opt,-
	  'LIBS'
$!'f$verify(0)
$!
$!	Done
$!
$ exit 1+0*f$verify(v)