annotate lib-src/ellcc.c @ 410:de805c49cfc1 r21-2-35

Import from CVS: tag r21-2-35
author cvs
date Mon, 13 Aug 2007 11:19:21 +0200
parents 74fd4e045ea6
children 697ef44129c6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
1 /* ellcc.c - front-end for compiling Emacs modules
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
2 Copyright (C) 1998, 1999 J. Kean Johnston.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
3
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
4 This file is part of XEmacs.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
5
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
9 later version.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
10
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
14 for more details.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
15
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
19 Boston, MA 02111-1307, USA.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
20
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
21 Author: J. Kean Johnston (jkj@sco.com).
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
22 Please mail bugs and suggestions to the XEmacs maintainer.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
23 */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
24
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
25 /*
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
26 Here's the scoop. We would really like this to be a shell script, but
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
27 the various Windows platforms don't have reliable scripting that suits
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
28 our needs. We don't want to rely on perl or some other such language
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
29 so we have to roll our own executable to act as a front-end for the
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
30 compiler.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
31
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
32 This program is used to invoke the compiler, the linker and to generate
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
33 the module specific documentation and initialization code. We assume we
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
34 are in 'compile' mode unless we encounter an argument which tells us
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
35 that we're not. We take all arguments and pass them on directly to the
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
36 compiler, except for a few which are specific to this program:
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
37
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
38 --mode=VALUE This sets the program mode. VALUE can be one of
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
39 compile, link, init or verbose.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
40 --mod-name=NAME Sets the module name to the string NAME.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
41 --mod-title=TITLE Sets the module title to the string TITLE.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
42 --mod-version=VER Sets the module version to the string VER.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
43
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
44 The idea is that Makefiles will use ellcc as the compiler for making
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
45 dynamic Emacs modules, and life should be as simple as:
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
46
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
47 make CC=ellcc LD='ellcc --mode=link'
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
48
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
49 The only additional requirement is an entry in the Makefile to produce
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
50 the module initialization file, which will usually be something along
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
51 the lines of:
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
52
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
53 modinit.c: $(SRCS)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
54 ellcc --mode=init --mod-name=\"$(MODNAME)\" \
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
55 --mod-title=\"$(MODTITLE)\" --mod-version=\"$(MODVERSION)\" \
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
56 -o $@ $(SRCS)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
57
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
58 See the samples for more details.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
59 */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
60
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
61 #include <config.h>
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
62 #include <stdio.h>
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
63 #include <stdlib.h>
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
64 #include <string.h>
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
65 #include <ctype.h>
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
66 #include <errno.h>
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
67 #include <sys/types.h>
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
68
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
69 #ifdef HAVE_UNISTD_H
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
70 # include <unistd.h>
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
71 #endif /* HAVE_UNISTD_H */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
72
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
73 #define EMODULES_GATHER_VERSION
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
74
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
75 #include <emodules.h>
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
76 #include <ellcc.h> /* Generated files must be included using <...> */
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
77
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
78 #define DEBUG
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
79
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
80 #ifndef HAVE_SHLIB
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
81 int
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
82 main (int argc, char *argv[])
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
83 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
84 fprintf (stderr, "Dynamic modules not supported on this platform\n");
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
85 return EXIT_FAILURE;
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
86 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
87 #else
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
88
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
89 /*
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
90 * Try to figure out the commands we need to use to create shared objects,
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
91 * and how to compile for PIC mode.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
92 */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
93
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
94 /*
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
95 * xnew, xrnew -- allocate, reallocate storage
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
96 *
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
97 * SYNOPSIS: Type *xnew (int n, Type);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
98 * Type *xrnew (OldPointer, int n, Type);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
99 */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
100 #ifdef chkmalloc
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
101 # include "chkmalloc.h"
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
102 # define xnew(n,Type) ((Type *) trace_malloc (__FILE__, __LINE__, \
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
103 (n) * sizeof (Type)))
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
104 # define xrnew(op,n,Type) ((Type *) trace_realloc (__FILE__, __LINE__, \
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
105 (op), (n) * sizeof (Type)))
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
106 #else
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
107 # define xnew(n,Type) ((Type *) xmalloc ((n) * sizeof (Type)))
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
108 # define xrnew(op,n,Type) ((Type *) xrealloc ((op), (n) * sizeof (Type)))
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
109 #endif
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
110 static void *xmalloc (size_t);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
111 static void fatal (char *, char *);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
112 static void add_to_argv (const char *);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
113 static void do_compile_mode (void);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
114 static void do_link_mode (void);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
115 static void do_init_mode (void);
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
116
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
117 #define SSTR(S) ((S)?(S):"")
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
118
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
119 #define ELLCC_COMPILE_MODE 0
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
120 #define ELLCC_LINK_MODE 1
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
121 #define ELLCC_INIT_MODE 2
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
122
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
123 int ellcc_mode = ELLCC_COMPILE_MODE;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
124 char *progname;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
125 char *mod_name = (char *)0, *mod_version = (char *)0, *mod_title = (char *)0;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
126 char *mod_output = (char *)0;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
127 int verbose = 0;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
128 char **exec_argv;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
129 int exec_argc = 1, *exec_args;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
130 int real_argc = 0;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
131 int prog_argc;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
132 char **prog_argv;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
133
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
134 /*
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
135 * We allow the user to over-ride things in the environment
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
136 */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
137 char *ellcc, *ellld, *ellcflags, *ellldflags, *ellpicflags, *elldllflags;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
138 #define OVERENV(STR,EVAR,DFLT) \
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
139 STR = getenv(EVAR); \
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
140 if ((STR) == (char *)0) \
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
141 STR = DFLT
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
142
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
143 int
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
144 main (int argc, char *argv[])
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
145 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
146 char *tmp;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
147 int i, done_mode = 0;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
148
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
149 prog_argc = argc;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
150 prog_argv = argv;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
151
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 398
diff changeset
152 #if defined(WIN32_NATIVE)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
153 tmp = strrchr (argv[0], '\\');
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
154 if (tmp != (char *)0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
155 tmp++;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
156 #elif !defined (VMS)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
157 tmp = strrchr (argv[0], '/');
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
158 if (tmp != (char *)0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
159 tmp++;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
160 #else
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
161 tmp = argv[0];
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
162 #endif
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
163
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
164 if (tmp != (char *)0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
165 progname = tmp;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
166 else
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
167 progname = argv[0];
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
168
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
169 tmp = &progname[strlen(progname)-2];
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
170 if (strcmp (tmp, "cc") == 0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
171 ellcc_mode = ELLCC_COMPILE_MODE;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
172 else if (strcmp (tmp, "ld") == 0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
173 ellcc_mode = ELLCC_LINK_MODE;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
174 else if (strcmp (tmp, "it") == 0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
175 ellcc_mode = ELLCC_INIT_MODE;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
176
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
177 exec_argv = xnew(argc + 20, char *);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
178 exec_args = xnew(argc, int);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
179 for (i = 0; i < argc; i++)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
180 exec_args[i] = -1;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
181
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
182 if (argc < 2)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
183 fatal ("too few arguments", (char *)0);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
184
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
185 exec_args[0] = 0;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
186
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
187 for (i = 1; i < argc; i++)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
188 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
189 if (strncmp (argv[i], "--mode=", 7) == 0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
190 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
191 char *modeopt = argv[i] + 7;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
192
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
193 if (done_mode && strcmp (modeopt, "verbose"))
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
194 fatal ("more than one mode specified", (char *) 0);
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
195 if (strcmp (modeopt, "link") == 0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
196 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
197 done_mode++;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
198 ellcc_mode = ELLCC_LINK_MODE;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
199 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
200 else if (strcmp (modeopt, "compile") == 0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
201 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
202 done_mode++;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
203 ellcc_mode = ELLCC_COMPILE_MODE;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
204 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
205 else if (strcmp (modeopt, "init") == 0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
206 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
207 done_mode++;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
208 ellcc_mode = ELLCC_INIT_MODE;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
209 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
210 else if (strcmp (modeopt, "verbose") == 0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
211 verbose += 1;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
212 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
213 else if (strcmp (argv[i], "--mod-location") == 0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
214 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
215 printf ("%s\n", ELLCC_MODDIR);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
216 return 0;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
217 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
218 else if (strcmp (argv[i], "--mod-site-location") == 0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
219 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
220 printf ("%s\n", ELLCC_SITEMODS);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
221 return 0;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
222 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
223 else if (strcmp (argv[i], "--mod-archdir") == 0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
224 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
225 printf ("%s\n", ELLCC_ARCHDIR);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
226 return 0;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
227 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
228 else if (strcmp (argv[i], "--mod-config") == 0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
229 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
230 printf ("%s\n", ELLCC_CONFIG);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
231 return 0;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
232 }
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
233 else if (strncmp (argv[i], "--mod-name=", 11) == 0)
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
234 mod_name = argv[i] + 11;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
235 else if (strncmp (argv[i], "--mod-title=", 12) == 0)
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
236 mod_title = argv[i] + 12;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
237 else if (strncmp (argv[i], "--mod-version=", 14) == 0)
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
238 mod_version = argv[i] + 14;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
239 else if (strncmp (argv[i], "--mod-output=", 13) == 0)
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
240 mod_output = argv[i] + 13;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
241 else
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
242 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
243 exec_args[exec_argc] = i;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
244 exec_argc++;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
245 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
246 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
247
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
248 if (ellcc_mode == ELLCC_LINK_MODE && mod_output == (char *)0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
249 fatal ("must specify --mod-output when linking", (char *)0);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
250 if (ellcc_mode == ELLCC_INIT_MODE && mod_output == (char *)0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
251 fatal ("must specify --mod-output when creating init file", (char *)0);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
252 if (ellcc_mode == ELLCC_INIT_MODE && mod_name == (char *)0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
253 fatal ("must specify --mod-name when creating init file", (char *)0);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
254
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
255 /*
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
256 * We now have the list of arguments to pass to the compiler or
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
257 * linker (or to process for doc files). We can do the real work
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
258 * now.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
259 */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
260 if (verbose)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
261 printf ("ellcc driver version %s for EMODULES version %s (%ld)\n",
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
262 ELLCC_EMACS_VER, EMODULES_VERSION, EMODULES_REVISION);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
263 #ifdef DEBUG
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
264 if (verbose >= 2)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
265 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
266 printf (" mode = %d (%s)\n", ellcc_mode,
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
267 ellcc_mode == ELLCC_COMPILE_MODE ? "compile" :
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
268 ellcc_mode == ELLCC_LINK_MODE ? "link" : "init");
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
269 printf (" module_name = \"%s\"\n", SSTR(mod_name));
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
270 printf (" module_title = \"%s\"\n", SSTR(mod_title));
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
271 printf (" module_version = \"%s\"\n", SSTR(mod_version));
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
272
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
273 printf (" CC = %s\n", ELLCC_CC);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
274 printf (" CFLAGS = %s\n", ELLCC_CFLAGS);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
275 printf (" CC PIC flags = %s\n", ELLCC_DLL_CFLAGS);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
276 printf (" LD = %s\n", ELLCC_DLL_LD);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
277 printf (" LDFLAGS = %s\n", ELLCC_DLL_LDFLAGS);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
278 printf (" architecture = %s\n", ELLCC_CONFIG);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
279 printf (" Include directory = %s/include\n", ELLCC_ARCHDIR);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
280 printf ("\n");
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
281 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
282 #endif
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
283
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
284 if (exec_argc < 2)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
285 fatal ("too few arguments", (char *) 0);
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
286
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
287 /*
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
288 * Get the over-rides from the environment
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
289 */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
290 OVERENV(ellcc, "ELLCC", ELLCC_CC);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
291 OVERENV(ellld, "ELLLD", ELLCC_DLL_LD);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
292 OVERENV(ellcflags, "ELLCFLAGS", ELLCC_CFLAGS);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
293 OVERENV(ellldflags, "ELLLDFLAGS", ELLCC_LDFLAGS);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
294 OVERENV(elldllflags, "ELLDLLFLAGS", ELLCC_DLL_LDFLAGS);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
295 OVERENV(ellpicflags, "ELLPICFLAGS", ELLCC_DLL_CFLAGS);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
296
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
297 if (ellcc_mode == ELLCC_COMPILE_MODE)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
298 do_compile_mode();
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
299 else if (ellcc_mode == ELLCC_LINK_MODE)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
300 do_link_mode();
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
301 else
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
302 do_init_mode();
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
303
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
304 /*
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
305 * The arguments to pass on to the desired program have now been set
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
306 * up and we can run the program.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
307 */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
308 if (verbose)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
309 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
310 for (i = 0; i < real_argc; i++)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
311 printf ("%s ", exec_argv[i]);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
312 printf ("\n");
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
313 fflush (stdout);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
314 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
315 exec_argv[real_argc] = (char *)0; /* Terminate argument list */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
316
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
317 i = execvp (exec_argv[0], exec_argv);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
318 if (verbose)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
319 printf ("%s exited with status %d\n", exec_argv[0], i);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
320 return i;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
321 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
322
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
323 /* Like malloc but get fatal error if memory is exhausted. */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
324 static void *
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
325 xmalloc (size_t size)
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
326 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
327 void *result = malloc (size);
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
328 if (result == NULL)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
329 fatal ("virtual memory exhausted", (char *)0);
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
330 return result;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
331 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
332
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
333 /* Print error message and exit. */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
334 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
335 fatal (char *s1, char *s2)
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
336 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
337 fprintf (stderr, "%s: ", progname);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
338 fprintf (stderr, s1, s2);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
339 fprintf (stderr, "\n");
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
340 exit (EXIT_FAILURE);
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
341 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
342
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
343 /*
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
344 * Add a string to the argument vector list that will be passed on down
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
345 * to the compiler or linker. We need to split individual words into
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
346 * arguments, taking quoting into account. This can get ugly.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
347 */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
348 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
349 add_to_argv (const char *str)
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
350 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
351 int sm = 0;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
352 const char *s = (const char *)0;
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
353
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
354 if ((str == (const char *)0) || (str[0] == '\0'))
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
355 return;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
356
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
357 while (*str)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
358 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
359 switch (sm)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
360 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
361 case 0: /* Start of case - string leading whitespace */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
362 if (isspace ((unsigned char) *str))
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
363 str++;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
364 else
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
365 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
366 sm = 1; /* Change state to non-whitespace */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
367 s = str; /* Mark the start of THIS argument */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
368 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
369 break;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
370
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
371 case 1: /* Non-whitespace character. Mark the start */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
372 if (isspace ((unsigned char) *str))
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
373 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
374 /* Reached the end of the argument. Add it. */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
375 int l = str-s;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
376 exec_argv[real_argc] = xnew (l+2, char);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
377 strncpy (exec_argv[real_argc], s, l);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
378 exec_argv[real_argc][l] = '\0';
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
379 real_argc++;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
380 sm = 0; /* Back to start state */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
381 s = (const char *)0;
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
382 break;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
383 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
384 else if (*str == '\\')
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
385 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
386 sm = 2; /* Escaped character */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
387 str++;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
388 break;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
389 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
390 else if (*str == '\'')
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
391 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
392 /* Start of quoted string (single quotes) */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
393 sm = 3;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
394 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
395 else if (*str == '"')
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
396 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
397 /* Start of quoted string (double quotes) */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
398 sm = 4;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
399 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
400 else
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
401 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
402 /* This was just a normal character. Advance the pointer. */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
403 str++;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
404 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
405 break;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
406
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
407 case 2: /* Escaped character */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
408 str++; /* Preserve the quoted character */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
409 sm = 1; /* Go back to gathering state */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
410 break;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
411
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
412 case 3: /* Inside single quoted string */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
413 if (*str == '\'')
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
414 sm = 1;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
415 str++;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
416 break;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
417
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
418 case 4: /* inside double quoted string */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
419 if (*str == '"')
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
420 sm = 1;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
421 str++;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
422 break;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
423 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
424 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
425
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
426 if (s != (const char *)0)
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
427 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
428 int l = str-s;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
429 exec_argv[real_argc] = xnew (l+2, char);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
430 strncpy (exec_argv[real_argc], s, l);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
431 exec_argv[real_argc][l] = '\0';
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
432 real_argc++;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
433 s = (const char *)0;
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
434 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
435 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
436
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
437 /*
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
438 * For compile mode, things are pretty straight forward. All we need to do
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
439 * is build up the argument vector and exec() it. We must just make sure
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
440 * that we get all of the required arguments in place.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
441 */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
442 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
443 do_compile_mode (void)
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
444 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
445 int i;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
446 char ts[4096]; /* Plenty big enough */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
447
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
448 add_to_argv (ellcc);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
449 add_to_argv (ellcflags);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
450 add_to_argv (ellpicflags);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
451 add_to_argv ("-DPIC");
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
452 add_to_argv ("-DEMACS_MODULE");
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
453 #ifdef XEMACS
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
454 add_to_argv ("-DXEMACS_MODULE"); /* Cover both cases */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
455 add_to_argv ("-Dxemacs");
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
456 #endif
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
457 add_to_argv ("-Demacs");
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
458 sprintf (ts, "-I%s/include", ELLCC_ARCHDIR);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
459 add_to_argv (ts);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
460 add_to_argv (ELLCC_CF_ALL);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
461 for (i = 1; i < exec_argc; i++)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
462 exec_argv[real_argc++] = strdup (prog_argv[exec_args[i]]);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
463 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
464
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
465 /*
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
466 * For link mode, things are a little bit more complicated. We need to
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
467 * insert the linker commands first, replace any occurrence of ELLSONAME
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
468 * with the desired output file name, insert the output arguments, then
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
469 * all of the provided arguments, then the final post arguments. Once
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
470 * all of this has been done, the argument vector is ready to run.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
471 */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
472 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
473 do_link_mode (void)
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
474 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
475 int i,x;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
476 char *t, ts[4096]; /* Plenty big enough */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
477
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
478 add_to_argv (ellld);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
479 add_to_argv (ellldflags);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
480 add_to_argv (elldllflags);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
481 add_to_argv (ELLCC_DLL_LDO);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
482 add_to_argv (mod_output);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
483 for (i = 1; i < exec_argc; i++)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
484 exec_argv[real_argc++] = strdup (prog_argv[exec_args[i]]);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
485 add_to_argv (ELLCC_DLL_POST);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
486
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
487 /*
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
488 * Now go through each argument and replace ELLSONAME with mod_output.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
489 */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
490 for (i = 0; i < real_argc; i++)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
491 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
492 x = 0;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
493 ts[0] = '\0';
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
494
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
495 t = exec_argv[i];
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
496 while (*t)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
497 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
498 if (*t == 'E')
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
499 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
500 if (strncmp (t, "ELLSONAME", 9) == 0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
501 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
502 strcat (ts, mod_output);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
503 t += 8;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
504 x += strlen (mod_output);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
505 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
506 else
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
507 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
508 ts[x] = *t;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
509 x++;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
510 ts[x] = '\0';
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
511 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
512 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
513 else
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
514 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
515 ts[x] = *t;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
516 x++;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
517 ts[x] = '\0';
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
518 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
519 t++;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
520 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
521 free (exec_argv[i]);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
522 exec_argv[i] = strdup (ts);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
523 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
524 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
525
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
526 /*
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
527 * In init mode, things are a bit easier. We assume that the only things
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
528 * passed on the command line are the names of source files which the
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
529 * make-doc program will be processing. We prepare the output file with
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
530 * the header information first, as make-doc will append to the file by
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
531 * special dispensation.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
532 */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
533 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
534 do_init_mode (void)
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
535 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
536 int i;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
537 char ts[4096]; /* Plenty big enough */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
538 char *mdocprog;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
539 FILE *mout = fopen (mod_output, "w");
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
540
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
541 if (mout == (FILE *)0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
542 fatal ("failed to open output file", mod_output);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
543 fprintf (mout, "/* DO NOT EDIT - AUTOMATICALLY GENERATED */\n\n");
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
544 fprintf (mout, "#include <emodules.h>\n\n");
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
545 fprintf (mout, "const long emodule_compiler = %ld;\n", EMODULES_REVISION);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
546 fprintf (mout, "const char *emodule_name = \"%s\";\n", SSTR(mod_name));
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
547 fprintf (mout, "const char *emodule_version = \"%s\";\n", SSTR(mod_version));
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
548 fprintf (mout, "const char *emodule_title = \"%s\";\n", SSTR(mod_title));
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
549 fprintf (mout, "\n\n");
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
550 fprintf (mout, "void docs_of_%s()\n", SSTR(mod_name));
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
551 fclose (mout);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
552
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
553 sprintf (ts, "%s/make-docfile", ELLCC_ARCHDIR);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
554 OVERENV(mdocprog, "ELLMAKEDOC", ts);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
555 add_to_argv (mdocprog);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
556 sprintf (ts, "-E %s", mod_output);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
557 add_to_argv (ts);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
558 for (i = 1; i < exec_argc; i++)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
559 exec_argv[real_argc++] = strdup (prog_argv[exec_args[i]]);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
560 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
561
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
562 #endif /* HAVE_SHLIB */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
563