build: Apply OPT_FLAGS after platform Makefile.inc include

This allows the platform to specify another optimization level than
the default (like -Os if space is limited)

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
Sylvain Munaut 2019-08-05 15:29:00 +02:00
parent ef372d0161
commit 804ec24df9
1 changed files with 5 additions and 4 deletions

View File

@ -8,12 +8,9 @@ MAKEFLAGS += --no-print-dir
Q := @ Q := @
endif endif
OPT_FLAGS ?= -O2
CFLAGS += -Wall -Wextra -Werror -Wno-char-subscripts -Wno-cast-function-type \ CFLAGS += -Wall -Wextra -Werror -Wno-char-subscripts -Wno-cast-function-type \
$(OPT_FLAGS) -std=gnu99 -g3 -MD \ -std=gnu99 -g3 -MD \
-I. -Iinclude -Iplatforms/common -I$(PLATFORM_DIR) -I. -Iinclude -Iplatforms/common -I$(PLATFORM_DIR)
LDFLAGS += $(OPT_FLAGS)
ifeq ($(ENABLE_DEBUG), 1) ifeq ($(ENABLE_DEBUG), 1)
CFLAGS += -DENABLE_DEBUG CFLAGS += -DENABLE_DEBUG
@ -60,6 +57,10 @@ SRC = \
include $(PLATFORM_DIR)/Makefile.inc include $(PLATFORM_DIR)/Makefile.inc
OPT_FLAGS ?= -O2
CFLAGS += $(OPT_FLAGS)
LDFLAGS += $(OPT_FLAGS)
ifndef TARGET ifndef TARGET
TARGET=blackmagic TARGET=blackmagic
endif endif