aboutsummaryrefslogtreecommitdiffstats
path: root/mk/lang-c.mk
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--mk/lang-c.mk12
1 files changed, 10 insertions, 2 deletions
diff --git a/mk/lang-c.mk b/mk/lang-c.mk
index b8076d6..36d4496 100644
--- a/mk/lang-c.mk
+++ b/mk/lang-c.mk
@@ -60,11 +60,11 @@ endif
# BUILD VARIABLES:
# Optimisation settings for C code compilation.
+ifndef OPTIMISE
ifndef DEBUG
OPTIMISE = -O2 -g
endif
-ifndef DEBUG
-ifdef OPTIMISE
+ifdef DEBUG
ifdef __USING_GCC
OPTIMISE = -Og -g
endif
@@ -78,6 +78,7 @@ endif
ifdef _PEDANTIC
_PEDANTIC = -pedantic
endif
+ifndef WARN
ifndef DEBUG
WARN = -Wall
endif
@@ -99,6 +100,7 @@ ifndef __USING_GCC
WARN = -Wall -Wextra $(_PEDANTIC)
endif
endif
+endif
# Support for internationalisation?
ifndef WITHOUT_GETTEXT
@@ -112,9 +114,15 @@ _CPPFLAGS += $(foreach D,$(_ALL_DIRS),-D'$(D)="$($(D))"')
# MORE HELP VARIABLES:
# Compilation and linking flags, and command.
+ifndef CPPFLAGS
CPPFLAGS =
+endif
+ifndef CFLAGS
CFLAGS = $(OPTIMISE) $(WARN)
+endif
+ifndef LDFLAGS
LDFLAGS = $(OPTIMISE) $(WARN)
+endif
__CC = $(CC) -std=$(_C_STD) -c $(_CPPFLAGS) $(_CFLAGS)
__LD = $(CC) -std=$(_C_STD) $(_LDFLAGS)
__CC_POST = $(CPPFLAGS) $(CFLAGS) $(EXTRA_CPPFLAGS) $(EXTRA_CFLAGS)