Propagate CFLAGS, CPPFLAG, and LDFLAGS, and simplify Makefiles#83
Open
olebole wants to merge 5 commits intoCaltech-IPAC:mainfrom
Open
Propagate CFLAGS, CPPFLAG, and LDFLAGS, and simplify Makefiles#83olebole wants to merge 5 commits intoCaltech-IPAC:mainfrom
olebole wants to merge 5 commits intoCaltech-IPAC:mainfrom
Conversation
1ca455e to
85e07d6
Compare
Split CFLAGS into CPPFLAGS (preprocessor definitions and include paths) CFLAGS (C standard, -fPIC), and allow to have them defined on command line. This moves possible optimization (-O2), debugging symbols (-g), and warnings (-Wall) into the responsibility of the caller, so that they can be adjusted globally.
This makes it possible to globally adjust f.e. hardening options for Debian builds.
and use a standard rule to build them.
bbee8a4 to
f100637
Compare
f100637 to
872af84
Compare
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.