Import SB128-v5.24 to main branch
[AROS.git] / tools / genmodule / genmodule.c
blob790da5ea46792d83ce96ee0933145f060ffc13e8
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)
20 writeautoinit(cfg);
21 if (cfg->options & OPTION_STUBS)
22 writestubs(cfg);
23 break;
25 case INCLUDES:
26 if (!(cfg->options & OPTION_INCLUDES))
28 fprintf(stderr, "%s called with writeincludes when no includes are present\n", argv[0]);
29 exit(20);
31 writeincproto(cfg);
32 writeincclib(cfg);
33 writeincdefines(cfg);
34 writeincinline(cfg);
35 break;
37 case LIBDEFS:
38 writeinclibdefs(cfg);
39 break;
41 case MAKEFILE:
42 writemakefile(cfg);
43 break;
45 case WRITEFUNCLIST:
46 /* Ignore the functionlist and the methodlist that are available in the
47 * .conf file.
49 cfg->funclist = NULL;
50 if (cfg->classlist != NULL)
51 cfg->classlist->methlist = NULL;
53 writefunclist(cfg);
54 break;
56 case WRITEFD:
57 writefd(cfg);
58 break;
60 case WRITESKEL:
61 writeskel(cfg);
62 break;
64 default:
65 fprintf(stderr, "Internal error in main: Unhandled command type\n");
66 exit(20);
69 return 0;