Propagate CFLAGS, CPPFLAG, and LDFLAGS, and simplify Makefiles #83
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When packaging Montage for Debian, we want to use specific compilation flags for all source files, to control optimization and debug symbols, but also enable security hardening of the executables and libraries. This is done by setting
CFLAGS,CPPFLAGSandLDFLAGSin the environment before the build is started.This requires that these flags are recognized throughout the Makefiles: Not overwritten but appended with the specific flags in a directory. This PR splits the original
CFLAGSin each repository intoCPPFLAGS(for the preprocessor) andCFLAGSand assignment by an appending of local flags. Each linking step now getsLDFLAGSadded.Also the
CCvariable is no longer set by default, allowing to set it from the command line (f.e. specific gcc compiler versions, or to use clang instead). This variable was anyway not consequently set; sometimes cc, sometimes gccWe also take the opportunity to clean up the Makefiles a bit, by removing rules (specifically
.c.o:that are default, and to harmonize the linking step by consequently listing all objects as prequisites and use the same rule ($(CC) $(LDFLAGS) -o $@ $^ $(LIBS)) to link the executables.@JohnGood could I ask you to review and (if satisfactory) merge? I'd happily adjust the PR if you have other/further requirements or comments. Having this patch applied would greatly simplify the packaging for Debian, but probably also for Fedora and other Linux distributions.