2 Copyright © 2005, The AROS Development Team. All rights reserved.
5 Code to write a Makefile with variables that provides the files
6 and configuration for building the module
12 #include "genmodule.h"
15 void writemakefile(struct config
*cfg
)
20 snprintf(name
, sizeof(name
), "%s/Makefile.%s", cfg
->gendir
, cfg
->modulename
);
22 out
= fopen(name
, "w");
31 "%s_STARTFILES := %s_start\n"
32 "%s_ENDFILES := %s_end\n"
34 cfg
->modulename
, cfg
->modulename
,
35 cfg
->modulename
, cfg
->modulename
,
36 cfg
->modulename
, cfg
->moddir
39 if (!(cfg
->intcfg
& CFG_GENLINKLIB
))
41 "%s_LINKLIBFILES :=\n"
42 "%s_LINKLIBAFILES :=\n",
52 "%s_LINKLIBFILES := %s_stubs %s_autoinit\n",
53 cfg
->modulename
, cfg
->modulename
, cfg
->modulename
60 "%s_LINKLIBFILES := %s_stubs\n",
61 cfg
->modulename
, cfg
->modulename
66 fprintf(stderr
, "Internal error in writemakefile: unsupported modtype for genlinklib\n");
70 fprintf(out
, "%s_LINKLIBAFILES :=", cfg
->modulename
);
71 if (cfg
->intcfg
& CFG_GENASTUBS
)
72 fprintf(out
, "%s_astubs\n", cfg
->modulename
);
77 fprintf(out
, "%s_INCLUDES := ", cfg
->modulename
);
85 "clib/%s_protos.h defines/%s.h proto/%s.h\n",
86 cfg
->modulename
, cfg
->modulename
, cfg
->modulename
99 fprintf(out
, "Internal error writemakefile: unhandled modtype for includes\n");
104 "%s_NEEDREF := %s\n",
105 cfg
->modulename
, (cfg
->intcfg
& CFG_NOREADREF
) ? "no" : "yes"
110 perror("Error writing Makefile");