Some more clean up in clib:
[AROS.git] / tools / genmodule / genmodule.c
blobe6e751184d594ea96dbe992f8a69ffff1b6eb016
1 /*
2 Copyright © 1995-2005, 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 if (!(cfg->intcfg & CFG_NOREADREF))
18 readref(cfg);
19 writestart(cfg);
20 writeend(cfg);
21 if (cfg->options & OPTION_AUTOINIT)
22 writeautoinit(cfg);
23 if (cfg->options & OPTION_STUBS)
24 writestubs(cfg);
25 break;
27 case INCLUDES:
28 if (!(cfg->options & OPTION_INCLUDES))
30 fprintf(stderr, "%s called with writeincludes when no includes are present\n", argv[0]);
31 exit(20);
33 if (!(cfg->intcfg & CFG_NOREADREF))
34 readref(cfg);
35 /* fall through */
36 case DUMMY:
37 writeincproto(cfg);
38 writeincclib(cfg);
39 writeincdefines(cfg);
40 break;
42 case LIBDEFS:
43 writeinclibdefs(cfg);
44 break;
46 case MAKEFILE:
47 writemakefile(cfg);
48 break;
50 case WRITEFUNCLIST:
51 /* Ignore the functionlist and the methodlist that are available in the
52 * .conf file.
54 cfg->funclist = NULL;
55 if (cfg->classlist != NULL)
56 cfg->classlist->methlist = NULL;
58 readref(cfg);
59 writefunclist(cfg);
60 break;
62 default:
63 fprintf(stderr, "Internal error in main: Unhandled command type\n");
64 exit(20);
67 return 0;