only bring in as many sdl things as are strictly necessary
[tangerine.git] / tools / genmodule / writeautoinit.c
blob9bc9f74f3374e295e810190f27edc51a32f26f6b
1 /*
2 Copyright © 1995-2009, 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], *banner;
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 banner = getBanner(cfg);
24 fprintf(out,
25 "%s"
26 "\n"
27 "#include <proto/%s.h>\n"
28 "#include <aros/symbolsets.h>\n"
29 "\n"
30 "ADD2LIBS((CONST_STRPTR)\"%s.library\",%u, %s, %s);\n",
31 banner, cfg->modulename,
32 cfg->modulename, cfg->majorversion, cfg->libbasetypeptrextern, cfg->libbase
34 freeBanner(banner);
36 if (cfg->forcelist!=NULL)
38 struct stringlist * forcelistit;
40 fprintf(out, "\n");
41 for (forcelistit = cfg->forcelist;
42 forcelistit!=NULL;
43 forcelistit = forcelistit->next
46 fprintf(out, "extern struct Library *%s;\n", forcelistit->s);
48 fprintf(out, "\nvoid __%s_forcelibs(void)\n{\n", cfg->modulename);
49 for (forcelistit = cfg->forcelist;
50 forcelistit!=NULL;
51 forcelistit = forcelistit->next
54 fprintf(out, " %s = NULL;\n", forcelistit->s);
56 fprintf(out, "}\n");
58 fclose(out);