Removed codesetslib because we have now external repo.
[cake.git] / tools / genmodule / writeautoinit.c
blob25e6e6af64a8cd47d4f602cdbac3b7b9e797c72b
1 /*
2 Copyright © 1995-2004, The AROS Development Team. All rights reserved.
3 $Id$
5 Function to write module_autoinit.c. Part of genmodule.
6 */
7 #include "genmodule.h"
9 void writeautoinit(struct config *cfg)
11 FILE *out;
12 char line[256];
14 snprintf(line, 255, "%s/%s_autoinit.c", cfg->gendir, cfg->modulename);
15 out = fopen(line, "w");
17 if (out==NULL)
19 perror(line);
20 exit(20);
23 fprintf(out,
24 "%s"
25 "\n"
26 "#include <proto/%s.h>\n"
27 "#include <aros/symbolsets.h>\n"
28 "\n"
29 "ADD2LIBS(\"%s.library\",%u, %s, %s);\n",
30 getBanner(cfg), cfg->modulename,
31 cfg->modulename, cfg->majorversion, cfg->libbasetypeptrextern, cfg->libbase
34 if (cfg->forcelist!=NULL)
36 struct stringlist * forcelistit;
38 fprintf(out, "\n");
39 for (forcelistit = cfg->forcelist;
40 forcelistit!=NULL;
41 forcelistit = forcelistit->next
44 fprintf(out, "extern struct Library *%s;\n", forcelistit->s);
46 fprintf(out, "\nvoid __%s_forcelibs(void)\n{\n", cfg->modulename);
47 for (forcelistit = cfg->forcelist;
48 forcelistit!=NULL;
49 forcelistit = forcelistit->next
52 fprintf(out, " %s = NULL;\n", forcelistit->s);
54 fprintf(out, "}\n");
56 fclose(out);