1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-29 11:41:15 +03:00

build: Makefile: cleanup CFLAGS

CFLAGS are reserved for external interaction via make variable, the
following should work:

$ make CFLAGS="-O3"
$ CFLAGS="-O3" make

1. Move internal flags to LOCAL_CFLAGS
2. Respect external CFLAGS
3. CFLAGS should be last compiler flags.
4. Default CFLAGS is -O optimization, remove OFLAGS.
5. Add WARNING_CFLAGS to control warning setting and enable to remove
   if compiler does not support flags.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
This commit is contained in:
Alon Bar-Lev
2015-02-18 17:55:05 +02:00
committed by Manuel Pégourié-Gonnard
parent ada4105ba2
commit f7a9f30348
3 changed files with 121 additions and 117 deletions

View File

@ -1,13 +1,15 @@
# Also see "include/polarssl/config.h"
CFLAGS += -I../include -D_FILE_OFFSET_BITS=64 -Wall -W -Wdeclaration-after-statement
OFLAGS = -O2
CFLAGS ?= -O2
WARNING_CFLAGS ?= -Wall -W -Wdeclaration-after-statement
LDFLAGS ?=
LOCAL_CFLAGS = $(WARNING_CFLAGS) -I../include -D_FILE_OFFSET_BITS=64
LOCAL_LDFLAGS =
ifdef DEBUG
CFLAGS += -g3
LOCAL_CFLAGS += -g3
endif
# MicroBlaze specific options:
@ -25,7 +27,7 @@ endif
ifdef SHARED
# all code is position-indep with mingw, avoid warning about useless flag
ifndef WINDOWS_BUILD
LOCAL_CFLAGS += -fPIC
LOCAL_CFLAGS += -fPIC -fpic
endif
endif
@ -128,7 +130,7 @@ libmbedtls.dll: $(OBJS)
.c.o:
echo " CC $<"
$(CC) $(CFLAGS) $(OFLAGS) -c $<
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) -c $<
clean:
ifndef WINDOWS