Subversion Repositories tendra.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
7 7u83 2
 * Copyright (c) 2002-2005 The TenDRA Project <http://www.tendra.org/>.
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions are met:
7
 *
8
 * 1. Redistributions of source code must retain the above copyright notice,
9
 *    this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright notice,
11
 *    this list of conditions and the following disclaimer in the documentation
12
 *    and/or other materials provided with the distribution.
13
 * 3. Neither the name of The TenDRA Project nor the names of its contributors
14
 *    may be used to endorse or promote products derived from this software
15
 *    without specific, prior written permission.
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
18
 * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
19
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
21
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22
 * EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
 *
29
 * $Id$
30
 */
31
/*
2 7u83 32
    		 Crown Copyright (c) 1997
7 7u83 33
 
2 7u83 34
    This TenDRA(r) Computer Program is subject to Copyright
35
    owned by the United Kingdom Secretary of State for Defence
36
    acting through the Defence Evaluation and Research Agency
37
    (DERA).  It is made available to Recipients with a
38
    royalty-free licence for its use, reproduction, transfer
39
    to other parties and amendment for any purpose not excluding
40
    product development provided that any such use et cetera
41
    shall be deemed to be acceptance of the following conditions:-
7 7u83 42
 
2 7u83 43
        (1) Its Recipients shall ensure that this Notice is
44
        reproduced upon any copies or amended versions of it;
7 7u83 45
 
2 7u83 46
        (2) Any amended version of it shall be clearly marked to
47
        show both the nature of and the organisation responsible
48
        for the relevant amendment or amendments;
7 7u83 49
 
2 7u83 50
        (3) Its onward transfer from a recipient to another
51
        party shall be deemed to be that party's acceptance of
52
        these conditions;
7 7u83 53
 
2 7u83 54
        (4) DERA gives no warranty or assurance as to its
55
        quality or suitability for any purpose and DERA accepts
56
        no liability whatsoever in relation to any use to which
57
        it may be put.
58
*/
59
 
60
 
61
#include "config.h"
62
#include "filename.h"
63
#include "list.h"
64
#include "archive.h"
65
#include "copyright.h"
66
#include "environ.h"
67
#include "flags.h"
68
#include "startup.h"
69
#include "suffix.h"
70
#include "utility.h"
71
 
72
 
73
/*
7 7u83 74
 * STRING VARIABLES
75
 *
76
 * These variables given various compilation values, including the location of
77
 * the main temporary directory.
78
 */
2 7u83 79
 
7 7u83 80
char *api_info = "unknown";
81
char *api_output = API_ANAL_NAME;
82
char *dump_opts = null;
83
char *environ_dir = ".";
84
char *final_name = null;
85
char *machine_name = "unknown";
86
char *name_E_file = ENDUP_NAME;
87
char *name_h_file = STARTUP_NAME;
88
char *name_j_file = TDF_COMPLEX_NAME;
89
char *name_k_file = C_SPEC_COMPLEX_NAME;
90
char *name_K_file = CPP_SPEC_COMPLEX_NAME;
91
char *name_p_file = TOKDEF_NAME;
92
char *temporary_dir = "/usr/tmp";
93
char *tokdef_output = null;
94
char *version_flag = "";
95
char *dev_null = null;
96
char **env_paths = NULL;
2 7u83 97
 
98
 
99
/*
7 7u83 100
 * INTERNAL OPTIONS
101
 *
102
 * These variables control the overall behaviour of tcc. For example, should
103
 * we be running in verbose mode?
104
 */
2 7u83 105
 
7 7u83 106
boolean api_checks = 0;
107
boolean checker = 0;
108
boolean copyright = 0;
109
boolean dry_run = 0;
110
boolean env_dump = 0;
111
boolean link_specs = 1;
112
boolean make_up_names = 0;
113
boolean show_api = 0;
114
boolean show_errors = 0;
115
boolean suffix_overrides = 0;
116
boolean taciturn = 0;
117
boolean tidy_up = 0;
118
boolean time_commands = 0;
119
boolean tool_chain = 0;
120
boolean tool_chain_environ = 0;
121
boolean verbose = 0;
122
boolean warnings = 1;
123
/* Should the cmd line args be rank sorted, or taken as is? */
124
boolean no_shuffle = 0;
2 7u83 125
 
