TESTING -- override pthreads to fix gstreamer v5
[wine/multimedia.git] / tools / winebuild / main.c
blob08c8c2cbb1c60d03c482e1d1f40d413ee6e4f856
1 /*
2 * Main function
4 * Copyright 1993 Robert J. Amstadt
5 * Copyright 1995 Martin von Loewis
6 * Copyright 1995, 1996, 1997 Alexandre Julliard
7 * Copyright 1997 Eric Youngdale
8 * Copyright 1999 Ulrich Weigand
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 #include "config.h"
26 #include "wine/port.h"
28 #include <assert.h>
29 #include <stdio.h>
30 #include <signal.h>
31 #include <errno.h>
32 #include <string.h>
33 #include <stdarg.h>
34 #include <ctype.h>
35 #ifdef HAVE_GETOPT_H
36 # include <getopt.h>
37 #endif
39 #include "build.h"
41 int UsePIC = 0;
42 int nb_lib_paths = 0;
43 int nb_errors = 0;
44 int display_warnings = 0;
45 int kill_at = 0;
46 int verbose = 0;
47 int link_ext_symbols = 0;
48 int force_pointer_size = 0;
49 int unwind_tables = 0;
51 #ifdef __i386__
52 enum target_cpu target_cpu = CPU_x86;
53 #elif defined(__x86_64__)
54 enum target_cpu target_cpu = CPU_x86_64;
55 #elif defined(__powerpc__)
56 enum target_cpu target_cpu = CPU_POWERPC;
57 #elif defined(__arm__)
58 enum target_cpu target_cpu = CPU_ARM;
59 #elif defined(__aarch64__)
60 enum target_cpu target_cpu = CPU_ARM64;
61 #else
62 #error Unsupported CPU
63 #endif
65 #ifdef __APPLE__
66 enum target_platform target_platform = PLATFORM_APPLE;
67 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
68 enum target_platform target_platform = PLATFORM_FREEBSD;
69 #elif defined(__sun)
70 enum target_platform target_platform = PLATFORM_SOLARIS;
71 #elif defined(_WIN32)
72 enum target_platform target_platform = PLATFORM_WINDOWS;
73 #else
74 enum target_platform target_platform = PLATFORM_UNSPECIFIED;
75 #endif
77 char *target_alias = NULL;
78 char **lib_path = NULL;
80 char *input_file_name = NULL;
81 char *spec_file_name = NULL;
82 FILE *output_file = NULL;
83 const char *output_file_name = NULL;
84 static const char *output_file_source_name;
85 static int fake_module;
87 struct strarray *as_command = NULL;
88 struct strarray *cc_command = NULL;
89 struct strarray *ld_command = NULL;
90 struct strarray *nm_command = NULL;
91 char *cpu_option = NULL;
92 char *arch_option = NULL;
94 #ifdef __thumb__
95 int thumb_mode = 1;
96 #else
97 int thumb_mode = 0;
98 #endif
100 static int nb_res_files;
101 static char **res_files;
103 /* execution mode */
104 enum exec_mode_values
106 MODE_NONE,
107 MODE_DLL,
108 MODE_EXE,
109 MODE_DEF,
110 MODE_IMPLIB,
111 MODE_RESOURCES
114 static enum exec_mode_values exec_mode = MODE_NONE;
116 static const struct
118 const char *name;
119 enum target_platform platform;
120 } platform_names[] =
122 { "macos", PLATFORM_APPLE },
123 { "darwin", PLATFORM_APPLE },
124 { "freebsd", PLATFORM_FREEBSD },
125 { "solaris", PLATFORM_SOLARIS },
126 { "mingw32", PLATFORM_WINDOWS },
127 { "windows", PLATFORM_WINDOWS },
128 { "winnt", PLATFORM_WINDOWS }
131 /* set the dll file name from the input file name */
132 static void set_dll_file_name( const char *name, DLLSPEC *spec )
134 char *p;
136 if (spec->file_name) return;
138 if ((p = strrchr( name, '\\' ))) name = p + 1;
139 if ((p = strrchr( name, '/' ))) name = p + 1;
140 spec->file_name = xmalloc( strlen(name) + 5 );
141 strcpy( spec->file_name, name );
142 if ((p = strrchr( spec->file_name, '.' )))
144 if (!strcmp( p, ".spec" ) || !strcmp( p, ".def" )) *p = 0;
148 /* set the dll name from the file name */
149 static void init_dll_name( DLLSPEC *spec )
151 if (!spec->file_name && output_file_name)
153 char *p;
154 spec->file_name = xstrdup( output_file_name );
155 if ((p = strrchr( spec->file_name, '.' ))) *p = 0;
157 if (!spec->dll_name && spec->file_name) /* set default name from file name */
159 char *p;
160 spec->dll_name = xstrdup( spec->file_name );
161 if ((p = strrchr( spec->dll_name, '.' ))) *p = 0;
165 /* set the dll subsystem */
166 static void set_subsystem( const char *subsystem, DLLSPEC *spec )
168 char *major, *minor, *str = xstrdup( subsystem );
170 if ((major = strchr( str, ':' ))) *major++ = 0;
171 if (!strcmp( str, "native" )) spec->subsystem = IMAGE_SUBSYSTEM_NATIVE;
172 else if (!strcmp( str, "windows" )) spec->subsystem = IMAGE_SUBSYSTEM_WINDOWS_GUI;
173 else if (!strcmp( str, "console" )) spec->subsystem = IMAGE_SUBSYSTEM_WINDOWS_CUI;
174 else if (!strcmp( str, "wince" )) spec->subsystem = IMAGE_SUBSYSTEM_WINDOWS_CE_GUI;
175 else if (!strcmp( str, "win16" )) spec->type = SPEC_WIN16;
176 else fatal_error( "Invalid subsystem name '%s'\n", subsystem );
177 if (major)
179 if ((minor = strchr( major, '.' )))
181 *minor++ = 0;
182 spec->subsystem_minor = atoi( minor );
184 spec->subsystem_major = atoi( major );
186 free( str );
189 /* set the target CPU and platform */
190 static void set_target( const char *target )
192 unsigned int i;
193 char *p, *platform, *spec = xstrdup( target );
195 /* target specification is in the form CPU-MANUFACTURER-OS or CPU-MANUFACTURER-KERNEL-OS */
197 target_alias = xstrdup( target );
199 /* get the CPU part */
201 if ((p = strchr( spec, '-' )))
203 int cpu;
205 *p++ = 0;
206 cpu = get_cpu_from_name( spec );
207 if (cpu == -1) fatal_error( "Unrecognized CPU '%s'\n", spec );
208 target_cpu = cpu;
209 platform = p;
210 if ((p = strrchr( p, '-' ))) platform = p + 1;
212 else if (!strcmp( spec, "mingw32" ))
214 target_cpu = CPU_x86;
215 platform = spec;
217 else
218 fatal_error( "Invalid target specification '%s'\n", target );
220 /* get the OS part */
222 target_platform = PLATFORM_UNSPECIFIED; /* default value */
223 for (i = 0; i < sizeof(platform_names)/sizeof(platform_names[0]); i++)
225 if (!strncmp( platform_names[i].name, platform, strlen(platform_names[i].name) ))
227 target_platform = platform_names[i].platform;
228 break;
232 free( spec );
235 /* cleanup on program exit */
236 static void cleanup(void)
238 if (output_file_name) unlink( output_file_name );
241 /* clean things up when aborting on a signal */
242 static void exit_on_signal( int sig )
244 exit(1); /* this will call atexit functions */
247 /*******************************************************************
248 * command-line option handling
250 static const char usage_str[] =
251 "Usage: winebuild [OPTIONS] [FILES]\n\n"
252 "Options:\n"
253 " --as-cmd=AS Command to use for assembling (default: as)\n"
254 " -b, --target=TARGET Specify target CPU and platform for cross-compiling\n"
255 " --cc-cmd=CC C compiler to use for assembling (default: fall back to --as-cmd)\n"
256 " -d, --delay-lib=LIB Import the specified library in delayed mode\n"
257 " -D SYM Ignored for C flags compatibility\n"
258 " -e, --entry=FUNC Set the DLL entry point function (default: DllMain)\n"
259 " -E, --export=FILE Export the symbols defined in the .spec or .def file\n"
260 " --external-symbols Allow linking to external symbols\n"
261 " -f FLAGS Compiler flags (-fPIC and -fasynchronous-unwind-tables are supported)\n"
262 " -F, --filename=DLLFILE Set the DLL filename (default: from input file name)\n"
263 " --fake-module Create a fake binary module\n"
264 " -h, --help Display this help message\n"
265 " -H, --heap=SIZE Set the heap size for a Win16 dll\n"
266 " -I DIR Ignored for C flags compatibility\n"
267 " -k, --kill-at Kill stdcall decorations in generated .def files\n"
268 " -K, FLAGS Compiler flags (only -KPIC is supported)\n"
269 " --large-address-aware Support an address space larger than 2Gb\n"
270 " --ld-cmd=LD Command to use for linking (default: ld)\n"
271 " -l, --library=LIB Import the specified library\n"
272 " -L, --library-path=DIR Look for imports libraries in DIR\n"
273 " -m16, -m32, -m64 Force building 16-bit, 32-bit resp. 64-bit code\n"
274 " -M, --main-module=MODULE Set the name of the main module for a Win16 dll\n"
275 " --nm-cmd=NM Command to use to get undefined symbols (default: nm)\n"
276 " --nxcompat=y|n Set the NX compatibility flag (default: yes)\n"
277 " -N, --dll-name=DLLNAME Set the DLL name (default: from input file name)\n"
278 " -o, --output=NAME Set the output file name (default: stdout)\n"
279 " -r, --res=RSRC.RES Load resources from RSRC.RES\n"
280 " --save-temps Do not delete the generated intermediate files\n"
281 " --subsystem=SUBSYS Set the subsystem (one of native, windows, console, wince)\n"
282 " -u, --undefined=SYMBOL Add an undefined reference to SYMBOL when linking\n"
283 " -v, --verbose Display the programs invoked\n"
284 " --version Print the version and exit\n"
285 " -w, --warnings Turn on warnings\n"
286 "\nMode options:\n"
287 " --dll Build a .c file from a .spec or .def file\n"
288 " --def Build a .def file from a .spec file\n"
289 " --exe Build a .c file for an executable\n"
290 " --implib Build an import library\n"
291 " --resources Build a .o file for the resource files\n\n"
292 "The mode options are mutually exclusive; you must specify one and only one.\n\n";
294 enum long_options_values
296 LONG_OPT_DLL = 1,
297 LONG_OPT_DEF,
298 LONG_OPT_EXE,
299 LONG_OPT_IMPLIB,
300 LONG_OPT_ASCMD,
301 LONG_OPT_CCCMD,
302 LONG_OPT_EXTERNAL_SYMS,
303 LONG_OPT_FAKE_MODULE,
304 LONG_OPT_LARGE_ADDRESS_AWARE,
305 LONG_OPT_LDCMD,
306 LONG_OPT_NMCMD,
307 LONG_OPT_NXCOMPAT,
308 LONG_OPT_RESOURCES,
309 LONG_OPT_SAVE_TEMPS,
310 LONG_OPT_SUBSYSTEM,
311 LONG_OPT_VERSION
314 static const char short_options[] = "C:D:E:F:H:I:K:L:M:N:b:d:e:f:hkl:m:o:r:u:vw";
316 static const struct option long_options[] =
318 { "dll", 0, 0, LONG_OPT_DLL },
319 { "def", 0, 0, LONG_OPT_DEF },
320 { "exe", 0, 0, LONG_OPT_EXE },
321 { "implib", 0, 0, LONG_OPT_IMPLIB },
322 { "as-cmd", 1, 0, LONG_OPT_ASCMD },
323 { "cc-cmd", 1, 0, LONG_OPT_CCCMD },
324 { "external-symbols", 0, 0, LONG_OPT_EXTERNAL_SYMS },
325 { "fake-module", 0, 0, LONG_OPT_FAKE_MODULE },
326 { "large-address-aware", 0, 0, LONG_OPT_LARGE_ADDRESS_AWARE },
327 { "ld-cmd", 1, 0, LONG_OPT_LDCMD },
328 { "nm-cmd", 1, 0, LONG_OPT_NMCMD },
329 { "nxcompat", 1, 0, LONG_OPT_NXCOMPAT },
330 { "resources", 0, 0, LONG_OPT_RESOURCES },
331 { "save-temps", 0, 0, LONG_OPT_SAVE_TEMPS },
332 { "subsystem", 1, 0, LONG_OPT_SUBSYSTEM },
333 { "version", 0, 0, LONG_OPT_VERSION },
334 /* aliases for short options */
335 { "target", 1, 0, 'b' },
336 { "delay-lib", 1, 0, 'd' },
337 { "export", 1, 0, 'E' },
338 { "entry", 1, 0, 'e' },
339 { "filename", 1, 0, 'F' },
340 { "help", 0, 0, 'h' },
341 { "heap", 1, 0, 'H' },
342 { "kill-at", 0, 0, 'k' },
343 { "library", 1, 0, 'l' },
344 { "library-path", 1, 0, 'L' },
345 { "main-module", 1, 0, 'M' },
346 { "dll-name", 1, 0, 'N' },
347 { "output", 1, 0, 'o' },
348 { "res", 1, 0, 'r' },
349 { "undefined", 1, 0, 'u' },
350 { "verbose", 0, 0, 'v' },
351 { "warnings", 0, 0, 'w' },
352 { NULL, 0, 0, 0 }
355 static void usage( int exit_code )
357 fprintf( stderr, "%s", usage_str );
358 exit( exit_code );
361 static void set_exec_mode( enum exec_mode_values mode )
363 if (exec_mode != MODE_NONE) usage(1);
364 exec_mode = mode;
367 /* parse options from the argv array and remove all the recognized ones */
368 static char **parse_options( int argc, char **argv, DLLSPEC *spec )
370 char *p;
371 int optc;
372 int save_temps = 0;
374 while ((optc = getopt_long( argc, argv, short_options, long_options, NULL )) != -1)
376 switch(optc)
378 case 'D':
379 /* ignored */
380 break;
381 case 'E':
382 spec_file_name = xstrdup( optarg );
383 set_dll_file_name( optarg, spec );
384 break;
385 case 'F':
386 spec->file_name = xstrdup( optarg );
387 break;
388 case 'H':
389 if (!isdigit(optarg[0]))
390 fatal_error( "Expected number argument with -H option instead of '%s'\n", optarg );
391 spec->heap_size = atoi(optarg);
392 if (spec->heap_size > 65535)
393 fatal_error( "Invalid heap size %d, maximum is 65535\n", spec->heap_size );
394 break;
395 case 'I':
396 /* ignored */
397 break;
398 case 'K':
399 /* ignored, because cc generates correct code. */
400 break;
401 case 'L':
402 lib_path = xrealloc( lib_path, (nb_lib_paths+1) * sizeof(*lib_path) );
403 lib_path[nb_lib_paths++] = xstrdup( optarg );
404 break;
405 case 'm':
406 if (!strcmp( optarg, "16" )) spec->type = SPEC_WIN16;
407 else if (!strcmp( optarg, "32" )) force_pointer_size = 4;
408 else if (!strcmp( optarg, "64" )) force_pointer_size = 8;
409 else if (!strcmp( optarg, "arm" )) thumb_mode = 0;
410 else if (!strcmp( optarg, "thumb" )) thumb_mode = 1;
411 else if (!strncmp( optarg, "cpu=", 4 )) cpu_option = xstrdup( optarg + 4 );
412 else if (!strncmp( optarg, "arch=", 5 )) arch_option = xstrdup( optarg + 5 );
413 else fatal_error( "Unknown -m option '%s'\n", optarg );
414 break;
415 case 'M':
416 spec->main_module = xstrdup( optarg );
417 break;
418 case 'N':
419 spec->dll_name = xstrdup( optarg );
420 break;
421 case 'b':
422 set_target( optarg );
423 break;
424 case 'd':
425 add_delayed_import( optarg );
426 break;
427 case 'e':
428 spec->init_func = xstrdup( optarg );
429 if ((p = strchr( spec->init_func, '@' ))) *p = 0; /* kill stdcall decoration */
430 break;
431 case 'f':
432 if (!strcmp( optarg, "PIC") || !strcmp( optarg, "pic")) UsePIC = 1;
433 else if (!strcmp( optarg, "asynchronous-unwind-tables")) unwind_tables = 1;
434 else if (!strcmp( optarg, "no-asynchronous-unwind-tables")) unwind_tables = 0;
435 /* ignore all other flags */
436 break;
437 case 'h':
438 usage(0);
439 break;
440 case 'k':
441 kill_at = 1;
442 break;
443 case 'l':
444 add_import_dll( optarg, NULL );
445 break;
446 case 'o':
448 char *ext = strrchr( optarg, '.' );
450 if (unlink( optarg ) == -1 && errno != ENOENT)
451 fatal_error( "Unable to create output file '%s'\n", optarg );
452 if (ext && !strcmp( ext, ".o" ))
454 output_file_source_name = get_temp_file_name( optarg, ".s" );
455 if (!(output_file = fopen( output_file_source_name, "w" )))
456 fatal_error( "Unable to create output file '%s'\n", optarg );
458 else
460 if (!(output_file = fopen( optarg, "w" )))
461 fatal_error( "Unable to create output file '%s'\n", optarg );
463 output_file_name = xstrdup(optarg);
464 atexit( cleanup ); /* make sure we remove the output file on exit */
466 break;
467 case 'r':
468 res_files = xrealloc( res_files, (nb_res_files+1) * sizeof(*res_files) );
469 res_files[nb_res_files++] = xstrdup( optarg );
470 break;
471 case 'u':
472 add_extra_ld_symbol( optarg );
473 break;
474 case 'v':
475 verbose++;
476 break;
477 case 'w':
478 display_warnings = 1;
479 break;
480 case LONG_OPT_DLL:
481 set_exec_mode( MODE_DLL );
482 break;
483 case LONG_OPT_DEF:
484 set_exec_mode( MODE_DEF );
485 break;
486 case LONG_OPT_EXE:
487 set_exec_mode( MODE_EXE );
488 if (!spec->subsystem) spec->subsystem = IMAGE_SUBSYSTEM_WINDOWS_GUI;
489 break;
490 case LONG_OPT_IMPLIB:
491 set_exec_mode( MODE_IMPLIB );
492 break;
493 case LONG_OPT_ASCMD:
494 as_command = strarray_fromstring( optarg, " " );
495 break;
496 case LONG_OPT_CCCMD:
497 cc_command = strarray_fromstring( optarg, " " );
498 break;
499 case LONG_OPT_FAKE_MODULE:
500 fake_module = 1;
501 break;
502 case LONG_OPT_EXTERNAL_SYMS:
503 link_ext_symbols = 1;
504 break;
505 case LONG_OPT_LARGE_ADDRESS_AWARE:
506 spec->characteristics |= IMAGE_FILE_LARGE_ADDRESS_AWARE;
507 break;
508 case LONG_OPT_LDCMD:
509 ld_command = strarray_fromstring( optarg, " " );
510 break;
511 case LONG_OPT_NMCMD:
512 nm_command = strarray_fromstring( optarg, " " );
513 break;
514 case LONG_OPT_NXCOMPAT:
515 if (optarg[0] == 'n' || optarg[0] == 'N')
516 spec->dll_characteristics &= ~IMAGE_DLLCHARACTERISTICS_NX_COMPAT;
517 break;
518 case LONG_OPT_RESOURCES:
519 set_exec_mode( MODE_RESOURCES );
520 break;
521 case LONG_OPT_SAVE_TEMPS:
522 save_temps = 1;
523 break;
524 case LONG_OPT_SUBSYSTEM:
525 set_subsystem( optarg, spec );
526 break;
527 case LONG_OPT_VERSION:
528 printf( "winebuild version " PACKAGE_VERSION "\n" );
529 exit(0);
530 case '?':
531 usage(1);
532 break;
536 if (!save_temps) atexit( cleanup_tmp_files );
538 if (spec->file_name && !strchr( spec->file_name, '.' ))
539 strcat( spec->file_name, exec_mode == MODE_EXE ? ".exe" : ".dll" );
540 init_dll_name( spec );
542 switch (target_cpu)
544 case CPU_x86:
545 if (force_pointer_size == 8) target_cpu = CPU_x86_64;
546 break;
547 case CPU_x86_64:
548 if (force_pointer_size == 4) target_cpu = CPU_x86;
549 break;
550 default:
551 if (force_pointer_size == 8)
552 fatal_error( "Cannot build 64-bit code for this CPU\n" );
553 break;
556 return &argv[optind];
560 /* load all specified resource files */
561 static void load_resources( char *argv[], DLLSPEC *spec )
563 int i;
564 char **ptr, **last;
566 switch (spec->type)
568 case SPEC_WIN16:
569 for (i = 0; i < nb_res_files; i++) load_res16_file( res_files[i], spec );
570 break;
572 case SPEC_WIN32:
573 for (i = 0; i < nb_res_files; i++)
575 if (!load_res32_file( res_files[i], spec ))
576 fatal_error( "%s is not a valid Win32 resource file\n", res_files[i] );
579 /* load any resource file found in the remaining arguments */
580 for (ptr = last = argv; *ptr; ptr++)
582 if (!load_res32_file( *ptr, spec ))
583 *last++ = *ptr; /* not a resource file, keep it in the list */
585 *last = NULL;
586 break;
590 /* add input files that look like import libs to the import list */
591 static void load_import_libs( char *argv[] )
593 char **ptr, **last;
595 for (ptr = last = argv; *ptr; ptr++)
597 if (strendswith( *ptr, ".def" ))
598 add_import_dll( NULL, *ptr );
599 else
600 *last++ = *ptr; /* not an import dll, keep it in the list */
602 *last = NULL;
605 static int parse_input_file( DLLSPEC *spec )
607 FILE *input_file = open_input_file( NULL, spec_file_name );
608 char *extension = strrchr( spec_file_name, '.' );
609 int result;
611 spec->src_name = xstrdup( input_file_name );
612 if (extension && !strcmp( extension, ".def" ))
613 result = parse_def_file( input_file, spec );
614 else
615 result = parse_spec_file( input_file, spec );
616 close_input_file( input_file );
617 return result;
621 /*******************************************************************
622 * main
624 int main(int argc, char **argv)
626 DLLSPEC *spec = alloc_dll_spec();
628 #ifdef SIGHUP
629 signal( SIGHUP, exit_on_signal );
630 #endif
631 signal( SIGTERM, exit_on_signal );
632 signal( SIGINT, exit_on_signal );
634 output_file = stdout;
635 argv = parse_options( argc, argv, spec );
637 switch(exec_mode)
639 case MODE_DLL:
640 if (spec->subsystem != IMAGE_SUBSYSTEM_NATIVE)
641 spec->characteristics |= IMAGE_FILE_DLL;
642 /* fall through */
643 case MODE_EXE:
644 load_resources( argv, spec );
645 load_import_libs( argv );
646 if (spec_file_name && !parse_input_file( spec )) break;
647 if (fake_module)
649 if (spec->type == SPEC_WIN16) output_fake_module16( spec );
650 else output_fake_module( spec );
651 break;
653 read_undef_symbols( spec, argv );
654 switch (spec->type)
656 case SPEC_WIN16:
657 output_spec16_file( spec );
658 break;
659 case SPEC_WIN32:
660 BuildSpec32File( spec );
661 break;
662 default: assert(0);
664 break;
665 case MODE_DEF:
666 if (argv[0]) fatal_error( "file argument '%s' not allowed in this mode\n", argv[0] );
667 if (!spec_file_name) fatal_error( "missing .spec file\n" );
668 if (!parse_input_file( spec )) break;
669 output_def_file( spec, 1 );
670 break;
671 case MODE_IMPLIB:
672 if (!spec_file_name) fatal_error( "missing .spec file\n" );
673 if (!parse_input_file( spec )) break;
674 output_import_lib( spec, argv );
675 break;
676 case MODE_RESOURCES:
677 load_resources( argv, spec );
678 output_res_o_file( spec );
679 break;
680 default:
681 usage(1);
682 break;
684 if (nb_errors) exit(1);
685 if (output_file_name)
687 if (fclose( output_file ) < 0) fatal_perror( "fclose" );
688 if (output_file_source_name) assemble_file( output_file_source_name, output_file_name );
689 output_file_name = NULL;
691 return 0;