LocaleRules: Pass the files to the preprocessor instead of piping it in.

This rule process the entire target's source files at once, and so
whoever wrote this rule in the first place (PulkoMandy?) probably
assumed without even testing that "cc -E" would create multiple
outputs for multiple inputs.

It doesn't, though: it just outputs them in sequence on the command line
the same way it does when the files are piped in through "cat". This
also has other advantages (e.g. preprocess errors caused by the compiler
assuming it was C not C++ code and so not defining __cplusplus, local
includes are now resolved properly, etc.)

Doing it this way does exposes other problems like the one fixed in the
previous commit (headers with no context defined, which worked previously
only because they used the context of the preceding `cat`'ed file.)

We now also remove the .pre file after collecting the catkeys.
This commit is contained in:
Augustin Cavalier 2018-08-13 17:00:16 -04:00
parent d284f7cc43
commit 4c13d20c24

View File

@ -73,10 +73,10 @@ rule ExtractCatalogEntries target : sources : signature : regexp
actions ExtractCatalogEntries1
{
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
cat "$(2[2-])" \
| $(CC) -E $(CCDEFS) -DB_COLLECTING_CATKEYS $(HDRS) - > "$(1)".pre
$(CC) -E $(CCDEFS) -DB_COLLECTING_CATKEYS $(HDRS) "$(2[2-])" > "$(1)".pre
$(2[1]) $(HAIKU_CATALOG_REGEXP) -s $(HAIKU_CATALOG_SIGNATURE) \
-w -o "$(1)" "$(1)".pre
$(RM) "$(1)".pre
}
rule LinkApplicationCatalog target : sources : signature : language