xref: /netbsd-src/external/bsd/pcc/dist/pcc/driver/cc.din (revision ae87de8892f277bece3527c15b186ebcfa188227)
1#	Id
2#	$NetBSD: cc.din,v 1.1.1.1 2016/02/09 20:29:11 plunky Exp $
3#
4#	PCC driver descriptor input. This is passed to the
5#	autoconf substitution then run by the driver tool
6#	to generate C source. It should be fairly simple
7#	to understand; lines starting at the first column
8#	start a new statement, continued on indented lines
9#	with a list of match/action pairs.
10#
11
12#
13# our name
14#
15#
16
17name @BINPREFIX@@PCC@@EXEEXT@
18	*		set clib
19
20name @BINPREFIX@@PXX@@EXEEXT@
21	*		set cxxlib
22
23name @BINPREFIX@@CPP@@EXEEXT@
24	*		set exit-after-cpp
25
26name @BINPREFIX@@FTN@@EXEEXT@
27	*		set f77lib
28
29#
30# make <ext> from <ext> with <program>
31#
32#    runs <program>,
33#    exit after, if exit-after-<program> is set
34#
35
36filetype C is *.c
37filetype PREPROCESSED-C is *.i
38filetype C++ is *.C, *.cc, *.cpp, *.CPP, *.cxx, *.c++
39filetype PREPROCESSED-C++ is *.I, *.ii
40filetype FORTRAN-CPP is *.F
41filetype FORTRAN is *.f
42filetype ASM-CPP is *.S
43filetype ASM is *.s
44filetype OBJ is *.o
45
46make PREPROCESSED-C from C with CPP
47make PREPROCESSED-C++ from C++ with CPP
48make FORTRAN from FOTRAN-CPP with CPP
49make ASM from ASM-CPP with CPP
50make ASM from PREPROCESSED-C with CCOM
51make ASM from PREPROCESSED-C++ with CXXCOM
52make ASM from FORTRAN with FCOM
53make OBJ from ASM with ASSEMBLER
54make PROGRAM from OBJ with LINKER
55
56# C source to preprocess
57make i from c with cpp
58
59# C++ source to preprocess
60make I from C with cpp
61make I from cc with cpp
62make I from cp with cpp
63make I from cpp with cpp
64make I from CPP with cpp
65make I from cxx with cpp
66make I from c++ with cpp
67
68# Fortran source to preprocess
69make f from F with cpp
70
71# Assembler source to preprocess
72make s from S with cpp
73
74# C source to compile
75make s from i with ccom
76
77# C++ source to compile
78make s from I with cxxcom
79
80# Fortran source to compile
81make s from f with fcom
82
83# Assembler source
84make o from s with assembler
85
86# All other files go to linker
87make a.out from * with linker
88
89#
90# default options
91#
92set stdinc
93set stddef
94set stdlib
95set startfiles
96set hosted=1
97set @GCC_COMPAT@
98set os_@TARGOS@
99set mach_@TARGMACH@
100
101#
102# option <string> <command>
103#
104#    * matches any string
105#    + requires additional argument
106#
107#    command is one of
108#	set <feature>
109#	unset <feature>
110#	set <variable>=<value>
111#	add <array>
112#	add <array> using <alternate> instead of <string>
113#	expand <list>
114#
115
116#
117option --param+			# ignored
118option --sysroot=*		set sysroot
119option --version		set show-version		# internal
120
121#
122option -C			add cpp-args
123option -c			set exit-after-as
124option -D+			add cpp-args
125option -E			set exit-after-cpp
126option -fPIC			set pic
127option -fpic			set pic
128option -ffreestanding		set hosted=0
129option -f+			add ccom-args
130option -g0			set gflag=0
131option -g1			set gflag=1
132option -g2			set gflag=2
133option -g3			set gflag=3
134option -g*			# ignore
135option -I+			add cpp-args
136option -include+		add cpp-args using -i
137option -isystem+		add cpp-args using -S
138option -k			set pic
139option -M			add cpp-args
140option -m+			add ccom-args
141option -undef			unset stddef
142option -nostartfiles		unset startfiles
143option -nostdinc		unset stdinc
144option -O0			set optimize=0
145option -O1			set optimize=1
146option -O2			set optimize=2
147option -O3			set optimize=3
148option -Os			set optimize=1
149option -O*			# ignore
150option -o+			set outfile
151option -S			set exit-after-ccom
152option -shared			set shared
153option -static			set static
154option -std=gnu99		set gnu99
155option -std=gnu89		set gnu99
156option -std=gnu9x		set gnu99
157option -std=*			# ignore other std
158option -t			set traditional
159option -traditional		set traditional
160option -U+			add cpp-args
161option -v			set verbose
162option -xc			set filetype=C
163option -xc-cpp-output		set filetype=PREPROCESSED-C
164option -xc++			set filetype=C++
165option -xc++-cpp-output		set filetype=PREPROCESSED-C++
166option -xassembler		set filetype=ASM
167option -xassembler-with-cpp	set filetype=ASM-CPP
168option -xf77			set filetype=FORTRAN
169option -xf77-cpp-input		set filetype=FORTRAN-CPP
170option -x+			add ccom-args
171
172option -Wa,*			expand as-args
173option -Wc,*			expand ccom-args
174option -Wl,*			expand linker-args
175option -Wp,*			expand cpp-args
176
177# treat warnings as errors
178option -Werror
179
180# enable warnings
181option -Wtruncate
182option -Wstrict-prototypes
183option -Wmissing-prototypes
184option -Wimplicit-int
185option -Wimplicit-function-declaration
186option -Wshadow
187option -Wpointer-sign
188option -Wsign-compare
189option -Wunknown-pragmas
190option -Wunreachable-code
191
192# disable warnings
193option -Wno-truncate			unset Wtruncate
194option -Wno-strict-prototypes		unset Wstrict-prototypes
195option -Wno-missing-prototypes		unset Wmissing-prototypes
196option -Wno-implicit-int		unset Wimplicit-int
197option -Wno-implicit-function-declaration	unset Wimplicit-function-declaration
198option -Wno-shadow			unset Wshadow
199option -Wno-pointer-sign		unset Wpointer-sign
200option -Wno-sign-compare		unset Wsign-compare
201option -Wno-unknown-pragmas		unset Wunknown-pragmas
202option -Wno-unreachable-code		unset Wunreachable-code
203
204# enable all warnings
205option -WW
206	*				set Wtruncate
207	*				set Wstrict-prototypes
208	*				set Wmissing-prototypes
209	*				set Wimplicit-int
210	*				set Wimplicit-function-declaration
211	*				set Wshadow
212	*				set Wpointer-sign
213	*				set Wsign-compare
214	*				set Wunknown-pragmas
215	*				set Wunreachable-code
216
217# enable gcc warnings
218option -Wall
219	*				set Wimplicit-int
220	*				set Wimplicit-function-declaration
221	*				set Wpointer-sign
222	*				set Wunknown-pragmas
223
224option -W*				# ignore any others
225
226option *				add ld-args
227
228#
229# define <set>
230#        <feature>			<string>
231#
232# list of feature, string tuples makes a definition, the string
233# is included in the list if the feature is set. string may
234# include the $ sign, which means a variable substitution
235#
236
237# BSD 2.11
238#
239define cpp-defs-bsd
240	*				-D__BSD2_11__
241	*				-DBSD2_11
242	mach_pdp11			-D__pdp11__
243	mach_pdp11			-Dpdp11
244
245# Darwin
246#
247define cpp-defs-darwin
248	*				-D__Darwin__
249	*				-D__APPLE__
250	mach_i386			-D__i386__
251	mach_i386			-D__LITTLE_ENDIAN__
252	mach_powerpc			-D__ppc__
253	mach_powerpc			-D__BIG_ENDIAN__
254	mach_amd64			-D__x86_64__
255	mach_amd64			-D__LITTLE_ENDIAN__
256
257# DragonflyBSD
258#
259define cpp-defs-dragonfly
260	*				-D__DragonFly__
261	mach_i386			-D__i386__
262	mach_amd64			-D__amd64__
263	mach_amd64			-D__amd64
264	mach_amd64			-D__x86_64__
265	mach_amd64			-D__x86_64
266	mach_amd64			-D__LP64__
267	mach_amd64			-D_LP64
268
269# FreeBSD
270#
271define cpp-defs-freebsd
272	*				-D__FreeBSD__=@TARGOSVER@
273	*				-D__unix__
274	*				-D__unix
275	mach_i386			-D__i386__
276	mach_i386			-D__i386
277	mach_amd64			-D__amd64__
278	mach_amd64			-D__amd64
279	mach_amd64			-D__x86_64__
280	mach_amd64			-D__x86_64
281	mach_amd64			-D__LP64__
282	mach_amd64			-D_LP64
283
284# Linux
285#
286define cpp-defs-linux
287	*				-D__linux__
288	mach_i386			-D__i386__
289	mach_powerpc			-D__ppc__
290	mach_amd64			-D__x86_64__
291	mach_mips			-D__mips__
292
293# MidnightBSD
294#
295define cpp-defs-midnightbsd
296	*				-D__MidnightBSD__
297	*				-D__FreeBSD__
298	*				-D__unix__
299	*				-D__unix
300	*				-Dunix
301	*				-D_LONGLONG
302	mach_i386			-D__i386__
303	mach_i386			-D__i386
304	mach_i386			-Di386
305	mach_sparc64			-D__sparc64__
306	mach_sparc64			-D__sparc_v9__
307	mach_sparc64			-D__sparcv9
308	mach_sparc64			-D__sparc__
309	mach_sparc64			-D__sparc
310	mach_sparc64			-Dsparc
311	mach_sparc64			-D__arch64__
312	mach_sparc64			-D__LP64__
313	mach_sparc64			-D_LP64
314
315# Minix
316#
317define cpp-defs-minix
318	*				-D__minix
319	mach_i386			-D__i386
320	mach_i386			-D_EM_DSIZE=8
321	mach_i386			-D_EM_FSIZE=4
322	mach_i386			-D_EM_LSIZE=4
323	mach_i386			-D_EM_PSIZE=4
324	mach_i386			-D_EM_SSIZE=2
325	mach_i386			-D_EM_WSIZE=4
326
327# MirBSD
328#
329define cpp-defs-mirbsd
330	*				-D__MirBSD__
331	*				-D__OpenBSD__
332	*				-D__unix__
333	mach_i386			-D__i386__
334	mach_i386			-D__i386
335	mach_i386			-Di386
336
337# NetBSD
338#
339define cpp-defs-netbsd
340	*				-D__NetBSD__
341	mach_amd64			-D__amd64__
342	mach_amd64			-D__amd64
343	mach_amd64			-D__x86_64__
344	mach_amd64			-D__x86_64
345	mach_amd64			-D__LP64__
346	mach_amd64			-D_LP64
347	mach_i386			-D__i386__
348	mach_mips			-D__mips__
349	mach_arm			-D__arm__
350	mach_vax			-D__vax__
351	mach_sparc64			-D__sparc64__
352
353# NextStep
354#
355define cpp-defs-nextstep
356	*				-D__NeXT__
357	mach_i386			-D__i386__
358	mach_i386			-D__LITTLE_ENDIAN__
359	mach_powerpc			-D__ppc__
360	mach_powerpc			-D__BIG_ENDIAN__
361
362# OpenBSD
363#
364define cpp-defs-openbsd
365	*				-D__OpenBSD__
366	mach_amd64			-D__amd64__
367	mach_i386			-D__i386__
368	mach_powerpc			-D__powerpc__
369	mach_vax			-D__vax__
370	mach_sparc64			-D__sparc64__
371
372# SunOS
373#
374define cpp-defs-sunos
375	*				-Dunix
376	*				-Dsun
377	*				-D__SVR4
378	*				-D__unix
379	*				-D__sun
380	*				-D__SunOS
381	mach_i386			-D__i386__
382	mach_i386			-D__i386
383	mach_powerpc			-D__ppc__
384	mach_sparc64			-D__sparc64__
385	mach_sparc64			-D__sparc
386
387# Windows
388#
389define cpp-defs-win32
390	*				-DWIN32
391	mingw				-D__MSVCRT__
392	mingw				-D__MINGW32__
393	mach_i386			-D__i386__
394
395#
396define cpp-defs-gcc
397	*				-D__GNUC__=4
398	*				-D__GNUC_MINOR__=3
399	*				-D__GNUC_PATCHLEVEL__=1
400	!gnu99				-D__GNUC_STDC_INLINE__=1
401	gnu99				-D__GNUC_GNU_INLINE__=1
402
403#
404define cpp-defs
405	*				-D__PCC__=@PCC_MAJOR@
406	*				-D__PCC_MINOR__=@PCC_MINOR@
407	*				-D__PCC_MINORMINOR=@PCC_MINORMINOR@
408	*				-D__VERSION__=@PCC_VERSSTR@
409	*				-D__STDC__
410	*				-D__STDC_VERSION__=199901L
411	*				-D__STDC_HOSTED__=$hosted
412	*				-D__STDC_ISO_10646__=200009L
413	optimize			-D__OPTIMIZE__
414	ascpp				-D__ASSEMBLER__
415	ssp				-D__SSP__
416	pthreads			-D_PTHREADS
417	abi_elf				-D__ELF__
418	*				-D__WCHAR_TYPE__=@WCHAR_TYPE@
419	*				-D__WINT_TYPE__=@WINT_TYPE@
420	*				-D__SIZE_TYPE__=@SIZE_TYPE@
421	*				-D__PTRDIFF_TYPE__=@PTRDIFF_TYPE@
422	*				-D__UINTMAX_TYPE__=@UINTMAX_TYPE@
423	*				-D__INTMAX_TYPE__=@INTMAX_TYPE@
424	*				-D__SIZEOF_WCHAR_T__=@SIZEOF_WCHAR@
425	*				-D__SIZEOF_WINT_T__=@SIZEOF_WINT@
426	*				-D__SIZEOF_SIZE_T__=@SIZEOF_SIZE@
427	*				-D__SIZEOF_PTRDIFF_T__=@SIZEOF_PTRDIFF@
428	*				-D__SIZEOF_UINTMAX_T__=@SIZEOF_UINTMAX@
429	*				-D__SIZEOF_INTMAX_T__=@SIZEOF_INTMAX@
430	*				-D__SCHAR_MAX__=@SCHAR_MAX@
431	*				-D__SHRT_MAX__=@SHRT_MAX@
432	*				-D__INT_MAX__=@INT_MAX@
433	*				-D__LONG_MAX__=@LONG_MAX@
434	*				-D__LONG_LONG_MAX__=@LONG_LONG_MAX@
435	*				-D__INTMAX_MAX__=@INTMAX_MAX@
436	*				-D__WCHAR_MAX__=@WCHAR_MAX@
437	*				-D__WINT_MAX__=@WINT_MAX@
438	*				-D__FLT_MAX__=@FLT_MAX@
439	*				-D__DBL_MAX__=@DBL_MAX@
440	*				-D__LDBL_MAX__=@LDBL_MAX@
441	*				-D__FLT_MIN__=@FLT_MIN@
442	*				-D__DBL_MIN__=@DBL_MIN@
443	*				-D__LDBL_MIN__=@LDBL_MIN@
444	gcc_compat			$cpp-defs-gcc
445	*				$cpp-defs-$@TARGOS@
446
447program cpp is @LIBEXEC@/@CPP@
448	verbose				-v
449	traditional			-t
450	stddef				$cpp-defs
451	*				$cpp-args
452	stdinc				-S@INCDIR@
453	stdinc				-S@STDINC@
454	stdinc				-S@PCCINCDIR@
455	*				$infile
456	*				$outfile
457
458program ccom is @LIBEXEC@/@CCOM@
459	Werror				-Werror
460	Wtruncate			-Wtruncate
461	Wstrict-prototypes		-Wstrict-prototypes
462	Wmissing-prototypes		-Wmissing-prototypes
463	Wimplicit-int			-Wimplicit-int
464	Wimplicit-function-declaration	-Wimplicit-function-declaration
465	Wshadow				-Wshadow
466	Wpointer-sign			-Wpointer-sign
467	Wsign-compare			-Wsign-compare
468	Wunknown-pragmas		-Wunknown-pragmas
469	Wunreachable-code		-Wunreachable-code
470	optimize			-xtemps
471	optimize			-xdeljumps
472	optimise			-xinline
473	gnu89				-xgcc
474	gnu99				-xgcc
475	*				$ccom-args
476	*				$infile
477	*				$outfile
478
479program cxxcom is @LIBEXEC/@CXXCOM@
480	Werror				-Werror
481	Wtruncate			-Wtruncate
482	Wstrict-prototypes		-Wstrict-prototypes
483	Wmissing-prototypes		-Wmissing-prototypes
484	Wimplicit-int			-Wimplicit-int
485	Wimplicit-function-declaration	-Wimplicit-function-declaration
486	Wshadow				-Wshadow
487	Wpointer-sign			-Wpointer-sign
488	Wsign-compare			-Wsign-compare
489	Wunknown-pragmas		-Wunknown-pragmas
490	Wunreachable-code		-Wunreachable-code
491	optimize			-xtemps
492	optimize			-xdeljumps
493	optimise			-xinline
494	gnu89				-xgcc
495	gnu99				-xgcc
496	*				$cxxcom-args
497	*				$infile
498	*				$outfile
499
500program fcom is @LIBEXEC@/@FCOM@
501
502program assembler is @AS@
503	verbose				-v
504	*				$Wa
505	*				-o
506	*				$outfile
507	*				$infile
508
509program linker is @LD@
510	verbose				-v
511	*				ld-args
512	clib				-lc
513	cxxlib				-lc++
514	*				$Wl
515	*				-o
516	*				$outfile
517	*				$infiles
518