Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework some makefile bits to make overriding some options simpler. #140

Merged
merged 3 commits into from
Oct 11, 2019

Conversation

vathpela
Copy link
Contributor

@vathpela vathpela commented Oct 10, 2019

This reworks a lot of defaults.mk to make some variables more regularly
partially overridden on the command line, making e.g. suppression of
-Werror easier when warranted. It also makes having per-compiler
versions of each thing simpler.

The following variables can be overridden, though in some cases only
partially:

name kind of things in it
COMPILER gcc
CROSS_COMPILE arm-linux-gnu-
CC $(CROSS_COMPILE)$(COMPILER)
DEBUGINFO -g
OPTIMIZE -O2 -flto
WARNINGS -Wfoo -Wno-bar
ERRORS -Werror -Wno-error=cpp
CPPFLAGS -D and -I
CFLAGS $(OPTIMIZE) $(DEBUGINFO) $(WARNINGS) $(ERRORS)
LDFLAGS linker options (add-only)
CCLDFLAGS -Wl, prefixed linker options (add-only, normally machine generated from LDFLAGS)
HOSTCC $(COMPILER)
HOST_CPPFLAGS $(CPPFLAGS) (add-only)
HOST_CFLAGS $(CFLAGS) (add-only)
HOST_CCLDFLAGS $(CCLDFLAGS) (add-only)

So if you want, say, no -Werror flags, you can simply do:
make ERRORS=

This resolves issue #31

No sense in leaving all this cluttering up what's usually my working
directory...

Signed-off-by: Peter Jones <pjones@redhat.com>
This reworks a lot of defaults.mk to make some variables more regularly
partially overridden on the command line, making e.g. suppression of
-Werror easier when warranted.  It also makes having per-compiler
versions of each thing simpler.

The following variables can be overridden, though in some cases only
partially:

name			kind of things in it
COMPILER		gcc
CROSS_COMPILE		arm-linux-gnu-
CC			$(CROSS_COMPILE)$(COMPILER)
DEBUGINFO		-g
OPTIMIZE		-O2 -flto
WARNINGS		-Wfoo -Wno-bar
ERRORS			-Werror -Wno-error=cpp
CPPFLAGS		-D and -I
CFLAGS			$(OPTIMIZE) $(DEBUGINFO) $(WARNINGS) $(ERRORS)
LDFLAGS			linker options (add-only)
CCLDFLAGS		-Wl, prefixed linker options (add-only and it's
			normally machine generated from LDFLAGS
HOSTCC			$(COMPILER)
HOST_CPPFLAGS		$(CPPFLAGS) (add-only)
HOST_CFLAGS		$(CFLAGS) (add-only)
HOST_CCLDFLAGS		$(CCLDFLAGS) (add-only)

This resolves issue rhboot#31

Signed-off-by: Peter Jones <pjones@redhat.com>
@vathpela vathpela merged commit 998f617 into rhboot:master Oct 11, 2019
@vathpela vathpela deleted the hostcc branch October 11, 2019 20:26
@vathpela vathpela mentioned this pull request Oct 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant