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

Make tup's build more configurable #325

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

kalrish
Copy link
Contributor

@kalrish kalrish commented Aug 1, 2017

The goal of this pull request is to make it easier to change the flags with which tup itself is built. Previously, doing that required tweaking the Tupfiles themselves; with these commits, a level of configurability is supported via tup.config, which the user can provide. This way is better not only because it separates the what to build from the how to do it, but also because Kconfig syntax poses a lower entry level for those wanting to build tup but unfamiliar with it (i.e. packagers).

Being able to change build flags is desirable for several reasons. It's also required when targetting various platforms, and it frees us from the burden of providing the right flags for every situation.

In case no configuration is specified, the previous flags are used. I have tested building with no configuration on Windows, and it works.

To help users and contributors, a couple config templates are supplied.

Kalrish Bäakjen added 5 commits August 1, 2017 15:32
If CONFIG_CFLAGS is specified in tup.config, then its value is used as
our CFLAGS. Otherwise, we provide sensible defaults. Flags which are
needed in any case, such as include paths, are added unconditionally.
This template should be a good starting point for those wanting to
develop tup. Many diagnostics are enabled, warnings are considered
errors, debug information is included and an optimization level which
doesn't interfere with debugging is specified.
This template should be a good starting point for those wanting to get a
release build of tup. Basic diagnostics are enabled to help catch
errors, but the compiler shouldn't otherwise be very strict with these
settings. An intermediate optimization level is set.
Like gcc-dev.config, this template should be useful to those wanting to
develop tup. The difference in this one is the use of LTO, which can
help uncover errors in the code. At least here, tup did not build with
these settings; presumably, there's something to fix, and this template
is a step in that direction.
else
AR = ar
endif

CFLAGS += -W
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should put the CFLAGS -W through -fno-common into the group with -I$(TUP_CWD)/src, so that they are always included. IMO these are important warnings that should be included in all profiles.

Since these flags would be before the 'ifdef CFLAGS' line, it is still possible for a user to override certain flags with their tup.config. For example, they could set CONFIG_CFLAGS to -Wno-switch-enum if they wanted to override the default -Wswitch-enum flag.

The 'else' block of the 'ifdef CFLAGS' can just be -O2 for the default optimization, since this is the most common thing that you are changing in the configs/*.config files.

This would also make gcc-dev.config and gcc-dev-lto.config much smaller.

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.

2 participants