do NOT use #if for target platform decisions
authorMatthias Braun <matthias.braun@kit.edu>
Wed, 4 Jul 2012 09:11:18 +0000 (11:11 +0200)
committerMatthias Braun <matthias.braun@kit.edu>
Wed, 4 Jul 2012 12:46:51 +0000 (14:46 +0200)
(or we will end up like gcc where you have to compile each host/target
 combination again, instead of having 1 compiler which can produce
 everything)

main.c

diff --git a/main.c b/main.c
index 7269c88..872f484 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1200,13 +1200,11 @@ int main(int argc, char **argv)
                                GET_ARG_AFTER(opt, "-isystem");
                                add_flag(&cppflags_obst, "-isystem");
                                add_flag(&cppflags_obst, "%s", opt);
-#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__CYGWIN__)
                        } else if (streq(option, "pthread")) {
                                /* set flags for the preprocessor */
                                add_flag(&cppflags_obst, "-D_REENTRANT");
                                /* set flags for the linker */
                                add_flag(&ldflags_obst, "-lpthread");
-#endif
                        } else if (streq(option, "nostdinc")
                                        || streq(option, "trigraphs")) {
                                /* pass these through to the preprocessor */
@@ -1727,11 +1725,11 @@ int main(int argc, char **argv)
                        outname = outnamebuf;
                        break;
                case CompileAssembleLink:
-#ifdef _WIN32
-                       outname = "a.exe";
-#else
-                       outname = "a.out";
-#endif
+                       if (firm_is_windows_os(target_machine)) {
+                               outname = "a.exe";
+                       } else {
+                               outname = "a.out";
+                       }
                        break;
                }
        }