1
0
mirror of https://github.com/cc65/cc65.git synced 2025-02-26 23:30:03 +00:00

More changes for module support

git-svn-id: svn://svn.cc65.org/cc65/trunk@1267 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2002-04-25 20:06:04 +00:00
parent 6e32cf4b11
commit 17503f9030

View File

@ -114,6 +114,9 @@ static const char* FirstInput = 0;
/* Remember if we should link a module */ /* Remember if we should link a module */
static int Module = 0; static int Module = 0;
/* Extension used for a module */
#define MODULE_EXT ".o65"
/* Name of the crt0 object file and the runtime library */ /* Name of the crt0 object file and the runtime library */
static char* TargetCRT0 = 0; static char* TargetCRT0 = 0;
static char* TargetLib = 0; static char* TargetLib = 0;
@ -121,7 +124,7 @@ static char* TargetLib = 0;
/*****************************************************************************/ /*****************************************************************************/
/* Determine a file type */ /* Determine a file type */
/*****************************************************************************/ /*****************************************************************************/
@ -363,26 +366,29 @@ static void Link (void)
*/ */
if (OutputName) { if (OutputName) {
CmdAddArg (&LD65, "-o"); CmdAddArg (&LD65, "-o");
CmdAddArg (&LD65, OutputName); CmdAddArg (&LD65, OutputName);
} else if (FirstInput && FindExt (FirstInput)) { /* Only if ext present! */ } else if (FirstInput && FindExt (FirstInput)) { /* Only if ext present! */
char* Output = MakeFilename (FirstInput, ""); const char* Extension = Module? MODULE_EXT : "";
CmdAddArg (&LD65, "-o"); char* Output = MakeFilename (FirstInput, Extension);
CmdAddArg (&LD65, Output); CmdAddArg (&LD65, "-o");
xfree (Output); CmdAddArg (&LD65, Output);
xfree (Output);
} }
/* If we have a startup file, add its name as a parameter */ /* If we have a startup file and if we are not linking a module, add its
if (TargetCRT0) { * name as a parameter
CmdAddArg (&LD65, TargetCRT0); */
if (TargetCRT0 && !Module) {
CmdAddArg (&LD65, TargetCRT0);
} }
/* Add all object files as parameters */ /* Add all object files as parameters */
for (I = 0; I < LD65.FileCount; ++I) { for (I = 0; I < LD65.FileCount; ++I) {
CmdAddArg (&LD65, LD65.Files [I]); CmdAddArg (&LD65, LD65.Files [I]);
} }
/* Add the system runtime library */ /* Add the system runtime library */
@ -816,15 +822,11 @@ static void OptStaticLocals (const char* Opt attribute ((unused)),
static void OptTarget (const char* Opt attribute ((unused)), const char* Arg) static void OptTarget (const char* Opt attribute ((unused)), const char* Arg)
/* Set the target system */ /* Set the target system */
{ {
if (Target != TGT_NONE) { Target = FindTarget (Arg);
Error ("Cannot specify -t twice"); if (Target == TGT_UNKNOWN) {
} else { Error ("No such target system: `%s'", Arg);
Target = FindTarget (Arg); } else if (Target == TGT_MODULE) {
if (Target == TGT_UNKNOWN) { Error ("Cannot use `module' as target, use --module instead");
Error ("No such target system: `%s'", Arg);
} else if (Target == TGT_MODULE) {
Error ("Cannot use `module' as target, use --module instead");
}
} }
} }