aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSlendi <slendi@socopon.com>2024-01-13 20:22:19 +0200
committerSlendi <slendi@socopon.com>2024-01-13 20:22:19 +0200
commit4f37633315177d340cd7876df6c812377a178504 (patch)
treee5f8416194dda40d89decded60129250c1367706
parentd96541da73c46fce85cacf371e76ac3871b35836 (diff)
Remove binary and remove debug
Signed-off-by: Slendi <slendi@socopon.com>
-rw-r--r--cbuild_impl.c14
-rwxr-xr-xtest_project/buildbin37136 -> 0 bytes
-rwxr-xr-xtest_project/build.c5
-rw-r--r--test_project/src/coompiler.c2
4 files changed, 13 insertions, 8 deletions
diff --git a/cbuild_impl.c b/cbuild_impl.c
index fdf7947..99fd050 100644
--- a/cbuild_impl.c
+++ b/cbuild_impl.c
@@ -54,7 +54,6 @@ executable_t create_executable(char *name, char *sources) {
for (size_t off = 0; exe.header.sources[off];
off += strlen(exe.header.sources + off) + 1) {
char *path = exe.header.sources + off;
- printf("Checking %s\n", path);
if (!file_exists(path, NULL)) {
fprintf(stderr, "File `%s` does not exist\n", path);
exit(1);
@@ -71,10 +70,11 @@ project_t create_project_ex(char *name, char *version, char *description,
char *author, char *license, char *url,
language_t language) {
project_t project = {
- .compiler = language == LANG_C ? (getenv("CC") ? getenv("CC") : "cc")
- : (getenv("CXX") ? getenv("CXX") : "c++"),
- .linker =
- getenv("LD") ? getenv("LD") : (language == LANG_C ? "cc" : "c++"),
+ .compiler = language == LANG_C
+ ? (getenv("CC") != NULL ? getenv("CC") : "cc")
+ : (getenv("CXX") != NULL ? getenv("CXX") : "c++"),
+ .linker = getenv("LD") != NULL ? getenv("LD")
+ : (language == LANG_C ? "cc" : "c++"),
.name = name,
.version = version,
.description = description,
@@ -97,6 +97,10 @@ void add_target(project_t *project, void *target) {
void build(project_t build) {
fprintf(stderr, "Building project: %s\n", build.name);
fprintf(stderr, "Version: %s\n", build.version);
+ if (build.compiler)
+ fprintf(stderr, "Compiler: %s\n", build.compiler);
+ if (build.linker)
+ fprintf(stderr, "Linker: %s\n", build.linker);
if (build.description)
fprintf(stderr, "Description: %s\n", build.description);
if (build.author)
diff --git a/test_project/build b/test_project/build
deleted file mode 100755
index 0c7d54d..0000000
--- a/test_project/build
+++ /dev/null
Binary files differ
diff --git a/test_project/build.c b/test_project/build.c
index af1de08..0a8433e 100755
--- a/test_project/build.c
+++ b/test_project/build.c
@@ -1,7 +1,6 @@
#if 0
-gcc -O0 -ggdb -o build build.c
-./build $@
-#tcc - run build.c $ @
+cc -O0 -ggdb -o /tmp/build build.c
+/tmp/build $@
exit
#endif
diff --git a/test_project/src/coompiler.c b/test_project/src/coompiler.c
index c1e3b0b..73d1665 100644
--- a/test_project/src/coompiler.c
+++ b/test_project/src/coompiler.c
@@ -7,5 +7,7 @@ char const *compiler(void) {
return "CLANG compiler";
#elif __MSVC__
return "MSVC compiler";
+#else
+ return "Unknown compiler";
#endif
}