126
 
127
/*
7 7u83 128
 * COMPILATION CONTROL OPTIONS
129
 *
130
 * These variables control the main compilation path taken. For example, should
131
 * we form a TDF archive?
132
 */
2 7u83 133
 
134
 
7 7u83 135
boolean make_archive = 0;
136
boolean make_complex = 0;
137
boolean make_preproc = 0;
138
boolean make_pretty = 0;
139
boolean make_tspec = 0;
140
boolean use_assembler = 1;
141
boolean use_mips_assembler = 0;
142
boolean use_alpha_assembler = 0;
143
boolean use_hp_linker = 0;
144
boolean use_dynlink = 0;
145
boolean use_sparc_cc = 0;
146
boolean use_system_cc = 0;
147
boolean allow_cpp = 0;
148
boolean allow_notation = 0;
149
boolean allow_pl_tdf = 0;
150
boolean allow_specs = 0;
2 7u83 151
 
152
 
153
/*
7 7u83 154
 * FILE PRESERVATION AND CONSTRUCTION OPTIONS
155
 *
156
 * These arrays control the creation and storage of the various file types. In
157
 * the keeps array, a nonzero value indicates that any file of this type which
158
 * is created should be preserved. In the stops array, it indicates that the
159
 * compilation halts at this stage. In either case, 0 means "false but
160
 * changeable", 1 means "true but changeable", and 2 means "true and
161
 * unchangeable". The special variable, keep_ofiles, indicates whether all
162
 * binary object files should be kept when more than one input file is given
163
 * (this is for cc compatibility). The keeps_aux array keeps track of the
164
 * explicit file preservation options. These tables need to be kept in step
165
 * with Table 1.
166
 */
2 7u83 167
 
7 7u83 168
boolean keeps[TYPE_ARRAY_SIZE] = {
169
	0,	/* C_SOURCE */
170
	0,	/* PREPROC_C */
171
	0,	/* CPP_SOURCE */
172
	0,	/* PREPROC_CPP */
173
	0,	/* INDEP_TDF */
174
	0,	/* DEP_TDF */
175
	0,	/* AS_SOURCE */
176
	0,	/* BINARY_OBJ */
177
	2,	/* EXECUTABLE */
178
	1,	/* PRETTY_TDF */
179
	0,	/* PL_TDF */
180
	2,	/* TDF_ARCHIVE */
181
	0,	/* MIPS_G_FILE */
182
	0,	/* MIPS_T_FILE */
183
	0,	/* C_SPEC */
184
	0,	/* CPP_SPEC */
185
	0,	/* STARTUP_FILE */
186
	0,	/* UNKNOWN_TYPE */
187
	0,	/* INDEP_TDF_COMPLEX (dummy type) */
188
	0,	/* C_SPEC_1 (dummy type) */
189
	1,	/* C_SPEC_2 (dummy type) */
190
	0,	/* CPP_SPEC_1 (dummy type) */
191
	1,	/* CPP_SPEC_2 (dummy type) */
192
	0,	/* INDEP_TDF_AUX (dummy type) */
193
 
194
};
2 7u83 195
 
7 7u83 196
boolean keeps_aux[TYPE_ARRAY_SIZE] = {
197
	0,	/* C_SOURCE */
198
	0,	/* PREPROC_C */
199
	0,	/* CPP_SOURCE */
200
	0,	/* PREPROC_CPP */
201
	0,	/* INDEP_TDF */
202
	0,	/* DEP_TDF */
203
	0,	/* AS_SOURCE */
204
	0,	/* BINARY_OBJ */
205
	0,	/* EXECUTABLE */
206
	0,	/* PRETTY_TDF */
207
	0,	/* PL_TDF */
208
	0,	/* TDF_ARCHIVE */
209
	0,	/* MIPS_G_FILE */
210
	0,	/* MIPS_T_FILE */
211
	0,	/* C_SPEC */
212
	0,	/* CPP_SPEC */
213
	0,	/* STARTUP_FILE */
214
	0,	/* UNKNOWN_TYPE */
215
	0,	/* INDEP_TDF_COMPLEX (dummy type) */
216
	0,	/* C_SPEC_1 (dummy type) */
217
	0,	/* C_SPEC_2 (dummy type) */
218
	0,	/* CPP_SPEC_1 (dummy type) */
219
	0,	/* CPP_SPEC_2 (dummy type) */
220
	0,	/* INDEP_TDF_AUX (dummy type) */
221
 
222
};
2 7u83 223
 
