Skip to content

Commit

Permalink
build: Cleanup build flags setup
Browse files Browse the repository at this point in the history
Move the compiler warnings together and remove unnecessary LDFLAGS per
file as the common flags are bound at the moment.

Signed-off-by: Namhyung Kim <[email protected]>
  • Loading branch information
namhyung committed Jun 9, 2023
1 parent a1dfa5b commit 1e2a3f3
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ export ARCH CC AR LD RM srcdir objdir LDFLAGS

COMMON_CFLAGS := -std=gnu11 -D_GNU_SOURCE $(CFLAGS) $(CPPFLAGS)
COMMON_CFLAGS += -iquote $(srcdir) -iquote $(objdir) -iquote $(srcdir)/arch/$(ARCH)
COMMON_CFLAGS += -Wdeclaration-after-statement
#CFLAGS-DEBUG = -g -D_GNU_SOURCE $(CFLAGS_$@)
COMMON_LDFLAGS := -ldl -pthread -Wl,-z,noexecstack $(LDFLAGS) $(LDFLAGS_$@)
COMMON_CFLAGS += -W -Wall -Wno-unused-parameter -Wno-missing-field-initializers
COMMON_CFLAGS += -Wdeclaration-after-statement -Wstrict-prototypes

COMMON_LDFLAGS := -ldl -pthread -Wl,-z,noexecstack $(LDFLAGS)
ifeq ($(ANDROID),)
COMMON_LDFLAGS += -lrt
else
Expand All @@ -72,11 +73,8 @@ ifneq ($(elfdir),)
COMMON_LDFLAGS += -L$(elfdir)/lib
endif

COMMON_CFLAGS += -W -Wall -Wno-unused-parameter -Wno-missing-field-initializers

C_STR_TARGET = utils/mermaid.js utils/mermaid.html
C_STR_EXTENSION = cstr

C_STR_OBJS := $(patsubst %,$(objdir)/%.$(C_STR_EXTENSION),$(C_STR_TARGET))

#
Expand Down Expand Up @@ -104,7 +102,7 @@ LIB_LDFLAGS = $(COMMON_LDFLAGS) $(LDFLAGS_$@) $(LDFLAGS_lib) -Wl,--no-und
TEST_LDFLAGS = $(COMMON_LDFLAGS) -L$(objdir)/libtraceevent -ltraceevent

ifeq ($(DEBUG), 1)
COMMON_CFLAGS += -O0 -g3 -DDEBUG_MODE=1 -Werror -Wstrict-prototypes
COMMON_CFLAGS += -O0 -g3 -DDEBUG_MODE=1 -Werror
else
COMMON_CFLAGS += -O2 -g -DDEBUG_MODE=0
endif
Expand Down

0 comments on commit 1e2a3f3

Please sign in to comment.