Listtree.mcc: rename variables in Listtree_GetEntry to match the template of other...
[AROS.git] / tools / genmodule / writeautoinit.c
blob84642dc9fbf2d57d7c98ffcc20e1d0d32fed68d2
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
5 Function to write module_autoinit.c. Part of genmodule.
6 */
8 #include "genmodule.h"
10 void writeautoinit(struct config *cfg, int is_rel)
12 FILE *out;
13 char line[256], *banner;
14 struct stringlist *linelistit;
16 snprintf(line, 255, "%s/%s_%sautoinit.c", cfg->gendir, cfg->modulename, is_rel ? "rel" : "");
17 out = fopen(line, "w");
19 if (out==NULL)
21 perror(line);
22 exit(20);
25 /* Write the code to be added to startup provided in the config file */
26 if (!is_rel) {
27 for (linelistit = cfg->startuplines; linelistit != NULL; linelistit = linelistit->next)
29 fprintf(out, "%s\n", linelistit->s);
33 banner = getBanner(cfg);
34 fprintf(out, "%s\n", banner);
35 freeBanner(banner);
37 if (!(cfg->options & OPTION_NOINCLUDES))
38 fprintf(out, "#include <proto/%s.h>\n", cfg->includename);
39 fprintf(out,
40 "#include <aros/symbolsets.h>\n"
41 "\n"
42 "AROS_%sLIBSET(\"%s.%s\", %s, %s)\n",
43 is_rel ? "REL" : "",
44 cfg->includename, cfg->suffix,
45 cfg->libbasetypeptrextern, cfg->libbase
48 fprintf(out,
49 "AROS_IMPORT_ASM_SYM(int, dummy, __include%slibrarieshandling);\n",
50 is_rel ? "rel" : ""
53 if (cfg->forcelist!=NULL)
55 struct stringlist * forcelistit;
57 fprintf(out, "\n");
58 for (forcelistit = cfg->forcelist;
59 forcelistit!=NULL;
60 forcelistit = forcelistit->next
63 /* By bringing in __aros_getbase_XXXBase() we assure parent will open
64 this library */
65 fprintf(
66 out,
67 "AROS_IMPORT_ASM_SYM(void *, __dummy_%s, __aros_getbase_%s);\n",
68 forcelistit->s, forcelistit->s
72 fclose(out);