Adding the file extension for executables on Windows
This commit is contained in:
parent
af07b21194
commit
29725f24fc
@ -57,7 +57,7 @@ const String * sHostOS[HO_COUNT] =
|
||||
"Darwin",
|
||||
"FreeBSD", "NetBSD", "OpenBSD",
|
||||
"SunOS",
|
||||
"MINGW32_NT-5.0",
|
||||
"Windows",
|
||||
"unknown"
|
||||
};
|
||||
const HostKernelMap mHostKernel[] =
|
||||
|
@ -43,8 +43,8 @@ extern const String * sHostArch[HA_COUNT];
|
||||
typedef enum _HostOS
|
||||
{
|
||||
HO_DEFORAOS = 0,
|
||||
HO_DARWIN,
|
||||
HO_GNU_LINUX,
|
||||
HO_MACOSX,
|
||||
HO_FREEBSD, HO_NETBSD, HO_OPENBSD,
|
||||
HO_SUNOS,
|
||||
HO_WIN32,
|
||||
@ -52,6 +52,8 @@ typedef enum _HostOS
|
||||
} HostOS;
|
||||
# define HO_LAST HO_UNKNOWN
|
||||
# define HO_COUNT (HO_LAST + 1)
|
||||
/* aliases */
|
||||
# define HO_MACOSX HO_DARWIN
|
||||
extern const String * sHostOS[HO_COUNT];
|
||||
|
||||
typedef enum _HostKernel
|
||||
|
@ -269,6 +269,10 @@ static int _variables_targets(Configure * configure, FILE * fp)
|
||||
switch(enum_string(TT_LAST, sTargetType, type))
|
||||
{
|
||||
case TT_BINARY:
|
||||
fprintf(fp, " %s", prints);
|
||||
if(configure->os == HO_WIN32)
|
||||
fputs("$(EXEEXT)", fp);
|
||||
break;
|
||||
case TT_OBJECT:
|
||||
case TT_SCRIPT:
|
||||
case TT_UNKNOWN:
|
||||
@ -423,6 +427,7 @@ static void _executables_variables(Configure * configure, FILE * fp,
|
||||
static void _targets_asflags(Configure * configure, FILE * fp);
|
||||
static void _targets_cflags(Configure * configure, FILE * fp);
|
||||
static void _targets_cxxflags(Configure * configure, FILE * fp);
|
||||
static void _targets_exeext(Configure * configure, FILE * fp);
|
||||
static void _targets_ldflags(Configure * configure, FILE * fp);
|
||||
static void _binary_ldflags(Configure * configure, FILE * fp,
|
||||
String const * ldflags);
|
||||
@ -452,6 +457,7 @@ static void _variables_binary(Configure * configure, FILE * fp, char * done)
|
||||
_targets_cflags(configure, fp);
|
||||
_targets_cxxflags(configure, fp);
|
||||
_targets_ldflags(configure, fp);
|
||||
_targets_exeext(configure, fp);
|
||||
}
|
||||
}
|
||||
|
||||
@ -529,6 +535,12 @@ static void _targets_cxxflags(Configure * configure, FILE * fp)
|
||||
}
|
||||
}
|
||||
|
||||
static void _targets_exeext(Configure * configure, FILE * fp)
|
||||
{
|
||||
if(configure->os == HO_WIN32)
|
||||
fputs("EXEEXT\t= .exe\n", fp);
|
||||
}
|
||||
|
||||
static void _targets_ldflags(Configure * configure, FILE * fp)
|
||||
{
|
||||
String const * p;
|
||||
@ -642,6 +654,7 @@ static void _variables_library(Configure * configure, FILE * fp, char * done)
|
||||
_targets_cflags(configure, fp);
|
||||
_targets_cxxflags(configure, fp);
|
||||
_targets_ldflags(configure, fp);
|
||||
_targets_exeext(configure, fp);
|
||||
}
|
||||
if((p = config_get(configure->config, "", "ar")) == NULL)
|
||||
_makefile_output_variable(fp, "AR", "ar", 0);
|
||||
@ -905,7 +918,8 @@ static int _target_binary(Configure * configure, FILE * fp,
|
||||
return 0;
|
||||
if(_target_flags(configure, fp, target) != 0)
|
||||
return 1;
|
||||
fprintf(fp, "\n%s%s%s%s", target, ": $(", target, "_OBJS)");
|
||||
fprintf(fp, "\n%s%s%s%s%s", target, (configure->os == HO_WIN32)
|
||||
? "$(EXEEXT)" : "", ": $(", target, "_OBJS)");
|
||||
if((p = config_get(configure->config, target, "depends")) != NULL)
|
||||
{
|
||||
if((q = string_new(p)) == NULL
|
||||
@ -917,8 +931,9 @@ static int _target_binary(Configure * configure, FILE * fp,
|
||||
fprintf(fp, " %s", q);
|
||||
string_delete(q);
|
||||
}
|
||||
fprintf(fp, "%s%s%s%s%s%s%s", "\n\t$(CC) -o ", target, " $(", target,
|
||||
"_OBJS) $(", target, "_LDFLAGS)");
|
||||
fprintf(fp, "%s%s%s%s%s%s%s%s", "\n\t$(CC) -o ", target,
|
||||
(configure->os == HO_WIN32) ? "$(EXEEXT)" : "", " $(",
|
||||
target, "_OBJS) $(", target, "_LDFLAGS)");
|
||||
fputc('\n', fp);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user