Preparing the libSystem migration (in the meantime configure is broken)

This commit is contained in:
Pierre Pronchery 2005-10-21 20:58:38 +00:00
parent a306b44c19
commit 3c6a584e16
2 changed files with 12 additions and 13 deletions

View File

@ -2,10 +2,9 @@
#include <System.h>
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include <libutils/libutils.h>
/* configure */ /* configure */
@ -99,8 +98,8 @@ static int _makefile_subdirs(Config * config)
static int _subdir_configure(char const * subdir) static int _subdir_configure(char const * subdir)
{ {
if(strstr(subdir, "/") == NULL && strcmp(subdir, ".") if(string_find(subdir, "/") == NULL && string_compare(subdir, ".")
&& strcmp(subdir, "..")) && string_compare(subdir, ".."))
{ {
if(_configure(subdir) != 2) if(_configure(subdir) != 2)
chdir(".."); chdir("..");
@ -179,7 +178,7 @@ static void _target_print(FILE * fp, Config * config, char * target)
char * p; char * p;
if((p = config_get(config, target, "type")) != NULL if((p = config_get(config, target, "type")) != NULL
&& strcmp(p, "library") == 0) && string_compare(p, "library") == 0)
fprintf(fp, " %s.a %s.so", target, target); fprintf(fp, " %s.a %s.so", target, target);
else else
fprintf(fp, " %s", target); fprintf(fp, " %s", target);
@ -308,14 +307,14 @@ static void _obj_print(FILE * fp, char * obj)
{ {
int len; int len;
for(len = strlen(obj) - 1; len >= 0 && obj[len] != '.'; len--); for(len = string_length(obj) - 1; len >= 0 && obj[len] != '.'; len--);
if(strcmp(&obj[len+1], "c") == 0) if(string_compare(&obj[len+1], "c") == 0)
{ {
obj[len+1] = 'o'; obj[len+1] = 'o';
fprintf(fp, "%s", obj); fprintf(fp, "%s", obj);
obj[len+1] = 'c'; obj[len+1] = 'c';
} }
else if(strcmp(&obj[len+1], "S") == 0) else if(string_compare(&obj[len+1], "S") == 0)
{ {
obj[len+1] = 'o'; obj[len+1] = 'o';
fprintf(fp, "%s", obj); fprintf(fp, "%s", obj);
@ -337,7 +336,7 @@ static void _target_link(FILE * fp, Config * config, char * target)
": Empty type\n"); ": Empty type\n");
return; return;
} }
if(strcmp("binary", type) == 0) if(string_compare("binary", type) == 0)
{ {
fprintf(fp, "%s%s%s%s%s", target, ": $(", target, fprintf(fp, "%s%s%s%s%s", target, ": $(", target,
"_OBJS)\n", "\t$(CC) $(LDFLAGSF) $(LDFLAGS) "); "_OBJS)\n", "\t$(CC) $(LDFLAGSF) $(LDFLAGS) ");
@ -346,7 +345,7 @@ static void _target_link(FILE * fp, Config * config, char * target)
fprintf(fp, "%s%s%s%s%s", "-o ", target, fprintf(fp, "%s%s%s%s%s", "-o ", target,
" $(", target, "_OBJS)\n\n"); " $(", target, "_OBJS)\n\n");
} }
else if(strcmp("library", type) == 0) else if(string_compare("library", type) == 0)
fprintf(fp, "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", fprintf(fp, "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
target, ".a: $(", target, "_OBJS)\n\t$(AR) ", target, ".a: $(", target, "_OBJS)\n\t$(AR) ",
target, ".a $(", target, "_OBJS)\n\t$(RANLIB) ", target, ".a $(", target, "_OBJS)\n\t$(RANLIB) ",
@ -386,9 +385,9 @@ static void _handler_print(FILE * fp, char * target, char * source)
_obj_print(fp, source); _obj_print(fp, source);
fprintf(fp, "%s%s%s%s%s%s%s", ": ", source, "\n\t$(CC) $(", target, fprintf(fp, "%s%s%s%s%s%s%s", ": ", source, "\n\t$(CC) $(", target,
"_CFLAGS)", " -c ", source); "_CFLAGS)", " -c ", source);
if(strstr(source, "/") != NULL) if(string_find(source, "/") != NULL)
{ {
len = strlen(source); len = string_length(source);
source[len-1] = 'o'; source[len-1] = 'o';
fprintf(fp, "%s%s", " -o ", source); fprintf(fp, "%s%s", " -o ", source);
source[len-1] = 'c'; source[len-1] = 'c';

View File

@ -1,7 +1,7 @@
targets=configure targets=configure
cflags_force=-W -Wall -ansi cflags_force=-W -Wall -ansi
cflags=-g cflags=-g
ldflags_force=-lutils ldflags_force=-lSystem
[configure] [configure]
type=binary type=binary