summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog14
-rw-r--r--Makefile5
-rwxr-xr-xconfigure13
3 files changed, 27 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index b3ab1898..00c9ba96 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2015-08-03 Christopher Meng <i@cicku.me>
+
+ Custom linker flags support.
+
+ * Makefile (PLATFORM_FLAGS): Rename to PLATFORM_CFLAGS.
+ (LDFLAGS): New variable. Includes -lm and PLATFORM_CFLAGS.
+ (LINK_PROG): Use $(LDFLAGS) instead of -lm.
+
+ * configure (platform_flags): Renamed to platform_cflags.
+ (platform_ldflags): New variable.
+ (gen_config_make): Rename PLATFORM_CFLAGS and generate
+ PLATFORM_LDFLAGS.
+ Usage help text updated.
+
2015-08-03 Kaz Kylheku <kaz@kylheku.com>
Switching some globals to lexical and changing some names.
diff --git a/Makefile b/Makefile
index 2de239f1..e20fabd6 100644
--- a/Makefile
+++ b/Makefile
@@ -28,9 +28,10 @@
VERBOSE :=
CFLAGS := -iquote $(conf_dir) $(if $(top_srcdir),-iquote $(top_srcdir)) \
$(LANG_FLAGS) $(DIAG_FLAGS) \
- $(DBG_FLAGS) $(PLATFORM_FLAGS) $(EXTRA_FLAGS)
+ $(DBG_FLAGS) $(PLATFORM_CFLAGS) $(EXTRA_FLAGS)
CFLAGS += -iquote $(top_srcdir)mpi
CFLAGS := $(filter-out $(REMOVE_FLAGS),$(CFLAGS))
+LDFLAGS := -lm $(PLATFORM_LDFLAGS)
ifneq ($(subst g++,@,$(notdir $(CC))),$(notdir $(CC)))
CFLAGS := $(filter-out -Wmissing-prototypes -Wstrict-prototypes,$(CFLAGS))
@@ -105,7 +106,7 @@ endef
define LINK_PROG
$(call ABBREV,LINK)
-$(V)$(CC) $(1) $(CFLAGS) -o $@ $^ -lm
+$(V)$(CC) $(1) $(CFLAGS) -o $@ $^ $(LDFLAGS)
endef
define WINDRES
diff --git a/configure b/configure
index 1420f1a3..507feec3 100755
--- a/configure
+++ b/configure
@@ -101,9 +101,10 @@ diag_flags='-Wall -Werror=implicit-function-declaration -Werror=missing-prototyp
debug_flags=-g
debug_also=
inline=
-platform_flags=
+platform_cflags=
remove_flags=
lex_dbg_flags=
+platform_ldflags=
txr_dbg_opts=--gc-debug
valgrind=
lit_align=
@@ -364,11 +365,16 @@ debug-also [$debug_also]
of object files compiled with different optimization flags,
and produce two binaries: txr and txr-dbg.
-platform-flags [$platform_flags]
+platform-cflags [$platform_cflags]
Specify additional compiler flags for anything else, such as CPU tuning,
target ABI selection, code generation options, et cetera.
+platform-ldflags [$platform_ldflags]
+
+ Specify additional linker flags for anything else, such as hardening,
+ linking as needed, et cetera.
+
remove-flags [$remove_flags]
This is a negative otpion. Any flags mentioned in this variable
@@ -659,7 +665,8 @@ BUILD_TARGETS := $(if [ $debug_also ] ; then
echo '$(PROG) $(PROG)-dbg'
else
echo '$(PROG)'; fi)
-PLATFORM_FLAGS := $platform_flags
+PLATFORM_CFLAGS := $platform_cflags
+PLATFORM_LDFLAGS := $platform_ldflags
REMOVE_FLAGS := $remove_flags
LEX_DBG_FLAGS := $lex_dbg_flags
TXR_DBG_OPTS := $txr_dbg_opts