7 7u83 224
boolean stops[TYPE_ARRAY_SIZE] = {
225
	0,	/* C_SOURCE */
226
	0,	/* PREPROC_C */
227
	0,	/* CPP_SOURCE */
228
	0,	/* PREPROC_CPP */
229
	0,	/* INDEP_TDF */
230
	0,	/* DEP_TDF */
231
	0,	/* AS_SOURCE */
232
	0,	/* BINARY_OBJ */
233
	2,	/* EXECUTABLE */
234
	2,	/* PRETTY_TDF */
235
	0,	/* PL_TDF */
236
	2,	/* TDF_ARCHIVE */
237
	0,	/* MIPS_G_FILE */
238
	0,	/* MIPS_T_FILE */
239
	0,	/* C_SPEC */
240
	0,	/* CPP_SPEC */
241
	0,	/* STARTUP_FILE */
242
	0,	/* UNKNOWN_TYPE */
243
	0,	/* INDEP_TDF_COMPLEX (dummy type) */
244
	0,	/* C_SPEC_1 (dummy type) */
245
	0,	/* C_SPEC_2 (dummy type) */
246
	0,	/* CPP_SPEC_1 (dummy type) */
247
	0,	/* CPP_SPEC_2 (dummy type) */
248
	0,	/* INDEP_TDF_AUX (dummy type) */
249
 
250
};
2 7u83 251
 
7 7u83 252
static boolean keep_all = 0;
253
static boolean keep_ofiles = 1;
2 7u83 254
 
255
 
256
/*
7 7u83 257
 * INDIVIDUAL OPTIONS
258
 *
259
 * These flags control those individual executable options which are not easily
260
 * integrated into the main scheme of things.
261
 */
2 7u83 262
 
7 7u83 263
boolean flag_diag = 0;
264
boolean flag_keep_err = 0;
265
boolean flag_incl = 0;
266
boolean flag_merge_all = 0;
267
boolean flag_nepc = 0;
268
boolean flag_no_files = 0;
269
boolean flag_optim = 0;
270
boolean flag_prof = 0;
271
boolean flag_startup = 1;
272
boolean flag_strip = 0;
2 7u83 273
 
274
 
275
/*
7 7u83 276
 * EXECUTABLES
277
 *
278
 * These variables give the values of the various executables comprising the
279
 * system. For example, exec_produce gives the location of the C to TDF
280
 * producer.
281
 */
2 7u83 282
 
7 7u83 283
list *exec_produce = null;
284
list *exec_preproc = null;
285
list *exec_cpp_produce = null;
286
list *exec_cpp_preproc = null;
287
list *exec_tdf_link = null;
288
list *exec_translate = null;
289
list *exec_assemble = null;
290
list *exec_assemble_mips = null;
291
list *exec_link = null;
292
list *exec_notation = null;
293
list *exec_pl_tdf = null;
294
list *exec_pretty = null;
295
list *exec_spec_link = null;
296
list *exec_cpp_spec_link = null;
297
list *exec_split_arch = null;
298
list *exec_build_arch = null;
299
list *exec_cat = null;
300
list *exec_cc = null;
301
list *exec_mkdir = null;
302
list *exec_move = null;
303
list *exec_remove = null;
304
list *exec_touch = null;
305
list *exec_dynlink = null;
306
list *exec_dump_anal = null;
307
list *exec_dump_link = null;
2 7u83 308
 
309
 
310
/*
7 7u83 311
 * BUILT-IN OPTIONS
312
 *
313
 * These lists of options are built into the system, although they may be
314
 * altered by environments and command-line options.
315
 */
2 7u83 316
 
7 7u83 317
list *std_prod_incldirs = null;
318
list *std_prod_portfile = null;
319
list *std_prod_startdirs = null;
320
list *std_prod_startup = null;
321
list *std_cpp_prod_incldirs = null;
322
list *std_cpp_prod_startdirs = null;
323
list *std_cpp_prod_startup = null;
324
list *std_tdf_link_libdirs = null;
325
list *std_tdf_link_libs = null;
326
list *std_link_crt0 = null;
327
list *std_link_crt1 = null;
328
list *std_link_crtp_n = null;
329
list *std_link_crtn = null;
330
list *std_link_libdirs = null;
331
list *std_link_libs = null;
332
list *std_link_c_libs = null;
333
list *std_link_entry = null;
2 7u83 334
 
