tabs -> spaces.
[AROS.git] / tools / genmodule / genmodule.c
blob6145e3fd2aa0a7dd5b90f49804e46d0efb72bed3
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 writeautoinit(cfg, 1); /* relbase */
24 if (cfg->modtype == LIBRARY)
26 writegetlibbase(cfg, 0); /* normal */
27 writegetlibbase(cfg, 1); /* relbase */
29 if (cfg->options & OPTION_STUBS)
31 writestubs(cfg, 0); /* normal */
32 writestubs(cfg, 1); /* relbase */
34 break;
36 case INCLUDES:
37 if (cfg->options & OPTION_INCLUDES)
39 writeincproto(cfg);
40 writeincclib(cfg);
41 writeincdefines(cfg);
42 writeincinline(cfg);
44 if (cfg->interfacelist)
45 writeincinterfaces(cfg);
46 break;
48 case LIBDEFS:
49 writeinclibdefs(cfg);
50 break;
52 case MAKEFILE:
53 writemakefile(cfg);
54 break;
56 case WRITEFUNCLIST:
57 /* Ignore the functionlist and the methodlist that are available in the
58 * .conf file.
60 cfg->funclist = NULL;
61 if (cfg->classlist != NULL)
62 cfg->classlist->methlist = NULL;
64 writefunclist(cfg);
65 break;
67 case WRITEFD:
68 writefd(cfg);
69 break;
71 case WRITESKEL:
72 writeskel(cfg);
73 break;
75 default:
76 fprintf(stderr, "Internal error in main: Unhandled command type\n");
77 exit(20);
80 return 0;