PR modula2/126847: Fix make install to avoid rebuilding cc1gm2
Build rules updated to prevent unnecessary recompilation of the Modula-2 compiler.
This commit addresses a build issue in the Modula-2 compiler (cc1gm2) where make install could trigger unnecessary recompilation of generated sources. The build rules have been rewritten to use order-only dependencies for generated files. This ensures that if header files change, the compiler is rebuilt, but simply rebuilding headers does not cause the generated sources themselves to be regenerated unnecessarily. This resolves PR126847.
In Details
This patch revises build rules in gcc/m2/Make-lang.in to address PR modula2/126847. The issue was that make install could incorrectly trigger recompilation of the Modula-2 compiler frontend (cc1gm2) and its associated libraries when only header files (like command-line option headers) were rebuilt. The fix introduces order-only dependencies for generated sources and objects within the Modula-2 build process. This ensures that the generated files are only rebuilt when their direct prerequisites change, not merely because related headers are updated, preventing redundant build steps.
- cc1gm2
- The Modula-2 compiler frontend for GCC, responsible for parsing and initial compilation stages of Modula-2 code.
- make install
- A standard command in build systems that installs the compiled software to its target location on the system.
- order-only dependency
- A build system dependency where a target depends on another target's existence or timestamp but does not trigger a rebuild of the dependent target if the prerequisite changes, only if the dependent target itself needs to be built from scratch.
- generated sources
- Source code files that are automatically created by a program or script during the build process, rather than being written manually by a developer.
- PR126847
- Bug report number 126847 in the GCC bug tracking system, related to the Modula-2 compiler build process.