aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/cgcc
diff options
Diffstat (limited to 'cgcc')
-rw-r--r--cgcc22
1 files changed, 22 insertions, 0 deletions
diff --git a/cgcc b/cgcc
new file mode 100644
index 00000000..ec9e7ce7
--- /dev/null
+++ b/cgcc
@@ -0,0 +1,22 @@
+#!/usr/bin/perl -w
+# -----------------------------------------------------------------------------
+
+my $cc = $ENV{'REAL_CC'} || 'cc';
+my $check = $ENV{'CHECK'} || 'check';
+
+# Look for a .c file. We don't want to run the checker on .o or .so files
+# in the link run. (This simplistic check knows nothing about options
+# with arguments, but it seems to do the job.)
+my $seen_a_c_file = 0;
+foreach (@ARGV) {
+ if (/^[^-].*\.c/) {
+ $seen_a_c_file = 1;
+ last;
+ }
+}
+
+if ($seen_a_c_file) {
+ system ($check, @ARGV);
+}
+
+exec ($cc, @ARGV);