In order to pass additional compiler flags while still keeping the required flags intact (-pthread for example), we add a local set of flags on top of the exsiting CFLAGS.
2019-01-11 Luis Machado luis.machado@linaro.org
* Test.mk (CFLAGS): Set to "-g -Wall" (FLAGS): New variable. Set to -pthread. Document variables. ($(EXEC): Use FLAGS.
Signed-off-by: Luis Machado luis.machado@linaro.org --- Test.mk | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/Test.mk b/Test.mk index 3c12a9e..86e59ab 100644 --- a/Test.mk +++ b/Test.mk @@ -24,7 +24,14 @@ SNT=$(wildcard *sanity.sh) TST=$(sort $(wildcard *[!{sanity}].sh)) LOG=$(TST:.sh=.log) -CFLAGS?=-g -Wall -pthread + +# Default flags passed to the compiler. +CFLAGS?=-g -Wall + +# Required compiler flags to build the utils. +FLAGS?=-pthread + +# Default compiler to build the utils. CC?=gcc
# All utils' source files. @@ -58,7 +65,7 @@ endif
# Target for building all the utils we need, from sources. $(EXEC): $(SRC) - $(CC) $(CFLAGS) $@.c -o $@ + $(CC) $(CFLAGS) $(FLAGS) $@.c -o $@
clean: rm -f *.o $(EXEC)