]> git.refcnt.org Git - colorize.git/commitdiff
Include all flags in version output
authorSteven Schubiger <stsc@refcnt.org>
Sat, 4 Mar 2017 21:02:47 +0000 (22:02 +0100)
committerSteven Schubiger <stsc@refcnt.org>
Sat, 4 Mar 2017 21:02:47 +0000 (22:02 +0100)
Makefile
colorize.c

index 17031ba11962618738966fc488473ff6d6427287..868ec4c049f91e0a5b8d9778c26cbfad593ac428 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,9 @@ FLAGS= # command-line macro
 
 colorize:      colorize.c
                        perl ./version.pl > version.h
-                       $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o colorize colorize.c -DCFLAGS="$(CFLAGS)" -DHAVE_VERSION $(FLAGS)
+                       $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o colorize colorize.c \
+  -DCPPFLAGS="\"$(CPPFLAGS)\"" -DCFLAGS="\"$(CFLAGS)\"" -DLDFLAGS="\"$(LDFLAGS)\"" \
+  -DHAVE_VERSION $(FLAGS)
 
 check:
                        perl ./test.pl --regular
index 06f448b15e8b7f20734c134d6e3ede2e077ff7cb..7faeb8008392459b9d32381445212854d2b2a2fa 100644 (file)
@@ -473,7 +473,7 @@ print_version (void)
     const char *version = NULL;
 #endif
     const char *version_prefix, *version_string;
-    const char *c_flags;
+    const char *c_flags, *ld_flags, *cpp_flags;
     struct bytes_size bytes_size;
     bool debug;
 #ifdef CFLAGS
@@ -481,6 +481,16 @@ print_version (void)
 #else
     c_flags = "unknown";
 #endif
+#ifdef LDFLAGS
+    ld_flags = to_str (LDFLAGS);
+#else
+    ld_flags = "unknown";
+#endif
+#ifdef CPPFLAGS
+    cpp_flags = to_str (CPPFLAGS);
+#else
+    cpp_flags = "unknown";
+#endif
 #if DEBUG
     debug = true;
 #else
@@ -491,6 +501,8 @@ print_version (void)
     printf ("colorize %s%s (compiled at %s, %s)\n", version_prefix, version_string, __DATE__, __TIME__);
 
     printf ("Compiler flags: %s\n", c_flags);
+    printf ("Linker flags: %s\n", ld_flags);
+    printf ("Preprocessor flags: %s\n", cpp_flags);
     if (get_bytes_size (BUF_SIZE, &bytes_size))
       {
         if (BUF_SIZE % 1024 == 0)