335
 
336
 
337
/*
7 7u83 338
 * COMMAND-LINE OPTIONS
339
 *
340
 * These lists of options are those specified on the command-line.
341
 */
2 7u83 342
 
7 7u83 343
list *usr_prod_incldirs = null;
344
list *usr_prod_foptions = null;
345
list *usr_prod_eoptions = null;
346
list *usr_prod_startup = null;
347
list *usr_cpp_prod_startup = null;
348
list *usr_pl_tdf_incldirs = null;
349
list *usr_tdf_link_libdirs = null;
350
list *usr_tdf_link_libs = null;
351
list *usr_link_libdirs = null;
352
list *usr_link_libs = null;
2 7u83 353
 
354
 
355
/*
7 7u83 356
 * EXECUTABLE OPTIONS
357
 *
358
 * These lists record the command-line options which are passed directly to the
359
 * various executables.
360
 */
2 7u83 361
 
7 7u83 362
list *opt_produce = null;
363
list *opt_preproc = null;
364
list *opt_cpp_produce = null;
365
list *opt_cpp_preproc = null;
366
list *opt_tdf_link = null;
367
list *opt_translate = null;
368
list *opt_assemble = null;
369
list *opt_assemble_mips = null;
370
list *opt_dynlink = null;
371
list *opt_link = null;
372
list *opt_notation = null;
373
list *opt_pl_tdf = null;
374
list *opt_pretty = null;
375
list *opt_spec_link = null;
376
list *opt_cpp_spec_link = null;
377
list *opt_dump_anal = null;
378
list *opt_dump_link = null;
379
list *opt_archive = null;
380
list *opt_joiner = null;
381
list *opt_cc = null;
382
list *opt_startup = null;
383
list *opt_endup = null;
384
list *opt_unknown = null;
2 7u83 385
 
386
 
387
/*
7 7u83 388
 * SET A KEEP OR STOP OPTION
389
 *
390
 * This routine sets a value in the keeps or stops arrays. The variable t gives
391
 * the file type (including ALL_TYPES) and k gives the storage command (see
392
 * flags.h).
393
 */
2 7u83 394
 
7 7u83 395
void
396
set_stage(int t, int k)
2 7u83 397
{
7 7u83 398
	if (t == ALL_TYPES) {
399
		boolean ks = keeps[STARTUP_FILE];
400
		if (k == STOP_STAGE || k == STOP_ONLY_STAGE) {
401
			error(WARNING, "Illegal stop option");
402
		} else if (k == KEEP_STAGE) {
403
			int i;
404
			for (i = 0; i < array_size(keeps); i++) {
405
				if (keeps[i] == 0) {
406
					keeps[i] = 1;
407
				}
408
			}
409
			keep_all = 1;
410
		} else if (k == DONT_KEEP_STAGE) {
411
			int i;
412
			for (i = 0; i < array_size(keeps); i++) {
413
				if (keeps[i] == 1) {
414
					keeps[i] = 0;
415
				}
416
			}
417
			keep_all = 0;
418
			keep_ofiles = 0;
2 7u83 419
		}
7 7u83 420
		keeps[STARTUP_FILE] = ks;
421
	} else {
422
		if (k == STOP_STAGE || k == STOP_ONLY_STAGE) {
423
			static int last_stop = UNKNOWN_TYPE;
424
			if (stops[t] == 0) {
425
				stops[t] = 1;
426
			}
427
			if (k == STOP_STAGE && keeps[t] == 0) {
428
				keeps[t] = 1;
429
			}
430
			switch (last_stop) {
431
			case UNKNOWN_TYPE:
432
				break;
433
			case INDEP_TDF:
434
			case C_SPEC:
435
			case CPP_SPEC:
436
				if (t == C_SPEC || t == CPP_SPEC) {
437
					break;
438
				}
439
				if (t == INDEP_TDF) {
440
					break;
441
				}
442
				goto default_lab;
443
			case PREPROC_C:
444
			case PREPROC_CPP:
445
				if (t == PREPROC_CPP) {
446
					break;
447
				}
448
				goto default_lab;
449
			default:
450
default_lab:
451
				if (t != last_stop) {
452
					error(WARNING, "More than one stop option given");
453
				}
454
				break;
455
			}
456
			last_stop = t;
457
		} else if (k == KEEP_STAGE) {
458
			if (keeps[t] == 0) {
459
				keeps[t] = 1;
460
			}
461
			keeps_aux[t] = 1;
462
			if (t == BINARY_OBJ) {
463
				keep_ofiles = 1;
464
			}
465
		} else if (k == DONT_KEEP_STAGE) {
466
			if (keeps[t] == 1) {
467
				keeps[t] = 0;
468
			}
469
			keeps_aux[t] = 2;
470
			if (t == BINARY_OBJ) {
471
				keep_ofiles = 0;
472
			}
2 7u83 473
		}
474
	}
7 7u83 475
	return;
2 7u83 476
}
477
 
