Some changes that I think makes it better
This commit is contained in:
parent
98a7ba56c7
commit
c3fc72deb3
@ -35,18 +35,10 @@ void Compile(const char *src, const char *output_dir) {
|
||||
char *path = MakePath(src, output_dir);
|
||||
printf("[CC] Building %s -> %s\n", src, path);
|
||||
|
||||
size_t len = strlen(CC) + strlen(CFLAGS) + strlen(src) + strlen(path) + 7;
|
||||
char *arg = malloc(len + 1);
|
||||
if (arg == NULL) {
|
||||
free(path);
|
||||
fprintf(stderr, "builder: malloc failed");
|
||||
exit(1);
|
||||
if (fork()) {
|
||||
execlp(CC, CC, CFLAGS, src, "-o", path, NULL);
|
||||
}
|
||||
|
||||
snprintf(arg, len, "%s %s %s -o %s", CC, CFLAGS, src, path);
|
||||
system(arg);
|
||||
|
||||
free(arg);
|
||||
free(path);
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,6 @@ const char *libs[] = {
|
||||
"readline"
|
||||
};
|
||||
|
||||
#define CFLAGS "-Wall -Wextra -pedantic -Os -s -I ../libmu"
|
||||
#define CFLAGS "-Wall", "-Wextra", "-pedantic", "-Os", "-s", "-I", "../libmu"
|
||||
#define CC "cc"
|
||||
#endif
|
||||
|
@ -8,7 +8,8 @@ int main(const int argc, const char **argv) {
|
||||
putchar(' ');
|
||||
}
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/009604599/utilities/echo.html
|
||||
// This version does not support -n option and escape-sequences
|
||||
putchar('\n');
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user