Fixed to work with ABIv1.
[AROS.git] / tools / genmodule / genmodule.c
blobcb1e928ee86f5f8163a41dbc4d42be25d27930b1
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Main for genmodule. A tool to generate files for building modules.
6 */
7 #include "genmodule.h"
9 int main(int argc, char **argv)
11 char *s;
12 struct config *cfg = initconfig(argc, argv);
14 switch (cfg->command)
16 case FILES:
17 writestart(cfg);
18 writeend(cfg);
19 if (cfg->options & OPTION_AUTOINIT)
21 writeautoinit(cfg, 0); /* normal */
22 if (cfg->options & OPTION_RELLINKLIB)
23 writeautoinit(cfg, 1); /* relbase */
25 if (cfg->modtype == LIBRARY)
27 writegetlibbase(cfg, 0); /* normal */
28 if (cfg->options & OPTION_RELLINKLIB)
29 writegetlibbase(cfg, 1); /* relbase */
31 if (cfg->options & OPTION_STUBS)
33 writestubs(cfg, 0); /* normal */
34 if (cfg->options & OPTION_RELLINKLIB)
35 writestubs(cfg, 1); /* relbase */
37 break;
39 case INCLUDES:
40 if (cfg->options & OPTION_INCLUDES)
42 writeincproto(cfg);
43 writeincclib(cfg);
44 writeincdefines(cfg);
45 writeincinline(cfg);
47 if (cfg->interfacelist)
48 writeincinterfaces(cfg);
49 break;
51 case LIBDEFS:
52 writeinclibdefs(cfg);
53 break;
55 case MAKEFILE:
56 writemakefile(cfg);
57 break;
59 case WRITEFUNCLIST:
60 /* Ignore the functionlist and the methodlist that are available in the
61 * .conf file.
63 cfg->funclist = NULL;
64 if (cfg->classlist != NULL)
65 cfg->classlist->methlist = NULL;
67 writefunclist(cfg);
68 break;
70 case WRITEFD:
71 writefd(cfg);
72 break;
74 case WRITESKEL:
75 writeskel(cfg);
76 break;
78 case WRITETHUNK:
79 writethunk(cfg);
80 break;
82 default:
83 fprintf(stderr, "Internal error in main: Unhandled command type\n");
84 exit(20);
87 return 0;