Merge branch 'master' of git+ssh://fbkotler@repo.or.cz/srv/git/nasm
[nasm/autotest.git] / outform.h
blob236fd547e60a1506a11294484dabdf67c3618a32
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', 'elf32' 'elf64' 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_ELF32 -DOF_DEFAULT=of_elf32 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,elf32,elf64,aout,aoutb,coff,win32,as86,rdf2,macho */
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_ELF32
78 #define OF_ELF32
79 #endif
80 #ifndef OF_ELF64
81 #define OF_ELF64
82 #endif
83 #ifndef OF_COFF
84 #define OF_COFF
85 #endif
86 #ifndef OF_AOUT
87 #define OF_AOUT
88 #endif
89 #ifndef OF_AOUTB
90 #define OF_AOUTB
91 #endif
92 #ifndef OF_WIN32
93 #define OF_WIN32
94 #endif
95 #ifndef OF_WIN64
96 #define OF_WIN64
97 #endif
98 #ifndef OF_AS86
99 #define OF_AS86
100 #endif
101 #ifndef OF_RDF2
102 #define OF_RDF2
103 #endif
104 #ifndef OF_IEEE
105 #define OF_IEEE
106 #endif
107 #ifndef OF_MACHO
108 #define OF_MACHO
109 #endif
110 #endif /* OF_ALL */
112 /* turn on groups of formats specified.... */
113 #ifdef OF_DOS
114 #ifndef OF_OBJ
115 #define OF_OBJ
116 #endif
117 #ifndef OF_BIN
118 #define OF_BIN
119 #endif
120 #ifndef OF_WIN32
121 #define OF_WIN32
122 #endif
123 #ifndef OF_WIN64
124 #define OF_WIN64
125 #endif
126 #endif
128 #ifdef OF_UNIX
129 #ifndef OF_AOUT
130 #define OF_AOUT
131 #endif
132 #ifndef OF_AOUTB
133 #define OF_AOUTB
134 #endif
135 #ifndef OF_COFF
136 #define OF_COFF
137 #endif
138 #ifndef OF_ELF32
139 #define OF_ELF32
140 #endif
141 #ifndef OF_ELF64
142 #define OF_ELF64
143 #endif
144 #endif
146 #ifdef OF_OTHERS
147 #ifndef OF_BIN
148 #define OF_BIN
149 #endif
150 #ifndef OF_AS86
151 #define OF_AS86
152 #endif
153 #ifndef OF_RDF2
154 #define OF_RDF2
155 #endif
156 #ifndef OF_IEEE
157 #define OF_IEEE
158 #endif
159 #ifndef OF_MACHO
160 #define OF_MACHO
161 #endif
162 #endif
164 /* finally... override any format specifically specified to be off */
165 #ifdef OF_NO_BIN
166 #undef OF_BIN
167 #endif
168 #ifdef OF_NO_OBJ
169 #undef OF_OBJ
170 #endif
171 #ifdef OF_NO_ELF32
172 #undef OF_ELF32
173 #endif
174 #ifdef OF_NO_ELF64
175 #undef OF_ELF64
176 #endif
177 #ifdef OF_NO_AOUT
178 #undef OF_AOUT
179 #endif
180 #ifdef OF_NO_AOUTB
181 #undef OF_AOUTB
182 #endif
183 #ifdef OF_NO_COFF
184 #undef OF_COFF
185 #endif
186 #ifdef OF_NO_WIN32
187 #undef OF_WIN32
188 #endif
189 #ifdef OF_NO_WIN64
190 #undef OF_WIN64
191 #endif
192 #ifdef OF_NO_AS86
193 #undef OF_AS86
194 #endif
195 #ifdef OF_NO_RDF2
196 #undef OF_RDF
197 #endif
198 #ifdef OF_NO_IEEE
199 #undef OF_IEEE
200 #endif
201 #ifdef OF_NO_MACHO
202 #undef OF_MACHO
203 #endif
205 #ifndef OF_DEFAULT
206 #define OF_DEFAULT of_bin
207 #endif
209 #ifdef BUILD_DRIVERS_ARRAY /* only if included from outform.c */
211 /* pull in the externs for the different formats, then make the *drivers
212 * array based on the above defines */
214 extern struct ofmt of_bin;
215 extern struct ofmt of_aout;
216 extern struct ofmt of_aoutb;
217 extern struct ofmt of_coff;
218 extern struct ofmt of_elf32;
219 extern struct ofmt of_elf;
220 extern struct ofmt of_elf64;
221 extern struct ofmt of_as86;
222 extern struct ofmt of_obj;
223 extern struct ofmt of_win32;
224 extern struct ofmt of_win64;
225 extern struct ofmt of_rdf2;
226 extern struct ofmt of_ieee;
227 extern struct ofmt of_macho;
228 extern struct ofmt of_dbg;
230 struct ofmt *drivers[] = {
231 #ifdef OF_BIN
232 &of_bin,
233 #endif
234 #ifdef OF_AOUT
235 &of_aout,
236 #endif
237 #ifdef OF_AOUTB
238 &of_aoutb,
239 #endif
240 #ifdef OF_COFF
241 &of_coff,
242 #endif
243 #ifdef OF_ELF32
244 &of_elf32,
245 &of_elf,
246 #endif
247 #ifdef OF_ELF64
248 &of_elf64,
249 #endif
250 #ifdef OF_AS86
251 &of_as86,
252 #endif
253 #ifdef OF_OBJ
254 &of_obj,
255 #endif
256 #ifdef OF_WIN32
257 &of_win32,
258 #endif
259 #ifdef OF_WIN64
260 &of_win64,
261 #endif
262 #ifdef OF_RDF2
263 &of_rdf2,
264 #endif
265 #ifdef OF_IEEE
266 &of_ieee,
267 #endif
268 #ifdef OF_MACHO
269 &of_macho,
270 #endif
271 #ifdef OF_DBG
272 &of_dbg,
273 #endif
275 NULL
278 #endif /* BUILD_DRIVERS_ARRAY */
280 struct ofmt *ofmt_find(char *);
281 struct dfmt *dfmt_find(struct ofmt *, char *);
282 void ofmt_list(struct ofmt *, FILE *);
283 void dfmt_list(struct ofmt *ofmt, FILE * fp);
284 struct ofmt *ofmt_register(efunc error);
286 #endif /* NASM_OUTFORM_H */