+# Regex for source files which require preprocessing.
+my $source_preprocess_compile_regex = qr/
+ # C
+ c
+ # Objective-C
+ | m
+ # C++
+ | cc | cp | cxx | cpp | CPP | c\+\+ | C
+ # Objective-C++
+ | mm | M
+ # Fortran
+ | F | FOR | fpp | FPP | FTN | F90 | F95 | F03 | F08
+ /x;
+my $source_preprocess_no_compile_regex = qr/
+ # Assembly
+ s
+ /x;
+my $source_preprocess_regex = qr/
+ $source_preprocess_compile_regex
+ | $source_preprocess_no_compile_regex
+ /x;
+# Regex for source files which don't require preprocessing.
+my $source_no_preprocess_compile_regex = qr/
+ # C
+ i
+ # C++
+ | ii
+ # Objective-C
+ | mi
+ # Objective-C++
+ | mii
+ # Fortran
+ | f | for | ftn | f90 | f95 | f03 | f08
+ /x;
+my $source_no_preprocess_no_compile_regex = qr/
+ # Assembly
+ S | sx
+ /x;
+my $source_no_preprocess_regex = qr/
+ $source_no_preprocess_compile_regex
+ | $source_no_preprocess_no_compile_regex
+ /x;
+# Regex for header files which require preprocessing.
+my $header_preprocess_regex = qr/
+ # C, C++, Objective-C, Objective-C++
+ h
+ # C++
+ | hh | H | hp | hxx | hpp | HPP | h\+\+ | tcc
+ /x;
+# Regexps to match files with the given characteristics.
+my $file_no_preprocess_regex = qr/
+ $cc_regex.+?
+ \.(?: $source_no_preprocess_regex)\b
+ /x;
+my $file_preprocess_regex = qr/
+ $cc_regex.+?
+ \.(?: $header_preprocess_regex
+ | $source_preprocess_regex)\b
+ /x;
+my $file_compile_link_regex = qr/
+ $cc_regex.+?
+ \.(?: $source_preprocess_regex
+ | $source_no_preprocess_regex)\b
+ /x;
+my $file_compile_regex = qr/
+ $cc_regex.+?
+ \.(?: $source_preprocess_compile_regex
+ | $source_no_preprocess_compile_regex)\b
+ /x;
+my $file_no_compile_regex = qr/
+ $cc_regex.+
+ \.(?: $source_preprocess_no_compile_regex
+ | $source_no_preprocess_no_compile_regex)\b
+ /x;
+