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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 14 additions & 19 deletions Tuprules.tup
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,13 @@ else
CC = gcc
endif

ifeq (@(TUP_DEBUG),y)
CFLAGS += -g
else
CFLAGS += -Os
endif

ifdef AR
AR = @(AR)
CFLAGS += -D_FILE_OFFSET_BITS=64
CFLAGS += -I$(TUP_CWD)/src
ifdef CFLAGS
CFLAGS += @(CFLAGS)
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.

CFLAGS += -Wall
ifeq (@(TUP_WERROR),y)
CFLAGS += -Werror
endif
CFLAGS += -Wbad-function-cast
CFLAGS += -Wcast-align
CFLAGS += -Wcast-qual
Expand All @@ -42,12 +32,17 @@ CFLAGS += -Wstrict-prototypes
CFLAGS += -Wwrite-strings
CFLAGS += -Wswitch-enum
CFLAGS += -fno-common
CFLAGS += -D_FILE_OFFSET_BITS=64
CFLAGS += -I$(TUP_CWD)/src
CFLAGS += -O2
endif

ifdef LDFLAGS
LDFLAGS += @(LDFLAGS)
endif

ifeq (@(TUP_32_BIT),y)
CFLAGS += -m32
LDFLAGS += -m32
ifdef AR
AR = @(AR)
else
AR = ar
endif

export PKG_CONFIG_PATH
Expand Down
3 changes: 3 additions & 0 deletions configs/gcc-dev-lto.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CONFIG_CFLAGS=-W -Wall -Wextra -Wbad-function-cast -Wcast-align -Wcast-qual -Wchar-subscripts -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings -Wswitch-enum -Werror -flto -fno-common -g -Og
CONFIG_AR=gcc-ar
CONFIG_LDFLAGS=-flto -fuse-linker-plugin
1 change: 1 addition & 0 deletions configs/gcc-dev.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_CFLAGS=-W -Wall -Wextra -Wbad-function-cast -Wcast-align -Wcast-qual -Wchar-subscripts -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings -Wswitch-enum -Werror -fno-common -g -Og
1 change: 1 addition & 0 deletions configs/gcc-release.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_CFLAGS=-Wall -fno-common -O2