478
 
479
/*
7 7u83 480
 * SET THE MACHINE NAME
481
 *
482
 * This routine sets any special flags required by the machine indicated by
483
 * machine_name.
484
 */
2 7u83 485
 
7 7u83 486
void
487
set_machine(void)
2 7u83 488
{
489
#if 0
7 7u83 490
	char *mach = machine_name;
491
	use_assembler = 1;
492
	use_mips_assembler = 0;
493
	use_alpha_assembler = 0;
494
	use_hp_linker = 0;
495
	if (streq(mach, "hp") || streq(mach, "hppa")) {
496
		use_hp_linker = 1;
497
	} else if (streq(mach, "mips")) {
498
		use_mips_assembler = 1;
499
	} else if (streq(mach, "alpha")) {
500
		use_alpha_assembler = 1;
501
	} else if (streq(mach, "sparc") || streq(mach, "svr4_sparc")) {
502
		use_sparc_cc = 1;
503
	} else if (streq(mach, "svr4_i386")) {
504
		use_sparc_cc = 2;
505
	} else if (streq(mach, "transputer")) {
506
		use_assembler = 0;
507
	}
2 7u83 508
#endif
7 7u83 509
	return;
2 7u83 510
}
511
 
512
 
513
/*
7 7u83 514
 * INITIALISE ALL OPTIONS
515
 *
516
 * This routine initialises any necessary values before the command-line
517
 * options are read.
518
 */
2 7u83 519
 
7 7u83 520
void
521
initialise_options(void)
2 7u83 522
{
7 7u83 523
	/* Initialise executables */
524
	list *p;
525
	int sz;
526
	int i;
527
	exec_produce = make_list("builtin/undef C_producer");
528
	exec_preproc = make_list("builtin/undef C_preprocessor");
529
	exec_cpp_produce = make_list("builtin/undef C++_producer");
530
	exec_cpp_preproc = make_list("builtin/undef C++_preprocessor");
531
	exec_tdf_link = make_list("builtin/undef TDF_linker");
532
	exec_translate = make_list("builtin/undef TDF_translator");
533
	exec_assemble = make_list("builtin/undef system_assembler");
534
	exec_assemble_mips = make_list("builtin/undef mips_assembler");
535
	exec_link = make_list("builtin/undef system_linker");
536
	exec_notation = make_list("builtin/undef TDF_notation_compiler");
537
	exec_pl_tdf = make_list("builtin/undef PL_TDF_compiler");
538
	exec_pretty = make_list("builtin/undef TDF_pretty_printer");
539
	exec_spec_link = make_list("builtin/undef C_spec_linker");
540
	exec_cpp_spec_link = make_list("builtin/undef C++_spec_linker");
541
	exec_split_arch = make_list("builtin/split_archive");
542
	exec_build_arch = make_list("builtin/build_archive");
543
	exec_cat = make_list("builtin/cat");
544
	exec_cc = make_list("builtin/undef system_compiler");
545
	exec_mkdir = make_list("builtin/mkdir");
546
	exec_move = make_list("builtin/move");
547
	exec_remove = make_list("builtin/remove");
548
	exec_touch = make_list("builtin/touch");
549
	exec_dynlink = make_list("builtin/undef dynamic_initialiser");
2 7u83 550
 
7 7u83 551
	/* Initialise other options */
552
	find_envpath();
553
	for (p = opt_startup; p != null; p = p->next) {
554
		add_to_startup(p->item);
555
	}
556
	for (p = opt_endup; p != null; p = p->next) {
557
		add_to_endup(p->item);
558
	}
559
	if (checker) {
560
		allow_specs = 1;
561
	}
562
 
563
	/* allocate space for cmd line env args */
564
	sz = (sizeof(PATH_SUBS));
565
	env_paths = (char**) xalloc (sz * sizeof(char *));
566
 
567
	/* Here, we should set these to sane defaults.  For now, just NULL */
568
	for (i=0; i < sz; i++) {
569
		env_paths[i] = NULL;
570
	}
571
	return;
2 7u83 572
}
573
 
