"const"-ipation fixes from Trevor Woerner
[nasm.git] / outform.h
blob7da8e32cf7a0bd8b269b6d765adb4be8e3ccb8bd
1 /* outform.h header file for binding output format drivers to the
2 * remainder of the code in the Netwide Assembler
4 * The Netwide Assembler is copyright (C) 1996 Simon Tatham and
5 * Julian Hall. All rights reserved. The software is
6 * redistributable under the licence given in the file "Licence"
7 * distributed in the NASM archive.
8 */
11 * This header file allows configuration of which output formats
12 * get compiled into the NASM binary. You can configure by defining
13 * various preprocessor symbols beginning with "OF_", either on the
14 * compiler command line or at the top of this file.
16 * OF_ONLY -- only include specified object formats
17 * OF_name -- ensure that output format 'name' is included
18 * OF_NO_name -- remove output format 'name'
19 * OF_DOS -- ensure that 'obj', 'bin' & 'win32' are included.
20 * OF_UNIX -- ensure that 'aout', 'aoutb', 'coff', 'elf' are in.
21 * OF_OTHERS -- ensure that 'bin', 'as86' & 'rdf' are in.
22 * OF_ALL -- ensure that all formats are included.
23 * note that this doesn't include 'dbg', which is
24 * only really useful if you're doing development
25 * work on NASM. Define OF_DBG if you want this.
27 * OF_DEFAULT=of_name -- ensure that 'name' is the default format.
29 * eg: -DOF_UNIX -DOF_ELF -DOF_DEFAULT=of_elf would be a suitable config
30 * for an average linux system.
32 * Default config = -DOF_ALL -DOF_DEFAULT=of_bin
34 * You probably only want to set these options while compiling 'nasm.c'. */
36 #ifndef NASM_OUTFORM_H
37 #define NASM_OUTFORM_H
39 #include "nasm.h"
41 /* -------------- USER MODIFIABLE PART ---------------- */
44 * Insert #defines here in accordance with the configuration
45 * instructions above.
47 * E.g.
49 * #define OF_ONLY
50 * #define OF_OBJ
51 * #define OF_BIN
53 * for a 16-bit DOS assembler with no extraneous formats.
56 /* ------------ END USER MODIFIABLE PART -------------- */
58 /* ====configurable info begins here==== */
59 /* formats configurable:
60 * bin,obj,elf,aout,aoutb,coff,win32,as86,rdf2 */
62 /* process options... */
64 #ifndef OF_ONLY
65 #ifndef OF_ALL
66 #define OF_ALL /* default is to have all formats */
67 #endif
68 #endif
70 #ifdef OF_ALL /* set all formats on... */
71 #ifndef OF_BIN
72 #define OF_BIN
73 #endif
74 #ifndef OF_OBJ
75 #define OF_OBJ
76 #endif
77 #ifndef OF_ELF
78 #define OF_ELF
79 #endif
80 #ifndef OF_COFF
81 #define OF_COFF
82 #endif
83 #ifndef OF_AOUT
84 #define OF_AOUT
85 #endif
86 #ifndef OF_AOUTB
87 #define OF_AOUTB
88 #endif
89 #ifndef OF_WIN32
90 #define OF_WIN32
91 #endif
92 #ifndef OF_AS86
93 #define OF_AS86
94 #endif
95 #ifndef OF_RDF2
96 #define OF_RDF2
97 #endif
98 #ifndef OF_IEEE
99 #define OF_IEEE
100 #endif
101 #endif /* OF_ALL */
103 /* turn on groups of formats specified.... */
104 #ifdef OF_DOS
105 #ifndef OF_OBJ
106 #define OF_OBJ
107 #endif
108 #ifndef OF_BIN
109 #define OF_BIN
110 #endif
111 #ifndef OF_WIN32
112 #define OF_WIN32
113 #endif
114 #endif
116 #ifdef OF_UNIX
117 #ifndef OF_AOUT
118 #define OF_AOUT
119 #endif
120 #ifndef OF_AOUTB
121 #define OF_AOUTB
122 #endif
123 #ifndef OF_COFF
124 #define OF_COFF
125 #endif
126 #ifndef OF_ELF
127 #define OF_ELF
128 #endif
129 #endif
131 #ifdef OF_OTHERS
132 #ifndef OF_BIN
133 #define OF_BIN
134 #endif
135 #ifndef OF_AS86
136 #define OF_AS86
137 #endif
138 #ifndef OF_RDF2
139 #define OF_RDF2
140 #endif
141 #ifndef OF_IEEE
142 #define OF_IEEE
143 #endif
144 #endif
146 /* finally... override any format specifically specified to be off */
147 #ifdef OF_NO_BIN
148 #undef OF_BIN
149 #endif
150 #ifdef OF_NO_OBJ
151 #undef OF_OBJ
152 #endif
153 #ifdef OF_NO_ELF
154 #undef OF_ELF
155 #endif
156 #ifdef OF_NO_AOUT
157 #undef OF_AOUT
158 #endif
159 #ifdef OF_NO_AOUTB
160 #undef OF_AOUTB
161 #endif
162 #ifdef OF_NO_COFF
163 #undef OF_COFF
164 #endif
165 #ifdef OF_NO_WIN32
166 #undef OF_WIN32
167 #endif
168 #ifdef OF_NO_AS86
169 #undef OF_AS86
170 #endif
171 #ifdef OF_NO_RDF2
172 #undef OF_RDF
173 #endif
174 #ifdef OF_NO_IEEE
175 #undef OF_IEEE
176 #endif
178 #ifndef OF_DEFAULT
179 #define OF_DEFAULT of_bin
180 #endif
182 #ifdef BUILD_DRIVERS_ARRAY /* only if included from outform.c */
184 /* pull in the externs for the different formats, then make the *drivers
185 * array based on the above defines */
187 extern struct ofmt of_bin;
188 extern struct ofmt of_aout;
189 extern struct ofmt of_aoutb;
190 extern struct ofmt of_coff;
191 extern struct ofmt of_elf;
192 extern struct ofmt of_as86;
193 extern struct ofmt of_obj;
194 extern struct ofmt of_win32;
195 extern struct ofmt of_rdf2;
196 extern struct ofmt of_ieee;
197 extern struct ofmt of_dbg;
199 struct ofmt *drivers[]={
200 #ifdef OF_BIN
201 &of_bin,
202 #endif
203 #ifdef OF_AOUT
204 &of_aout,
205 #endif
206 #ifdef OF_AOUTB
207 &of_aoutb,
208 #endif
209 #ifdef OF_COFF
210 &of_coff,
211 #endif
212 #ifdef OF_ELF
213 &of_elf,
214 #endif
215 #ifdef OF_AS86
216 &of_as86,
217 #endif
218 #ifdef OF_OBJ
219 &of_obj,
220 #endif
221 #ifdef OF_WIN32
222 &of_win32,
223 #endif
224 #ifdef OF_RDF2
225 &of_rdf2,
226 #endif
227 #ifdef OF_IEEE
228 &of_ieee,
229 #endif
230 #ifdef OF_DBG
231 &of_dbg,
232 #endif
234 NULL
237 #endif /* BUILD_DRIVERS_ARRAY */
239 struct ofmt *ofmt_find(char *);
240 struct dfmt *dfmt_find(struct ofmt *, char *);
241 void ofmt_list(struct ofmt *, FILE *);
242 void dfmt_list(struct ofmt *ofmt, FILE *fp);
243 struct ofmt *ofmt_register (efunc error);
245 #endif /* NASM_OUTFORM_H */