Add support for spaces in filenames (5/x)
This takes care of binaries. GNU Make is required for this to work.
This commit is contained in:
parent
371b3ecea3
commit
33c8a05ee2
249
src/makefile.c
249
src/makefile.c
@ -82,6 +82,8 @@ static int _makefile_output_variable(Makefile * makefile, String const * name,
|
|||||||
static int _makefile_mkdir(Makefile * makefile, char const * directory);
|
static int _makefile_mkdir(Makefile * makefile, char const * directory);
|
||||||
static int _makefile_print(Makefile * makefile, char const * format, ...);
|
static int _makefile_print(Makefile * makefile, char const * format, ...);
|
||||||
static int _makefile_print_escape(Makefile * makefile, char const * str);
|
static int _makefile_print_escape(Makefile * makefile, char const * str);
|
||||||
|
static int _makefile_print_escape_variable(Makefile * makefile,
|
||||||
|
char const * str);
|
||||||
static int _makefile_remove(Makefile * makefile, int recursive, ...);
|
static int _makefile_remove(Makefile * makefile, int recursive, ...);
|
||||||
static int _makefile_subdirs(Makefile * makefile, char const * target);
|
static int _makefile_subdirs(Makefile * makefile, char const * target);
|
||||||
static int _makefile_target(Makefile * makefile, char const * target, ...);
|
static int _makefile_target(Makefile * makefile, char const * target, ...);
|
||||||
@ -336,9 +338,12 @@ static int _variables_targets(Makefile * makefile)
|
|||||||
switch(enum_string(TT_LAST, sTargetType, type))
|
switch(enum_string(TT_LAST, sTargetType, type))
|
||||||
{
|
{
|
||||||
case TT_BINARY:
|
case TT_BINARY:
|
||||||
_makefile_print(makefile,
|
_makefile_print(makefile, "%s",
|
||||||
" $(OBJDIR)%s$(EXEEXT)",
|
" $(OBJDIR)");
|
||||||
|
_makefile_print_escape(makefile,
|
||||||
prints);
|
prints);
|
||||||
|
_makefile_print(makefile, "%s",
|
||||||
|
"$(EXEEXT)");
|
||||||
break;
|
break;
|
||||||
case TT_COMMAND:
|
case TT_COMMAND:
|
||||||
phony = _makefile_is_phony(makefile,
|
phony = _makefile_is_phony(makefile,
|
||||||
@ -994,7 +999,9 @@ static int _target_objs(Makefile * makefile, String const * target)
|
|||||||
if((sources = string_new(p)) == NULL)
|
if((sources = string_new(p)) == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
q = sources;
|
q = sources;
|
||||||
_makefile_print(makefile, "%s%s%s", "\n", target, "_OBJS =");
|
_makefile_print(makefile, "\n");
|
||||||
|
_makefile_print_escape_variable(makefile, target);
|
||||||
|
_makefile_print(makefile, "%s", "_OBJS =");
|
||||||
for(i = 0; ret == 0; i++)
|
for(i = 0; ret == 0; i++)
|
||||||
{
|
{
|
||||||
if(sources[i] != ',' && sources[i] != '\0')
|
if(sources[i] != ',' && sources[i] != '\0')
|
||||||
@ -1034,8 +1041,9 @@ static int _objs_source(Makefile * makefile, String * source, TargetType tt)
|
|||||||
case OT_CXX_SOURCE:
|
case OT_CXX_SOURCE:
|
||||||
case OT_OBJC_SOURCE:
|
case OT_OBJC_SOURCE:
|
||||||
case OT_OBJCXX_SOURCE:
|
case OT_OBJCXX_SOURCE:
|
||||||
_makefile_print(makefile, "%s%s%s", " $(OBJDIR)",
|
_makefile_print(makefile, "%s", " $(OBJDIR)");
|
||||||
source,
|
_makefile_print_escape(makefile, source);
|
||||||
|
_makefile_print(makefile, "%s",
|
||||||
(tt == TT_LIBTOOL) ? ".lo" : ".o");
|
(tt == TT_LIBTOOL) ? ".lo" : ".o");
|
||||||
break;
|
break;
|
||||||
case OT_JAVA_SOURCE:
|
case OT_JAVA_SOURCE:
|
||||||
@ -1067,16 +1075,23 @@ static int _target_binary(Makefile * makefile, String const * target)
|
|||||||
return 1;
|
return 1;
|
||||||
_makefile_print(makefile, "\n");
|
_makefile_print(makefile, "\n");
|
||||||
/* output the binary target */
|
/* output the binary target */
|
||||||
_makefile_print(makefile, "%s%s%s%s%s%s", "$(OBJDIR)", target,
|
_makefile_print(makefile, "%s", "$(OBJDIR)");
|
||||||
"$(EXEEXT)", ": $(", target, "_OBJS)");
|
_makefile_print_escape(makefile, target);
|
||||||
|
_makefile_print(makefile, "%s", "$(EXEEXT): $(");
|
||||||
|
_makefile_print_escape_variable(makefile, target);
|
||||||
|
_makefile_print(makefile, "%s", "_OBJS)");
|
||||||
if((p = _makefile_get_config(makefile, target, "depends")) != NULL
|
if((p = _makefile_get_config(makefile, target, "depends")) != NULL
|
||||||
&& _makefile_expand(makefile, p) != 0)
|
&& _makefile_expand(makefile, p) != 0)
|
||||||
return error_print(PROGNAME);
|
return error_print(PROGNAME);
|
||||||
_makefile_print(makefile, "\n");
|
_makefile_print(makefile, "\n");
|
||||||
/* build the binary */
|
/* build the binary */
|
||||||
_makefile_print(makefile, "%s%s%s%s%s%s%s", "\t$(CC) -o $(OBJDIR)",
|
_makefile_print(makefile, "%s", "\t$(CC) -o $(OBJDIR)");
|
||||||
target, "$(EXEEXT) $(", target, "_OBJS) $(", target,
|
_makefile_print_escape(makefile, target);
|
||||||
"_LDFLAGS)\n");
|
_makefile_print(makefile, "%s", "$(EXEEXT) $(");
|
||||||
|
_makefile_print_escape_variable(makefile, target);
|
||||||
|
_makefile_print(makefile, "%s", "_OBJS) $(");
|
||||||
|
_makefile_print_escape_variable(makefile, target);
|
||||||
|
_makefile_print(makefile, "%s", "_LDFLAGS)\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1196,8 +1211,8 @@ static void _flags_c(Makefile * makefile, String const * target)
|
|||||||
{
|
{
|
||||||
String const * p;
|
String const * p;
|
||||||
|
|
||||||
_makefile_print(makefile, "%s%s", target, "_CFLAGS = $(CPPFLAGSF)"
|
_makefile_print_escape_variable(makefile, target);
|
||||||
" $(CPPFLAGS)");
|
_makefile_print(makefile, "%s", "_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS)");
|
||||||
if((p = _makefile_get_config(makefile, target, "cppflags")) != NULL)
|
if((p = _makefile_get_config(makefile, target, "cppflags")) != NULL)
|
||||||
_makefile_print(makefile, " %s", p);
|
_makefile_print(makefile, " %s", p);
|
||||||
_makefile_print(makefile, "%s", " $(CFLAGSF) $(CFLAGS)");
|
_makefile_print(makefile, "%s", " $(CFLAGSF) $(CFLAGS)");
|
||||||
@ -1208,8 +1223,9 @@ static void _flags_c(Makefile * makefile, String const * target)
|
|||||||
&& string_find(p, "-ansi"))
|
&& string_find(p, "-ansi"))
|
||||||
_makefile_print(makefile, "%s", " -D _GNU_SOURCE");
|
_makefile_print(makefile, "%s", " -D _GNU_SOURCE");
|
||||||
}
|
}
|
||||||
_makefile_print(makefile, "\n%s%s", target,
|
_makefile_print(makefile, "\n");
|
||||||
"_LDFLAGS = $(LDFLAGSF) $(LDFLAGS)");
|
_makefile_print_escape_variable(makefile, target);
|
||||||
|
_makefile_print(makefile, "%s", "_LDFLAGS = $(LDFLAGSF) $(LDFLAGS)");
|
||||||
if((p = _makefile_get_config(makefile, target, "ldflags")) != NULL)
|
if((p = _makefile_get_config(makefile, target, "ldflags")) != NULL)
|
||||||
_binary_ldflags(makefile, p);
|
_binary_ldflags(makefile, p);
|
||||||
_makefile_print(makefile, "\n");
|
_makefile_print(makefile, "\n");
|
||||||
@ -1219,15 +1235,16 @@ static void _flags_cxx(Makefile * makefile, String const * target)
|
|||||||
{
|
{
|
||||||
String const * p;
|
String const * p;
|
||||||
|
|
||||||
_makefile_print(makefile, "%s%s", target, "_CXXFLAGS = $(CPPFLAGSF)"
|
_makefile_print_escape_variable(makefile, target);
|
||||||
" $(CPPFLAGS)");
|
_makefile_print(makefile, "%s", "_CXXFLAGS = $(CPPFLAGSF) $(CPPFLAGS)");
|
||||||
if((p = _makefile_get_config(makefile, target, "cppflags")) != NULL)
|
if((p = _makefile_get_config(makefile, target, "cppflags")) != NULL)
|
||||||
_makefile_print(makefile, " %s", p);
|
_makefile_print(makefile, " %s", p);
|
||||||
_makefile_print(makefile, "%s", " $(CXXFLAGSF) $(CXXFLAGS)");
|
_makefile_print(makefile, "%s", " $(CXXFLAGSF) $(CXXFLAGS)");
|
||||||
if((p = _makefile_get_config(makefile, target, "cxxflags")) != NULL)
|
if((p = _makefile_get_config(makefile, target, "cxxflags")) != NULL)
|
||||||
_makefile_print(makefile, " %s", p);
|
_makefile_print(makefile, " %s", p);
|
||||||
_makefile_print(makefile, "\n%s%s", target,
|
_makefile_print(makefile, "\n");
|
||||||
"_LDFLAGS = $(LDFLAGSF) $(LDFLAGS)");
|
_makefile_print_escape_variable(makefile, target);
|
||||||
|
_makefile_print(makefile, "%s", "_LDFLAGS = $(LDFLAGSF) $(LDFLAGS)");
|
||||||
if((p = _makefile_get_config(makefile, target, "ldflags")) != NULL)
|
if((p = _makefile_get_config(makefile, target, "ldflags")) != NULL)
|
||||||
_binary_ldflags(makefile, p);
|
_binary_ldflags(makefile, p);
|
||||||
_makefile_print(makefile, "\n");
|
_makefile_print(makefile, "\n");
|
||||||
@ -1453,8 +1470,9 @@ static int _target_object(Makefile * makefile,
|
|||||||
switch(source_type(extension))
|
switch(source_type(extension))
|
||||||
{
|
{
|
||||||
case OT_ASM_SOURCE:
|
case OT_ASM_SOURCE:
|
||||||
_makefile_print(makefile, "\n%s%s%s",
|
_makefile_print(makefile, "\n%s%s",
|
||||||
target, "_OBJS = $(OBJDIR)", target);
|
target, "_OBJS = $(OBJDIR)");
|
||||||
|
_makefile_print_escape(makefile, target);
|
||||||
_makefile_print(makefile, "\n%s%s", target, "_ASFLAGS ="
|
_makefile_print(makefile, "\n%s%s", target, "_ASFLAGS ="
|
||||||
" $(ASFLAGSF) $(ASFLAGS)");
|
" $(ASFLAGSF) $(ASFLAGS)");
|
||||||
if((p = _makefile_get_config(makefile, target,
|
if((p = _makefile_get_config(makefile, target,
|
||||||
@ -1463,8 +1481,9 @@ static int _target_object(Makefile * makefile,
|
|||||||
_makefile_print(makefile, "\n");
|
_makefile_print(makefile, "\n");
|
||||||
break;
|
break;
|
||||||
case OT_ASMPP_SOURCE:
|
case OT_ASMPP_SOURCE:
|
||||||
_makefile_print(makefile, "\n%s%s%s", target,
|
_makefile_print(makefile, "\n%s%s", target,
|
||||||
"_OBJS = $(OBJDIR)", target);
|
"_OBJS = $(OBJDIR)");
|
||||||
|
_makefile_print_escape(makefile, target);
|
||||||
_makefile_print(makefile, "\n%s%s", target,
|
_makefile_print(makefile, "\n%s%s", target,
|
||||||
"_CPPFLAGS = $(CPPFLAGSF) $(CPPFLAGS)");
|
"_CPPFLAGS = $(CPPFLAGSF) $(CPPFLAGS)");
|
||||||
if((p = _makefile_get_config(makefile, target,
|
if((p = _makefile_get_config(makefile, target,
|
||||||
@ -1479,8 +1498,9 @@ static int _target_object(Makefile * makefile,
|
|||||||
break;
|
break;
|
||||||
case OT_C_SOURCE:
|
case OT_C_SOURCE:
|
||||||
case OT_OBJC_SOURCE:
|
case OT_OBJC_SOURCE:
|
||||||
_makefile_print(makefile, "\n%s%s%s%s", target,
|
_makefile_print(makefile, "\n%s%s%s", target,
|
||||||
"_OBJS = ", "$(OBJDIR)", target);
|
"_OBJS = ", "$(OBJDIR)");
|
||||||
|
_makefile_print_escape(makefile, target);
|
||||||
_makefile_print(makefile, "\n%s%s", target, "_CFLAGS ="
|
_makefile_print(makefile, "\n%s%s", target, "_CFLAGS ="
|
||||||
" $(CPPFLAGSF) $(CPPFLAGS)");
|
" $(CPPFLAGSF) $(CPPFLAGS)");
|
||||||
if((p = _makefile_get_config(makefile, target,
|
if((p = _makefile_get_config(makefile, target,
|
||||||
@ -1495,8 +1515,9 @@ static int _target_object(Makefile * makefile,
|
|||||||
break;
|
break;
|
||||||
case OT_CXX_SOURCE:
|
case OT_CXX_SOURCE:
|
||||||
case OT_OBJCXX_SOURCE:
|
case OT_OBJCXX_SOURCE:
|
||||||
_makefile_print(makefile, "\n%s%s%s%s", target,
|
_makefile_print(makefile, "\n%s%s%s", target,
|
||||||
"_OBJS = ", "$(OBJDIR)", target);
|
"_OBJS = ", "$(OBJDIR)");
|
||||||
|
_makefile_print_escape(makefile, target);
|
||||||
_makefile_print(makefile, "\n%s%s", target,
|
_makefile_print(makefile, "\n%s%s", target,
|
||||||
"_CXXFLAGS = $(CPPFLAGSF) $(CPPFLAGS)");
|
"_CXXFLAGS = $(CPPFLAGSF) $(CPPFLAGS)");
|
||||||
if((p = _makefile_get_config(makefile, target,
|
if((p = _makefile_get_config(makefile, target,
|
||||||
@ -1796,41 +1817,61 @@ static int _target_source(Makefile * makefile,
|
|||||||
source[len] = '.'; /* FIXME ugly */
|
source[len] = '.'; /* FIXME ugly */
|
||||||
if(ot == OT_ASMPP_SOURCE)
|
if(ot == OT_ASMPP_SOURCE)
|
||||||
{
|
{
|
||||||
_makefile_print(makefile, "%s%s%s", " $(",
|
_makefile_print(makefile, "%s", " $(");
|
||||||
target, "_CPPFLAGS)");
|
_makefile_print_escape_variable(makefile,
|
||||||
|
target);
|
||||||
|
_makefile_print(makefile, "%s", "_CPPFLAGS)");
|
||||||
if((p = _makefile_get_config(makefile, source,
|
if((p = _makefile_get_config(makefile, source,
|
||||||
"cppflags"))
|
"cppflags"))
|
||||||
!= NULL)
|
!= NULL)
|
||||||
_makefile_print(makefile, " %s", p);
|
_makefile_print(makefile, " %s", p);
|
||||||
}
|
}
|
||||||
_makefile_print(makefile, "%s%s%s", " $(", target,
|
_makefile_print(makefile, "%s", " $(");
|
||||||
"_ASFLAGS)");
|
_makefile_print_escape_variable(makefile, target);
|
||||||
|
_makefile_print(makefile, "%s", "_ASFLAGS)");
|
||||||
if((p = _makefile_get_config(makefile, source,
|
if((p = _makefile_get_config(makefile, source,
|
||||||
"asflags")) != NULL)
|
"asflags")) != NULL)
|
||||||
_makefile_print(makefile, " %s", p);
|
_makefile_print(makefile, " %s", p);
|
||||||
source[len] = '\0'; /* FIXME ugly */
|
source[len] = '\0'; /* FIXME ugly */
|
||||||
if(tt == TT_OBJECT)
|
if(tt == TT_OBJECT)
|
||||||
_makefile_print(makefile, "%s%s%s%s%s%s",
|
{
|
||||||
" -o $(OBJDIR)", target, " ",
|
_makefile_print(makefile, "%s", " -o $(OBJDIR)");
|
||||||
source, ".", extension);
|
_makefile_print_escape(makefile, target);
|
||||||
|
_makefile_print(makefile, " ");
|
||||||
|
_makefile_print_escape(makefile, source);
|
||||||
|
_makefile_print(makefile, ".%s\n", extension);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
_makefile_print(makefile, "%s%s%s%s%s%s",
|
{
|
||||||
" -o $(OBJDIR)", source, ".o ",
|
_makefile_print(makefile, "%s", " -o $(OBJDIR)");
|
||||||
source, ".", extension);
|
_makefile_print_escape(makefile, source);
|
||||||
_makefile_print(makefile, "\n");
|
_makefile_print(makefile, ".o ");
|
||||||
|
_makefile_print_escape(makefile, source);
|
||||||
|
_makefile_print(makefile, ".%s\n", extension);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case OT_C_SOURCE:
|
case OT_C_SOURCE:
|
||||||
case OT_OBJC_SOURCE:
|
case OT_OBJC_SOURCE:
|
||||||
if(tt == TT_OBJECT)
|
if(tt == TT_OBJECT)
|
||||||
_makefile_print(makefile, "%s%s", "\n$(OBJDIR)",
|
{
|
||||||
target);
|
_makefile_print(makefile, "%s", "\n$(OBJDIR)");
|
||||||
|
_makefile_print_escape(makefile, target);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
_makefile_print(makefile, "%s%s%s", "\n$(OBJDIR)",
|
{
|
||||||
source, ".o");
|
_makefile_print(makefile, "%s", "\n$(OBJDIR)");
|
||||||
|
_makefile_print_escape(makefile, source);
|
||||||
|
_makefile_print(makefile, ".o");
|
||||||
|
}
|
||||||
if(tt == TT_LIBTOOL)
|
if(tt == TT_LIBTOOL)
|
||||||
_makefile_print(makefile, " %s%s", source, ".lo");
|
{
|
||||||
_makefile_print(makefile, "%s%s%s%s", ": ", source, ".",
|
_makefile_print(makefile, " ");
|
||||||
extension);
|
_makefile_print_escape(makefile, source);
|
||||||
|
_makefile_print(makefile, "%s" ".lo");
|
||||||
|
}
|
||||||
|
_makefile_print(makefile, ": ");
|
||||||
|
_makefile_print_escape(makefile, source);
|
||||||
|
_makefile_print(makefile, ".%s", extension);
|
||||||
source[len] = '.'; /* FIXME ugly */
|
source[len] = '.'; /* FIXME ugly */
|
||||||
_source_depends(makefile, source);
|
_source_depends(makefile, source);
|
||||||
_makefile_print(makefile, "%s", "\n\t");
|
_makefile_print(makefile, "%s", "\n\t");
|
||||||
@ -1846,8 +1887,9 @@ static int _target_source(Makefile * makefile,
|
|||||||
_makefile_print(makefile, "%s", "$(CC)");
|
_makefile_print(makefile, "%s", "$(CC)");
|
||||||
if(p != NULL)
|
if(p != NULL)
|
||||||
_makefile_print(makefile, " %s", p);
|
_makefile_print(makefile, " %s", p);
|
||||||
_makefile_print(makefile, "%s%s%s", " $(", target,
|
_makefile_print(makefile, "%s", " $(");
|
||||||
"_CFLAGS)");
|
_makefile_print_escape_variable(makefile, target);
|
||||||
|
_makefile_print(makefile, "%s", "_CFLAGS)");
|
||||||
if(q != NULL)
|
if(q != NULL)
|
||||||
{
|
{
|
||||||
_makefile_print(makefile, " %s", q);
|
_makefile_print(makefile, " %s", q);
|
||||||
@ -1858,46 +1900,66 @@ static int _target_source(Makefile * makefile,
|
|||||||
" -D _GNU_SOURCE");
|
" -D _GNU_SOURCE");
|
||||||
}
|
}
|
||||||
if(tt == TT_OBJECT)
|
if(tt == TT_OBJECT)
|
||||||
_makefile_print(makefile, "%s%s",
|
{
|
||||||
" -o $(OBJDIR)", target);
|
_makefile_print(makefile, "%s",
|
||||||
|
" -o $(OBJDIR)");
|
||||||
|
_makefile_print_escape(makefile, target);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
_makefile_print(makefile, "%s%s%s",
|
{
|
||||||
" -o $(OBJDIR)", source, ".o");
|
_makefile_print(makefile, "%s",
|
||||||
_makefile_print(makefile, "%s%s%s%s%c", " -c ", source, ".",
|
" -o $(OBJDIR)");
|
||||||
extension, '\n');
|
_makefile_print_escape(makefile, source);
|
||||||
|
_makefile_print(makefile, ".o");
|
||||||
|
}
|
||||||
|
_makefile_print(makefile, "%s", " -c ");
|
||||||
|
_makefile_print_escape(makefile, source);
|
||||||
|
_makefile_print(makefile, ".%s\n", extension);
|
||||||
break;
|
break;
|
||||||
case OT_CXX_SOURCE:
|
case OT_CXX_SOURCE:
|
||||||
case OT_OBJCXX_SOURCE:
|
case OT_OBJCXX_SOURCE:
|
||||||
if(tt == TT_OBJECT)
|
if(tt == TT_OBJECT)
|
||||||
_makefile_print(makefile, "%s%s", "\n$(OBJDIR)",
|
{
|
||||||
target);
|
_makefile_print(makefile, "%s", "\n$(OBJDIR)");
|
||||||
|
_makefile_print_escape(makefile, target);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
_makefile_print(makefile, "%s%s%s", "\n$(OBJDIR)",
|
{
|
||||||
source, ".o");
|
_makefile_print(makefile, "%s", "\n$(OBJDIR)");
|
||||||
|
_makefile_print_escape(makefile, source);
|
||||||
|
_makefile_print(makefile, "%s", ".o");
|
||||||
|
}
|
||||||
_makefile_print(makefile, "%s%s%s%s", ": ", source, ".",
|
_makefile_print(makefile, "%s%s%s%s", ": ", source, ".",
|
||||||
extension);
|
extension);
|
||||||
source[len] = '.'; /* FIXME ugly */
|
source[len] = '.'; /* FIXME ugly */
|
||||||
_source_depends(makefile, source);
|
_source_depends(makefile, source);
|
||||||
p = _makefile_get_config(makefile, source, "cxxflags");
|
p = _makefile_get_config(makefile, source, "cxxflags");
|
||||||
source[len] = '\0';
|
source[len] = '\0';
|
||||||
_makefile_print(makefile, "%s", "\n\t");
|
_makefile_print(makefile, "\n\t");
|
||||||
if(strchr(source, '/') != NULL)
|
if(strchr(source, '/') != NULL)
|
||||||
ret = _source_subdir(makefile, source);
|
ret = _source_subdir(makefile, source);
|
||||||
if(tt == TT_LIBTOOL)
|
if(tt == TT_LIBTOOL)
|
||||||
_makefile_print(makefile, "%s",
|
_makefile_print(makefile, "%s",
|
||||||
"$(LIBTOOL) --mode=compile ");
|
"$(LIBTOOL) --mode=compile ");
|
||||||
_makefile_print(makefile, "%s%s%s", "$(CXX) $(", target,
|
_makefile_print(makefile, "%s", "$(CXX) $(");
|
||||||
"_CXXFLAGS)");
|
_makefile_print_escape(makefile, target);
|
||||||
|
_makefile_print(makefile, "%s", "_CXXFLAGS)");
|
||||||
if(p != NULL)
|
if(p != NULL)
|
||||||
_makefile_print(makefile, " %s", p);
|
_makefile_print(makefile, " %s", p);
|
||||||
if(tt == TT_OBJECT)
|
if(tt == TT_OBJECT)
|
||||||
_makefile_print(makefile, "%s%s", " -o $(OBJDIR)",
|
{
|
||||||
target);
|
_makefile_print(makefile, "%s", " -o $(OBJDIR)");
|
||||||
|
_makefile_print_escape(makefile, target);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
_makefile_print(makefile, "%s%s%s", " -o $(OBJDIR)",
|
{
|
||||||
source, ".o");
|
_makefile_print(makefile, "%s", " -o $(OBJDIR)");
|
||||||
_makefile_print(makefile, "%s%s%s%s\n", " -c ", source, ".",
|
_makefile_print_escape(makefile, source);
|
||||||
extension);
|
_makefile_print(makefile, ".o");
|
||||||
|
}
|
||||||
|
_makefile_print(makefile, "%s", " -c ");
|
||||||
|
_makefile_print_escape(makefile, source);
|
||||||
|
_makefile_print(makefile, ".%s\n", extension);
|
||||||
break;
|
break;
|
||||||
case OT_JAVA_SOURCE:
|
case OT_JAVA_SOURCE:
|
||||||
_makefile_print(makefile, "%s%s", "\n$(OBJDIR)",
|
_makefile_print(makefile, "%s%s", "\n$(OBJDIR)",
|
||||||
@ -2021,8 +2083,9 @@ static int _clean_targets(Makefile * makefile)
|
|||||||
{
|
{
|
||||||
if(cnt++ == 0)
|
if(cnt++ == 0)
|
||||||
_makefile_print(makefile, "%s", "\t$(RM) --");
|
_makefile_print(makefile, "%s", "\t$(RM) --");
|
||||||
_makefile_print(makefile, "%s%s%s", " $(", targets,
|
_makefile_print(makefile, "%s", " $(");
|
||||||
"_OBJS)");
|
_makefile_print_escape_variable(makefile, targets);
|
||||||
|
_makefile_print(makefile, "%s", "_OBJS)");
|
||||||
}
|
}
|
||||||
if(c == '\0')
|
if(c == '\0')
|
||||||
break;
|
break;
|
||||||
@ -2359,9 +2422,13 @@ static void _install_target_binary(Makefile * makefile, String const * target)
|
|||||||
if((path = _makefile_get_config(makefile, target, "install")) == NULL)
|
if((path = _makefile_get_config(makefile, target, "install")) == NULL)
|
||||||
return;
|
return;
|
||||||
_makefile_mkdir(makefile, path);
|
_makefile_mkdir(makefile, path);
|
||||||
_makefile_print(makefile, "%s%s%s%s/%s%s\n",
|
_makefile_print(makefile, "%s", "\t$(INSTALL) -m 0755 $(OBJDIR)");
|
||||||
"\t$(INSTALL) -m 0755 $(OBJDIR)", target,
|
_makefile_print_escape(makefile, target);
|
||||||
"$(EXEEXT) $(DESTDIR)", path, target, "$(EXEEXT)");
|
_makefile_print(makefile, "%s", "$(EXEEXT) $(DESTDIR)");
|
||||||
|
_makefile_print_escape(makefile, path);
|
||||||
|
_makefile_print(makefile, "/");
|
||||||
|
_makefile_print_escape(makefile, target);
|
||||||
|
_makefile_print(makefile, "%s\n", "$(EXEEXT)");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _install_target_library(Makefile * makefile, String const * target)
|
static int _install_target_library(Makefile * makefile, String const * target)
|
||||||
@ -2810,8 +2877,11 @@ static int _uninstall_target(Makefile * makefile,
|
|||||||
switch(tt)
|
switch(tt)
|
||||||
{
|
{
|
||||||
case TT_BINARY:
|
case TT_BINARY:
|
||||||
_makefile_print(makefile, "\t%s%s/%s%s\n", rm_destdir,
|
_makefile_print(makefile, "\t%s", rm_destdir);
|
||||||
path, target, "$(EXEEXT)");
|
_makefile_print_escape(makefile, path);
|
||||||
|
_makefile_print(makefile, "/");
|
||||||
|
_makefile_print_escape(makefile, target);
|
||||||
|
_makefile_print(makefile, "$(EXEEXT)\n");
|
||||||
break;
|
break;
|
||||||
case TT_COMMAND:
|
case TT_COMMAND:
|
||||||
_makefile_print(makefile, "\t%s%s/", rm_destdir, path);
|
_makefile_print(makefile, "\t%s%s/", rm_destdir, path);
|
||||||
@ -2829,8 +2899,11 @@ static int _uninstall_target(Makefile * makefile,
|
|||||||
target, ".la\n");
|
target, ".la\n");
|
||||||
break;
|
break;
|
||||||
case TT_OBJECT:
|
case TT_OBJECT:
|
||||||
_makefile_print(makefile, "\t%s%s/%s\n", rm_destdir,
|
_makefile_print(makefile, "\t%s", rm_destdir);
|
||||||
path, target);
|
_makefile_print_escape(makefile, path);
|
||||||
|
_makefile_print(makefile, "/");
|
||||||
|
_makefile_print_escape(makefile, target);
|
||||||
|
_makefile_print(makefile, "\n");
|
||||||
break;
|
break;
|
||||||
case TT_PLUGIN:
|
case TT_PLUGIN:
|
||||||
_makefile_print(makefile, "\t%s%s/%s%s\n", rm_destdir,
|
_makefile_print(makefile, "\t%s%s/%s%s\n", rm_destdir,
|
||||||
@ -3115,8 +3188,11 @@ static int _makefile_output_variable(Makefile * makefile, String const * name,
|
|||||||
static int _makefile_mkdir(Makefile * makefile, char const * directory)
|
static int _makefile_mkdir(Makefile * makefile, char const * directory)
|
||||||
{
|
{
|
||||||
/* FIXME keep track of the directories created */
|
/* FIXME keep track of the directories created */
|
||||||
return (_makefile_print(makefile, "%s%s\n", "\t$(MKDIR) $(DESTDIR)",
|
if(_makefile_print(makefile, "%s", "\t$(MKDIR) $(DESTDIR)") < 0
|
||||||
directory) >= 0) ? 0 : -1;
|
|| _makefile_print_escape(makefile, directory) < 0
|
||||||
|
|| _makefile_print(makefile, "\n") < 0)
|
||||||
|
return -1;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3155,6 +3231,27 @@ static int _makefile_print_escape(Makefile * makefile, char const * str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* makefile_print_escape_variable */
|
||||||
|
static int _makefile_print_escape_variable(Makefile * makefile,
|
||||||
|
char const * str)
|
||||||
|
{
|
||||||
|
char c;
|
||||||
|
|
||||||
|
if(str == NULL)
|
||||||
|
return -1;
|
||||||
|
if(makefile->fp == NULL)
|
||||||
|
return 0;
|
||||||
|
while((c = *(str++)) != '\0')
|
||||||
|
{
|
||||||
|
if(c == ' ' || c == '\t')
|
||||||
|
c = '_';
|
||||||
|
if(fputc(c, makefile->fp) == EOF)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* makefile_remove */
|
/* makefile_remove */
|
||||||
static int _makefile_remove(Makefile * makefile, int recursive, ...)
|
static int _makefile_remove(Makefile * makefile, int recursive, ...)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user