574
 
575
/*
7 7u83 576
 * UPDATE ALL OPTIONS
577
 *
578
 * This routine updates the values of the variables above after all the
579
 * command-line options have been read. The stops options need to be kept in
580
 * step with the general compilation scheme given in compile.c. Deciding which
581
 * versions of certain file types to preserve (INDEP_TDF and C_SPEC in
582
 * particular) gets pretty messy.
583
 */
2 7u83 584
 
7 7u83 585
void
586
update_options(void)
2 7u83 587
{
7 7u83 588
	char *mode = null;
589
	static boolean done_diag = 0;
590
	static boolean done_preproc = 0;
591
	static boolean done_prof = 0;
592
	static boolean done_time = 0;
2 7u83 593
 
7 7u83 594
	/* Process archive options */
595
	process_archive_opt();
2 7u83 596
 
7 7u83 597
	/* Deal with cc mode */
598
	if (checker) {
599
		mode = "checker";
2 7u83 600
	}
7 7u83 601
	if (use_system_cc) {
602
		if (!checker) {
603
			error(WARNING, "Using the system C compiler");
604
		}
605
		mode = "system compiler";
2 7u83 606
	}
7 7u83 607
	if (mode) {
608
		if (make_archive) {
609
			error(WARNING, "Can't build TDF archive in %s mode",
610
			      mode);
611
			stops[INDEP_TDF] = 1;
612
			make_archive = 0;
613
		}
614
		if (make_complex) {
615
			error(WARNING, "Can't build TDF complex in %s mode",
616
			      mode);
617
			make_complex = 0;
618
		}
619
		if (make_pretty) {
620
			error(WARNING, "Can't pretty print TDF in %s mode",
621
			      mode);
622
			stops[INDEP_TDF] = 1;
623
			make_pretty = 0;
624
		}
625
		allow_notation = 0;
626
		allow_pl_tdf = 0;
2 7u83 627
	}
7 7u83 628
 
629
	/* Register extra stops */
630
	if (make_archive) {
631
		set_stage(TDF_ARCHIVE, STOP_STAGE);
2 7u83 632
	}
7 7u83 633
	if (make_preproc) {
634
		set_stage(PREPROC_C, STOP_ONLY_STAGE);
635
		set_stage(PREPROC_CPP, STOP_ONLY_STAGE);
636
	}
637
	if (make_pretty) {
638
		set_stage(PRETTY_TDF, STOP_STAGE);
639
	}
2 7u83 640
 
7 7u83 641
	/* Read special environments etc. */
642
	if (make_preproc && keeps[PREPROC_C] && !done_preproc) {
643
		read_env(PREPROC_ENV);
644
		done_preproc = 1;
645
	}
646
	if (flag_diag && !done_diag) {
647
		read_env(DIAG_ENV);
648
		done_diag = 1;
649
	}
650
	if (flag_prof && !done_prof) {
651
		read_env(PROF_ENV);
652
		done_prof = 1;
653
	}
654
	if (time_commands && !done_time) {
655
		read_env(TIME_ENV);
656
		done_time = 1;
657
	}
2 7u83 658
 
7 7u83 659
	/* Print API information */
660
	if (show_api) {
661
		error(INFO, "API is %s", api_info);
662
		show_api = 0;
663
	}
2 7u83 664
 
665
#if 0
7 7u83 666
	/* The option -Fk means stop after producer */
667
	if (stops[C_SPEC] || stops[CPP_SPEC] ||
668
	    stops[PREPROC_C] || stops[PREPROC_CPP]) {
669
		stops[INDEP_TDF] = 1;
670
	}
2 7u83 671
#endif
672
 
7 7u83 673
	/* Propagate stop options down */
674
	if (stops[INDEP_TDF]) {
675
		stops[INDEP_TDF_COMPLEX] = 1;
676
		stops[DEP_TDF] = 1;
677
		stops[AS_SOURCE] = 1;
678
		stops[BINARY_OBJ] = 1;
679
	} else if (stops[DEP_TDF]) {
680
		stops[AS_SOURCE] = 1;
681
		stops[BINARY_OBJ] = 1;
682
	} else if (stops[AS_SOURCE]) {
683
		stops[BINARY_OBJ] = 1;
684
	} else if (stops[MIPS_G_FILE]) {
685
		stops[BINARY_OBJ] = 1;
686
	} else if (stops[MIPS_T_FILE]) {
687
		stops[BINARY_OBJ] = 1;
688
	}
2 7u83 689
 
7 7u83 690
	/* Check keep options */
691
	if (make_complex) {
692
		if (keeps[INDEP_TDF]) {
693
			keeps[INDEP_TDF] = keep_all;
694
			keeps[INDEP_TDF_COMPLEX] = 1;
695
		}
696
		if (stops[INDEP_TDF]) {
697
			keeps[C_SPEC_1] = 1;
698
			keeps[CPP_SPEC_1] = 1;
699
		}
2 7u83 700
	}
7 7u83 701
	if (keeps[C_SPEC]) {
702
		if (make_complex) {
703
			keeps[C_SPEC] = keep_all;
704
			keeps[C_SPEC_1] = 1;
705
		}
706
	} else {
707
		if (keeps_aux[C_SPEC] == 2) {
708
			keeps[C_SPEC_1] = 0;
709
			keeps[C_SPEC_2] = 0;
710
		}
2 7u83 711
	}
7 7u83 712
	if (keeps[CPP_SPEC]) {
713
		if (make_complex) {
714
			keeps[CPP_SPEC] = keep_all;
715
			keeps[CPP_SPEC_1] = 1;
716
		}
717
	} else if (keeps_aux[CPP_SPEC] == 2) {
718
		keeps[CPP_SPEC_1] = 0;
719
		keeps[CPP_SPEC_2] = 0;
2 7u83 720
	}
7 7u83 721
	if (keep_ofiles && no_input_files > 1 && !make_complex) {
722
		keeps[BINARY_OBJ] = 1;
2 7u83 723
	}
7 7u83 724
	if (keeps_aux[BINARY_OBJ] == 1) {
725
		keeps[BINARY_OBJ_AUX] = 1;
2 7u83 726
	}
7 7u83 727
	if (link_specs) {
728
		boolean b;
729
		if (checker && !use_system_cc) {
730
			if (keeps_aux[BINARY_OBJ]) {
731
				b = 1;
732
			} else if (stops[BINARY_OBJ] && !stops[AS_SOURCE]) {
733
				b = keeps[BINARY_OBJ];
734
			} else {
735
				b = 0;
736
			}
737
		} else {
738
			b = keeps[BINARY_OBJ];
739
		}
740
		if (b) {
741
			if (make_complex) {
742
				keeps[C_SPEC_1] = 1;
743
				keeps[CPP_SPEC_1] = 1;
744
			} else {
745
				keeps[C_SPEC] = 1;
746
				keeps[CPP_SPEC] = 1;
747
			}
748
			keeps[BINARY_OBJ_AUX] = 1;
749
		}
2 7u83 750
	}
7 7u83 751
 
752
	/* Set checker options */
753
	if (checker) {
754
		if (allow_specs == 0) {
755
			allow_specs = 1;
756
		}
757
		if (!use_system_cc) {
758
			stops[C_SPEC_2] = 1;
759
			stops[CPP_SPEC_2] = 1;
760
		}
2 7u83 761
	}
762
 
7 7u83 763
	/* Print the copyright message if required */
764
	if (copyright) {
765
		print_copyright();
766
		copyright = 0;
2 7u83 767
	}
768
 
7 7u83 769
	/* A couple of housekeeping routines */
770
	close_startup();
771
	find_envpath();
772
	return;
2 7u83 773
}