From: Sergio Durigan Junior <sergiodj@sergiodj.net>
Date: Sun, 12 Jun 2016 14:01:52 -0400
Subject: Use LDFLAGS when linking

---
 makefile_aixILP32_utf8_gcc            | 2 +-
 makefile_aixLP64_utf8_gcc             | 2 +-
 makefile_aixLP64_utf8_xlc             | 2 +-
 makefile_aix_utf8_gcc                 | 2 +-
 makefile_aix_utf8_xlc                 | 2 +-
 makefile_amal_darwin_utf8_ffi         | 2 +-
 makefile_bsd                          | 4 ++--
 makefile_bsdLP64                      | 4 ++--
 makefile_bsdLP64_utf8                 | 4 ++--
 makefile_bsdLP64_utf8_ffi             | 4 ++--
 makefile_bsdLP64_utf8_lib             | 2 +-
 makefile_bsd_lib                      | 2 +-
 makefile_bsd_utf8                     | 4 ++--
 makefile_bsd_utf8_ffi                 | 4 ++--
 makefile_bsd_utf8_lib                 | 2 +-
 makefile_cygwin                       | 4 ++--
 makefile_cygwinLP64                   | 4 ++--
 makefile_darwin                       | 2 +-
 makefile_darwinLP64                   | 2 +-
 makefile_darwinLP64_utf8              | 2 +-
 makefile_darwinLP64_utf8_ffi          | 2 +-
 makefile_darwinLP64_utf8_lib          | 2 +-
 makefile_darwin_universal_utf8_compat | 2 +-
 makefile_darwin_utf8                  | 2 +-
 makefile_darwin_utf8_ffi              | 2 +-
 makefile_darwin_utf8_leopardIntel     | 2 +-
 makefile_darwin_utf8_leopardIntel_ffi | 2 +-
 makefile_darwin_utf8_leopardPPC       | 2 +-
 makefile_darwin_utf8_leopardPPC_ffi   | 2 +-
 makefile_darwin_utf8_lib              | 2 +-
 makefile_emscripten_lib_utf8          | 2 +-
 makefile_linux                        | 6 +++---
 makefile_linuxLP64                    | 8 ++++----
 makefile_linuxLP64_ffi                | 8 ++++----
 makefile_linuxLP64_lib                | 2 +-
 makefile_linuxLP64_redhat_utf8_ffi    | 2 +-
 makefile_linuxLP64_utf8               | 8 ++++----
 makefile_linuxLP64_utf8_ffi           | 8 ++++----
 makefile_linux_ffi                    | 8 ++++----
 makefile_linux_lib                    | 2 +-
 makefile_linux_lib_utf8               | 2 +-
 makefile_linux_maemo_utf8             | 8 ++++----
 makefile_linux_openwrt                | 2 +-
 makefile_linux_redhat_utf8_ffi        | 2 +-
 makefile_linux_utf8                   | 8 ++++----
 makefile_linux_utf8_ffi               | 8 ++++----
 makefile_netbsd                       | 4 ++--
 makefile_netbsd_utf8                  | 4 ++--
 makefile_opensolaris                  | 2 +-
 makefile_os2                          | 4 ++--
 makefile_raspberrypi                  | 4 ++--
 makefile_raspberrypi_utf8             | 4 ++--
 makefile_sunos                        | 2 +-
 makefile_sunosLP64                    | 2 +-
 makefile_sunosLP64_utf8               | 2 +-
 makefile_sunos_utf8                   | 2 +-
 makefile_tru64                        | 4 ++--
 57 files changed, 97 insertions(+), 97 deletions(-)

diff --git a/makefile_aixILP32_utf8_gcc b/makefile_aixILP32_utf8_gcc
index f0c3694..0ba3fad 100644
--- a/makefile_aixILP32_utf8_gcc
+++ b/makefile_aixILP32_utf8_gcc
@@ -9,7 +9,7 @@ DEFAULT_CFLAGS = -maix32 -Wall -pedantic -fno-strict-aliasing -Wno-uninitialized
 CC = gcc 
 
 default: $(OBJS) 
-	$(CC) $(OBJS) -maix32 -lm  -ldl -lrt -lnsl -o newlisp 
+	$(CC) $(LDFLAGS) $(OBJS) -maix32 -lm  -ldl -lrt -lnsl -o newlisp 
 
 .c.o: 
 	$(CC) $(DEFAULT_CFLAGS) $< 
diff --git a/makefile_aixLP64_utf8_gcc b/makefile_aixLP64_utf8_gcc
index ea0d37b..5c0deeb 100644
--- a/makefile_aixLP64_utf8_gcc
+++ b/makefile_aixLP64_utf8_gcc
@@ -9,7 +9,7 @@ DEFAULT_CFLAGS = -maix64 -Wall -pedantic -fno-strict-aliasing -Wno-uninitialized
 CC = gcc 
 
 default: $(OBJS) 
-	$(CC) $(OBJS) -maix64 -lm  -ldl -lrt -lnsl -o newlisp 
+	$(CC) $(LDFLAGS) $(OBJS) -maix64 -lm  -ldl -lrt -lnsl -o newlisp 
 
 .c.o: 
 	$(CC) $(DEFAULT_CFLAGS) $< 
diff --git a/makefile_aixLP64_utf8_xlc b/makefile_aixLP64_utf8_xlc
index ff66a9c..97b9726 100644
--- a/makefile_aixLP64_utf8_xlc
+++ b/makefile_aixLP64_utf8_xlc
@@ -11,7 +11,7 @@ CC = xlc_r
 
 
 default: $(OBJS) 
-	OBJECT_MODE=64 $(CC) $(OBJS) -lm  -ldl -lrt -lnsl -o newlisp 
+	OBJECT_MODE=64 $(CC) $(LDFLAGS) $(OBJS) -lm  -ldl -lrt -lnsl -o newlisp 
 
 .c.o: 
 	$(CC) $(DEFAULT_CFLAGS) $< 
diff --git a/makefile_aix_utf8_gcc b/makefile_aix_utf8_gcc
index ac0cbb5..ed2918c 100644
--- a/makefile_aix_utf8_gcc
+++ b/makefile_aix_utf8_gcc
@@ -9,7 +9,7 @@ DEFAULT_CFLAGS = -Wall -pedantic -fno-strict-aliasing -Wno-uninitialized -Wno-lo
 CC = gcc 
 
 default: $(OBJS) 
-	$(CC) $(OBJS) -lm  -ldl -lrt -lnsl -o newlisp 
+	$(CC) $(LDFLAGS) $(OBJS) -lm  -ldl -lrt -lnsl -o newlisp 
 
 .c.o: 
 	$(CC) $(DEFAULT_CFLAGS) $< 
diff --git a/makefile_aix_utf8_xlc b/makefile_aix_utf8_xlc
index 65b8e40..74fe320 100644
--- a/makefile_aix_utf8_xlc
+++ b/makefile_aix_utf8_xlc
@@ -11,7 +11,7 @@ DEFAULT_CFLAGS = -c -g -O2 -DSUPPORT_UTF8 -DAIX  $(CFLAGS)
 CC = xlc_r 
 
 default: $(OBJS) 
-	$(CC) $(OBJS) -lm  -ldl -lrt -lnsl -o newlisp 
+	$(CC) $(LDFLAGS) $(OBJS) -lm  -ldl -lrt -lnsl -o newlisp 
 
 .c.o: 
 	$(CC) $(DEFAULT_CFLAGS) $< 
diff --git a/makefile_amal_darwin_utf8_ffi b/makefile_amal_darwin_utf8_ffi
index 93620a4..251b5d8 100644
--- a/makefile_amal_darwin_utf8_ffi
+++ b/makefile_amal_darwin_utf8_ffi
@@ -14,7 +14,7 @@ DEFAULT_CFLAGS = -Wall -m32 -O1 -I/usr/include -c -DREADLINE -DMAC_OSX -DSUPPORT
 CC = gcc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m32 -lm -lreadline -lffi -o newlisp
+	$(CC) $(LDFLAGS) $(OBJS) -m32 -lm -lreadline -lffi -o newlisp
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_bsd b/makefile_bsd
index bac0e0c..a10cb31 100644
--- a/makefile_bsd
+++ b/makefile_bsd
@@ -13,9 +13,9 @@ DEFAULT_CFLAGS = -m32 -Wall -Wno-uninitialized -fno-strict-aliasing -O2 -c -g -D
 CC = cc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m32 -g -lm -lreadline -lncurses -o newlisp
+	$(CC) $(LDFLAGS) $(OBJS) -m32 -g -lm -lreadline -lncurses -o newlisp
 # or without readline lib
-#	$(CC) $(OBJS) -m32 -g -lm -o newlisp
+#	$(CC) $(LDFLAGS) $(OBJS) -m32 -g -lm -o newlisp
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_bsdLP64 b/makefile_bsdLP64
index c4808be..c993aa4 100644
--- a/makefile_bsdLP64
+++ b/makefile_bsdLP64
@@ -13,9 +13,9 @@ DEFAULT_CFLAGS = -m64 -Wall -Wno-uninitialized -fno-strict-aliasing -O2 -c -g -D
 CC = cc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m64 -g -lm -lreadline -lncurses -o newlisp
+	$(CC) $(LDFLAGS) $(OBJS) -m64 -g -lm -lreadline -lncurses -o newlisp
 # or without readline lib
-#	$(CC) $(OBJS) -m64 -g -lm -o newlisp
+#	$(CC) $(LDFLAGS) $(OBJS) -m64 -g -lm -o newlisp
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_bsdLP64_utf8 b/makefile_bsdLP64_utf8
index ad38421..ef75b65 100644
--- a/makefile_bsdLP64_utf8
+++ b/makefile_bsdLP64_utf8
@@ -13,9 +13,9 @@ DEFAULT_CFLAGS = -m64 -Wall -Wno-strict-aliasing -O2 -c -g -I/usr/local/include
 CC = cc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m64 -g -lm -lreadline -lncurses -o newlisp
+	$(CC) $(LDFLAGS) $(OBJS) -m64 -g -lm -lreadline -lncurses -o newlisp
 # or without readline lib
-#	$(CC) $(OBJS) -m64 -g -lm -o newlisp
+#	$(CC) $(LDFLAGS) $(OBJS) -m64 -g -lm -o newlisp
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_bsdLP64_utf8_ffi b/makefile_bsdLP64_utf8_ffi
index 95dc566..652c5c7 100644
--- a/makefile_bsdLP64_utf8_ffi
+++ b/makefile_bsdLP64_utf8_ffi
@@ -13,9 +13,9 @@ DEFAULT_CFLAGS = -m64 -Wall -fno-strict-aliasing -O2 -c -g -I/usr/local/include
 CC = cc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m64 -g -lm -lreadline -lncurses -L/usr/local/lib -lffi -o newlisp
+	$(CC) $(LDFLAGS) $(OBJS) -m64 -g -lm -lreadline -lncurses -L/usr/local/lib -lffi -o newlisp
 # or without readline lib
-#	$(CC) $(OBJS) -m64 -g -lm -o newlisp
+#	$(CC) $(LDFLAGS) $(OBJS) -m64 -g -lm -o newlisp
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_bsdLP64_utf8_lib b/makefile_bsdLP64_utf8_lib
index 3e36937..192f0ac 100644
--- a/makefile_bsdLP64_utf8_lib
+++ b/makefile_bsdLP64_utf8_lib
@@ -8,7 +8,7 @@ DEFAULT_CFLAGS = -m64 -fPIC -Wall -Wno-uninitialized -fno-strict-aliasing -O2 -c
 CC = cc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m64 -lm -shared -o newlisp.so
+	$(CC) $(LDFLAGS) $(OBJS) -m64 -lm -shared -o newlisp.so
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_bsd_lib b/makefile_bsd_lib
index f72cf85..f0b7a84 100644
--- a/makefile_bsd_lib
+++ b/makefile_bsd_lib
@@ -8,7 +8,7 @@ DEFAULT_CFLAGS = -m32 -Wall -Wno-uninitialized -fno-strict-aliasing -O2 -c -g -D
 CC = cc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m32 -lm -shared -o newlisp.so
+	$(CC) $(LDFLAGS) $(OBJS) -m32 -lm -shared -o newlisp.so
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_bsd_utf8 b/makefile_bsd_utf8
index 74b65e1..f714825 100644
--- a/makefile_bsd_utf8
+++ b/makefile_bsd_utf8
@@ -11,9 +11,9 @@ DEFAULT_CFLAGS = -m32 -Wall -Wno-uninitialized -fno-strict-aliasing -O2 -c -g -D
 CC = cc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m32 -g -lm -lreadline -lncurses -o newlisp
+	$(CC) $(LDFLAGS) $(OBJS) -m32 -g -lm -lreadline -lncurses -o newlisp
 # or without readline lib
-#	$(CC) $(OBJS) -m32 -g -lm -o newlisp
+#	$(CC) $(LDFLAGS) $(OBJS) -m32 -g -lm -o newlisp
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_bsd_utf8_ffi b/makefile_bsd_utf8_ffi
index daf759f..d01566d 100644
--- a/makefile_bsd_utf8_ffi
+++ b/makefile_bsd_utf8_ffi
@@ -12,9 +12,9 @@ DEFAULT_CFLAGS = -m32 -Wall -Wno-uninitialized -fno-strict-aliasing -O2 -c -g -I
 CC = cc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m32 -g -lm -lreadline -lncurses -L/usr/local/lib -lffi -o newlisp
+	$(CC) $(LDFLAGS) $(OBJS) -m32 -g -lm -lreadline -lncurses -L/usr/local/lib -lffi -o newlisp
 # or without readline lib
-#	$(CC) $(OBJS) -m32 -g -lm -o newlisp
+#	$(CC) $(LDFLAGS) $(OBJS) -m32 -g -lm -o newlisp
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_bsd_utf8_lib b/makefile_bsd_utf8_lib
index 55b8de4..104b481 100644
--- a/makefile_bsd_utf8_lib
+++ b/makefile_bsd_utf8_lib
@@ -8,7 +8,7 @@ DEFAULT_CFLAGS = -m32 -Wall -Wno-uninitialized -fno-strict-aliasing -O2 -c -g -D
 CC = cc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m32 -lm -shared -o newlisp.so
+	$(CC) $(LDFLAGS) $(OBJS) -m32 -lm -shared -o newlisp.so
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_cygwin b/makefile_cygwin
index 03009ac..a0b12dd 100644
--- a/makefile_cygwin
+++ b/makefile_cygwin
@@ -25,8 +25,8 @@ CC = gcc
 
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m32 -g -lm -ldl -lreadline -o newlisp.exe
-#	$(CC) $(OBJS) -m32 -g -lm -ldl -lreadline -lffi -o newlisp.exe
+	$(CC) $(LDFLAGS) $(OBJS) -m32 -g -lm -ldl -lreadline -o newlisp.exe
+#	$(CC) $(LDFLAGS) $(OBJS) -m32 -g -lm -ldl -lreadline -lffi -o newlisp.exe
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_cygwinLP64 b/makefile_cygwinLP64
index a835aa6..1b996f1 100644
--- a/makefile_cygwinLP64
+++ b/makefile_cygwinLP64
@@ -25,8 +25,8 @@ CC = gcc
 
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m64 -g -lm -ldl -lreadline -o newlisp.exe
-#	$(CC) $(OBJS) -m64 -g -lm -ldl -lreadline -lffi -o newlisp.exe
+	$(CC) $(LDFLAGS) $(OBJS) -m64 -g -lm -ldl -lreadline -o newlisp.exe
+#	$(CC) $(LDFLAGS) $(OBJS) -m64 -g -lm -ldl -lreadline -lffi -o newlisp.exe
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_darwin b/makefile_darwin
index aa9aca9..a84fd64 100644
--- a/makefile_darwin
+++ b/makefile_darwin
@@ -11,7 +11,7 @@ DEFAULT_CFLAGS = -m32 -Wall -O1 -c -DREADLINE -DMAC_OSX $(CFLAGS)
 CC = cc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m32 -lm -lreadline -o newlisp
+	$(CC) $(LDFLAGS) $(OBJS) -m32 -lm -lreadline -o newlisp
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_darwinLP64 b/makefile_darwinLP64
index f161bbe..c71aba2 100644
--- a/makefile_darwinLP64
+++ b/makefile_darwinLP64
@@ -12,7 +12,7 @@ DEFAULT_CFLAGS = -m64 -Wall -O1 -c -g -DREADLINE -DMAC_OSX -DNEWLISP64 $(CFLAGS)
 CC = cc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m64 -g -lm -lreadline -o newlisp
+	$(CC) $(LDFLAGS) $(OBJS) -m64 -g -lm -lreadline -o newlisp
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_darwinLP64_utf8 b/makefile_darwinLP64_utf8
index 9581a19..26dd4e1 100644
--- a/makefile_darwinLP64_utf8
+++ b/makefile_darwinLP64_utf8
@@ -11,7 +11,7 @@ DEFAULT_CFLAGS = -m64 -Wall -Oz -c -g -DREADLINE -DMAC_OSX -DNEWLISP64 -DSUPPORT
 CC = cc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m64 -g -lm -lreadline -o newlisp
+	$(CC) $(LDFLAGS) $(OBJS) -m64 -g -lm -lreadline -o newlisp
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_darwinLP64_utf8_ffi b/makefile_darwinLP64_utf8_ffi
index 4858d74..680bf49 100644
--- a/makefile_darwinLP64_utf8_ffi
+++ b/makefile_darwinLP64_utf8_ffi
@@ -12,7 +12,7 @@ DEFAULT_CFLAGS = -m64 -mmacosx-version-min=10.6 -Wall -Oz -c -DREADLINE -DMAC_OS
 CC = cc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m64 -mmacosx-version-min=10.6 -lm -lreadline -lffi -o newlisp
+	$(CC) $(LDFLAGS) $(OBJS) -m64 -mmacosx-version-min=10.6 -lm -lreadline -lffi -o newlisp
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_darwinLP64_utf8_lib b/makefile_darwinLP64_utf8_lib
index c0c22f9..707204c 100644
--- a/makefile_darwinLP64_utf8_lib
+++ b/makefile_darwinLP64_utf8_lib
@@ -11,7 +11,7 @@ DEFAULT_CFLAGS = -m64 -Wall -O1 -c -DREADLINE -DMAC_OSX -DSUPPORT_UTF8 -DLIBRARY
 CC = cc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m64 -lm -lreadline -bundle -o newlisp.dylib
+	$(CC) $(LDFLAGS) $(OBJS) -m64 -lm -lreadline -bundle -o newlisp.dylib
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_darwin_universal_utf8_compat b/makefile_darwin_universal_utf8_compat
index d20bc8a..e177e24 100644
--- a/makefile_darwin_universal_utf8_compat
+++ b/makefile_darwin_universal_utf8_compat
@@ -35,7 +35,7 @@ OBJS = newlisp.o nl-symbol.o nl-math.o nl-list.o nl-liststr.o nl-string.o nl-fil
 	nl-sock.o nl-import.o nl-xml-json.o nl-web.o nl-matrix.o nl-debug.o nl-utf8.o pcre.o
 
 default: $(OBJS)
-	$(CC) $(OBJS) -mmacosx-version-min=10.4 -arch i386 -arch ppc -g -lm -lreadline -o newlisp-universal
+	$(CC) $(LDFLAGS) $(OBJS) -mmacosx-version-min=10.4 -arch i386 -arch ppc -g -lm -lreadline -o newlisp-universal
 #   lipo newlisp-universal -output newlisp-intel -thin i386
 #   lipo newlisp-universal -output newlisp-ppc -thin ppc
 
diff --git a/makefile_darwin_utf8 b/makefile_darwin_utf8
index 7289aa9..ce14874 100644
--- a/makefile_darwin_utf8
+++ b/makefile_darwin_utf8
@@ -11,7 +11,7 @@ DEFAULT_CFLAGS = -m32 -Wall -O1 -c -DREADLINE -DMAC_OSX -DSUPPORT_UTF8 $(CFLAGS)
 CC = cc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m32 -lm -lreadline -o newlisp
+	$(CC) $(LDFLAGS) $(OBJS) -m32 -lm -lreadline -o newlisp
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_darwin_utf8_ffi b/makefile_darwin_utf8_ffi
index 2c14bb2..453a0bd 100644
--- a/makefile_darwin_utf8_ffi
+++ b/makefile_darwin_utf8_ffi
@@ -12,7 +12,7 @@ CC = cc
 #CC = gcc 
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m32 -lm -lreadline -lffi -o newlisp
+	$(CC) $(LDFLAGS) $(OBJS) -m32 -lm -lreadline -lffi -o newlisp
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_darwin_utf8_leopardIntel b/makefile_darwin_utf8_leopardIntel
index 07f6ff4..9c16a1a 100644
--- a/makefile_darwin_utf8_leopardIntel
+++ b/makefile_darwin_utf8_leopardIntel
@@ -20,7 +20,7 @@ OBJS = newlisp.o nl-symbol.o nl-math.o nl-list.o nl-liststr.o nl-string.o nl-fil
 	nl-sock.o nl-import.o nl-xml-json.o nl-web.o nl-matrix.o nl-debug.o nl-utf8.o pcre.o
 
 default: $(OBJS)
-	$(CC) $(OBJS) -mmacosx-version-min=10.5 -arch i386 -g -lm -lreadline -o newlisp
+	$(CC) $(LDFLAGS) $(OBJS) -mmacosx-version-min=10.5 -arch i386 -g -lm -lreadline -o newlisp
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_darwin_utf8_leopardIntel_ffi b/makefile_darwin_utf8_leopardIntel_ffi
index ef3cddf..ed83a23 100644
--- a/makefile_darwin_utf8_leopardIntel_ffi
+++ b/makefile_darwin_utf8_leopardIntel_ffi
@@ -20,7 +20,7 @@ OBJS = newlisp.o nl-symbol.o nl-math.o nl-list.o nl-liststr.o nl-string.o nl-fil
 	nl-sock.o nl-import.o nl-xml-json.o nl-web.o nl-matrix.o nl-debug.o nl-utf8.o pcre.o
 
 default: $(OBJS)
-	$(CC) $(OBJS) -mmacosx-version-min=10.5 -arch i386 -g -lm -lreadline -lffi -o newlisp
+	$(CC) $(LDFLAGS) $(OBJS) -mmacosx-version-min=10.5 -arch i386 -g -lm -lreadline -lffi -o newlisp
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_darwin_utf8_leopardPPC b/makefile_darwin_utf8_leopardPPC
index ca11fd5..e893fe1 100644
--- a/makefile_darwin_utf8_leopardPPC
+++ b/makefile_darwin_utf8_leopardPPC
@@ -25,7 +25,7 @@ OBJS = newlisp.o nl-symbol.o nl-math.o nl-list.o nl-liststr.o nl-string.o nl-fil
 	nl-sock.o nl-import.o nl-xml-json.o nl-web.o nl-matrix.o nl-debug.o nl-utf8.o pcre.o
 
 default: $(OBJS)
-	$(CC) $(OBJS) -mmacosx-version-min=10.5 -arch ppc -g -lm -lreadline -o newlisp
+	$(CC) $(LDFLAGS) $(OBJS) -mmacosx-version-min=10.5 -arch ppc -g -lm -lreadline -o newlisp
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_darwin_utf8_leopardPPC_ffi b/makefile_darwin_utf8_leopardPPC_ffi
index 6627a85..876e430 100644
--- a/makefile_darwin_utf8_leopardPPC_ffi
+++ b/makefile_darwin_utf8_leopardPPC_ffi
@@ -25,7 +25,7 @@ OBJS = newlisp.o nl-symbol.o nl-math.o nl-list.o nl-liststr.o nl-string.o nl-fil
 	nl-sock.o nl-import.o nl-xml-json.o nl-web.o nl-matrix.o nl-debug.o nl-utf8.o pcre.o
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m32 -mmacosx-version-min=10.5 -arch ppc -g -lm -lreadline -lffi -o newlisp
+	$(CC) $(LDFLAGS) $(OBJS) -m32 -mmacosx-version-min=10.5 -arch ppc -g -lm -lreadline -lffi -o newlisp
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_darwin_utf8_lib b/makefile_darwin_utf8_lib
index 4319f9c..99c567c 100644
--- a/makefile_darwin_utf8_lib
+++ b/makefile_darwin_utf8_lib
@@ -11,7 +11,7 @@ DEFAULT_CFLAGS = -m32 -Wall -O1 -c -DREADLINE -DMAC_OSX -DSUPPORT_UTF8 -DLIBRARY
 CC = cc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m32 -lm -lreadline -bundle -o newlisp.dylib
+	$(CC) $(LDFLAGS) $(OBJS) -m32 -lm -lreadline -bundle -o newlisp.dylib
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_emscripten_lib_utf8 b/makefile_emscripten_lib_utf8
index fa54783..2f468aa 100644
--- a/makefile_emscripten_lib_utf8
+++ b/makefile_emscripten_lib_utf8
@@ -28,7 +28,7 @@ CC = emcc
 default: $(OBJS)
 	cp qa-specific-tests/qa-bench newlisp-js
 	cp modules/canvas.lsp newlisp-js
-	$(CC) $(OBJS) -m32 -O2 -o newlisp-js-lib.html -s EXPORTED_FUNCTIONS="['_newlispEvalStr']" \
+	$(CC) $(LDFLAGS) $(OBJS) -m32 -O2 -o newlisp-js-lib.html -s EXPORTED_FUNCTIONS="['_newlispEvalStr']" \
 	-s MAX_SETJMPS=100 -s TOTAL_MEMORY=33554432 --closure 1 \
 	--embed-file newlisp-js/readme.txt --embed-file newlisp-js/qa-bench --embed-file newlisp-js/canvas.lsp
 	rm newlisp-js/qa-bench newlisp-js/canvas.lsp
diff --git a/makefile_linux b/makefile_linux
index 9f17ac8..aa34513 100644
--- a/makefile_linux
+++ b/makefile_linux
@@ -13,9 +13,9 @@ CC = gcc
 
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m32 -g -lm -ldl -lreadline -o newlisp # for UBUNTU Debian
-#	$(CC) $(OBJS) -m32 -g -lm -ldl -lreadline -lncurses -o newlisp # other Linux Dist
-#	$(CC) $(OBJS) -m32 -g -lm -ldl -o newlisp # without readline support
+	$(CC) $(LDFLAGS) $(OBJS) -m32 -g -lm -ldl -lreadline -o newlisp # for UBUNTU Debian
+#	$(CC) $(LDFLAGS) $(OBJS) -m32 -g -lm -ldl -lreadline -lncurses -o newlisp # other Linux Dist
+#	$(CC) $(LDFLAGS) $(OBJS) -m32 -g -lm -ldl -o newlisp # without readline support
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_linuxLP64 b/makefile_linuxLP64
index 65b1b81..d308eca 100644
--- a/makefile_linuxLP64
+++ b/makefile_linuxLP64
@@ -11,10 +11,10 @@ DEFAULT_CFLAGS = -fPIC -m64 -Wall -Wno-uninitialized -Wno-strict-aliasing -Wno-l
 CC = gcc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m64 -g -lm -ldl -lreadline -o newlisp # for UBUNTU Debian
-#	$(CC) $(OBJS) -m64 -g -lm -ldl -lreadline -ltermcap -o newlisp # slackware
-#	$(CC) $(OBJS) -m64 -g -lm -ldl -lreadline -lncurses -o newlisp # other Linux Dist
-#	$(CC) $(OBJS) -m64 -g -lm -ldl -o newlisp # without readline support
+	$(CC) $(LDFLAGS) $(OBJS) -m64 -g -lm -ldl -lreadline -o newlisp # for UBUNTU Debian
+#	$(CC) $(LDFLAGS) $(OBJS) -m64 -g -lm -ldl -lreadline -ltermcap -o newlisp # slackware
+#	$(CC) $(LDFLAGS) $(OBJS) -m64 -g -lm -ldl -lreadline -lncurses -o newlisp # other Linux Dist
+#	$(CC) $(LDFLAGS) $(OBJS) -m64 -g -lm -ldl -o newlisp # without readline support
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_linuxLP64_ffi b/makefile_linuxLP64_ffi
index 71c2bf8..5e31b72 100644
--- a/makefile_linuxLP64_ffi
+++ b/makefile_linuxLP64_ffi
@@ -11,10 +11,10 @@ DEFAULT_CFLAGS = -fPIC -m64 -Wall -Wno-uninitialized -Wno-strict-aliasing -Wno-l
 CC = gcc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m64 -g -lm -ldl -lreadline -lffi -o newlisp # for UBUNTU Debian
-#	$(CC) $(OBJS) -m64 -g -lm -ldl -lreadline -ltermcap -o newlisp # slackware
-#	$(CC) $(OBJS) -m64 -g -lm -ldl -lreadline -lncurses -o newlisp # other Linux Dist
-#	$(CC) $(OBJS) -m64 -g -lm -ldl -o newlisp # without readline support
+	$(CC) $(LDFLAGS) $(OBJS) -m64 -g -lm -ldl -lreadline -lffi -o newlisp # for UBUNTU Debian
+#	$(CC) $(LDFLAGS) $(OBJS) -m64 -g -lm -ldl -lreadline -ltermcap -o newlisp # slackware
+#	$(CC) $(LDFLAGS) $(OBJS) -m64 -g -lm -ldl -lreadline -lncurses -o newlisp # other Linux Dist
+#	$(CC) $(LDFLAGS) $(OBJS) -m64 -g -lm -ldl -o newlisp # without readline support
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_linuxLP64_lib b/makefile_linuxLP64_lib
index c0789cd..b82f9f5 100644
--- a/makefile_linuxLP64_lib
+++ b/makefile_linuxLP64_lib
@@ -11,7 +11,7 @@ DEFAULT_CFLAGS = -fPIC -m64 -Wall -Wno-uninitialized -Wno-strict-aliasing -Wno-l
 CC = gcc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m64 -g -lm -ldl -shared -o newlisp.so
+	$(CC) $(LDFLAGS) $(OBJS) -m64 -g -lm -ldl -shared -o newlisp.so
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_linuxLP64_redhat_utf8_ffi b/makefile_linuxLP64_redhat_utf8_ffi
index ed73ee1..4db1120 100644
--- a/makefile_linuxLP64_redhat_utf8_ffi
+++ b/makefile_linuxLP64_redhat_utf8_ffi
@@ -11,7 +11,7 @@ DEFAULT_CFLAGS = -fPIC -m64 -Wall -Wno-uninitialized -Wno-strict-aliasing -Wno-l
 CC = gcc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m64 -g -lm -ldl -lreadline -lffi -o newlisp # for RedHat CentOS
+	$(CC) $(LDFLAGS) $(OBJS) -m64 -g -lm -ldl -lreadline -lffi -o newlisp # for RedHat CentOS
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_linuxLP64_utf8 b/makefile_linuxLP64_utf8
index 3330e80..4dea813 100644
--- a/makefile_linuxLP64_utf8
+++ b/makefile_linuxLP64_utf8
@@ -11,10 +11,10 @@ DEFAULT_CFLAGS = -fPIC -m64 -Wall -Wno-uninitialized -Wno-strict-aliasing -Wno-l
 CC = gcc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m64 -g -lm -ldl -lreadline -o newlisp # for UBUNTU Debian
-#	$(CC) $(OBJS) -m64 -g -lm -ldl -lreadline -ltermcap -o newlisp # slackware
-#	$(CC) $(OBJS) -m64 -g -lm -ldl -lreadline -lncurses -o newlisp # other Linux Dist
-#	$(CC) $(OBJS) -m64 -g -lm -ldl -o newlisp # without readline support
+	$(CC) $(LDFLAGS) $(OBJS) -m64 -g -lm -ldl -lreadline -o newlisp # for UBUNTU Debian
+#	$(CC) $(LDFLAGS) $(OBJS) -m64 -g -lm -ldl -lreadline -ltermcap -o newlisp # slackware
+#	$(CC) $(LDFLAGS) $(OBJS) -m64 -g -lm -ldl -lreadline -lncurses -o newlisp # other Linux Dist
+#	$(CC) $(LDFLAGS) $(OBJS) -m64 -g -lm -ldl -o newlisp # without readline support
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_linuxLP64_utf8_ffi b/makefile_linuxLP64_utf8_ffi
index 63a58cc..30ee8c6 100644
--- a/makefile_linuxLP64_utf8_ffi
+++ b/makefile_linuxLP64_utf8_ffi
@@ -14,10 +14,10 @@ DEFAULT_CFLAGS = -fPIC -m64 -Wall -Wno-uninitialized -Wno-strict-aliasing -Wno-l
 CC = gcc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m64 -g -lm -ldl -lreadline -lffi -o newlisp # for UBUNTU Debian
-#	$(CC) $(OBJS) -m64 -g -lm -ldl -lreadline -ltermcap -o newlisp # slackware
-#	$(CC) $(OBJS) -m64 -g -lm -ldl -lreadline -lncurses -o newlisp # other Linux Dist
-#	$(CC) $(OBJS) -m64 -g -lm -ldl -o newlisp # without readline support
+	$(CC) $(LDFLAGS) $(OBJS) -m64 -g -lm -ldl -lreadline -lffi -o newlisp # for UBUNTU Debian
+#	$(CC) $(LDFLAGS) $(OBJS) -m64 -g -lm -ldl -lreadline -ltermcap -o newlisp # slackware
+#	$(CC) $(LDFLAGS) $(OBJS) -m64 -g -lm -ldl -lreadline -lncurses -o newlisp # other Linux Dist
+#	$(CC) $(LDFLAGS) $(OBJS) -m64 -g -lm -ldl -o newlisp # without readline support
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_linux_ffi b/makefile_linux_ffi
index 52fcf98..d386cf3 100644
--- a/makefile_linux_ffi
+++ b/makefile_linux_ffi
@@ -12,10 +12,10 @@ CC = gcc
 
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m32 -g -lm -ldl -lreadline -lffi -o newlisp # for UBUNTU Debian
-#	$(CC) $(OBJS) -m32 -g -lm -ldl -lreadline -ltermcap -o newlisp # slackware
-#	$(CC) $(OBJS) -m32 -g -lm -ldl -lreadline -lncurses -o newlisp # other Linux Dist
-#	$(CC) $(OBJS) -m32 -g -lm -ldl -o newlisp # without readline support
+	$(CC) $(LDFLAGS) $(OBJS) -m32 -g -lm -ldl -lreadline -lffi -o newlisp # for UBUNTU Debian
+#	$(CC) $(LDFLAGS) $(OBJS) -m32 -g -lm -ldl -lreadline -ltermcap -o newlisp # slackware
+#	$(CC) $(LDFLAGS) $(OBJS) -m32 -g -lm -ldl -lreadline -lncurses -o newlisp # other Linux Dist
+#	$(CC) $(LDFLAGS) $(OBJS) -m32 -g -lm -ldl -o newlisp # without readline support
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_linux_lib b/makefile_linux_lib
index 3d21ade..f91b505 100644
--- a/makefile_linux_lib
+++ b/makefile_linux_lib
@@ -11,7 +11,7 @@ DEFAULT_CFLAGS = -m32 -Wall -Wno-uninitialized -Wno-strict-aliasing -Wno-long-lo
 CC = gcc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m32 -lm -ldl -shared -o newlisp.so
+	$(CC) $(LDFLAGS) $(OBJS) -m32 -lm -ldl -shared -o newlisp.so
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_linux_lib_utf8 b/makefile_linux_lib_utf8
index cb380de..1836f34 100644
--- a/makefile_linux_lib_utf8
+++ b/makefile_linux_lib_utf8
@@ -11,7 +11,7 @@ DEFAULT_CFLAGS = -m32 -Wall -Wno-uninitialized -Wno-strict-aliasing -Wno-long-lo
 CC = gcc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m32 -lm -ldl -shared -o newlisp.so
+	$(CC) $(LDFLAGS) $(OBJS) -m32 -lm -ldl -shared -o newlisp.so
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_linux_maemo_utf8 b/makefile_linux_maemo_utf8
index ee646c2..f227d07 100644
--- a/makefile_linux_maemo_utf8
+++ b/makefile_linux_maemo_utf8
@@ -12,10 +12,10 @@ CC = gcc
 
 
 default: $(OBJS)
-	$(CC) $(OBJS) -g -lm -ldl -lreadline -o newlisp # for UBUNTU Debian
-#    $(CC) $(OBJS) -g -lm -ldl -lreadline -ltermcap -o newlisp # slackware
-#    $(CC) $(OBJS) -g -lm -ldl -lreadline -lncurses -o newlisp # other Linux Dist
-#    $(CC) $(OBJS) -g -lm -ldl -o newlisp # without readline support
+	$(CC) $(LDFLAGS) $(OBJS) -g -lm -ldl -lreadline -o newlisp # for UBUNTU Debian
+#    $(CC) $(LDFLAGS) $(OBJS) -g -lm -ldl -lreadline -ltermcap -o newlisp # slackware
+#    $(CC) $(LDFLAGS) $(OBJS) -g -lm -ldl -lreadline -lncurses -o newlisp # other Linux Dist
+#    $(CC) $(LDFLAGS) $(OBJS) -g -lm -ldl -o newlisp # without readline support
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_linux_openwrt b/makefile_linux_openwrt
index 0e8d028..53d7cbf 100644
--- a/makefile_linux_openwrt
+++ b/makefile_linux_openwrt
@@ -14,7 +14,7 @@ LD = mips-openwrt-linux-ld
 
 
 default: $(OBJS)
-	$(CC) $(OBJS)  -o newlisp $(LDFLAGS)   #for openwrt
+	$(CC) $(LDFLAGS) $(OBJS)  -o newlisp $(LDFLAGS)   #for openwrt
 	$(STRIP) newlisp
 	upx --best -o newlisp_s newlisp
 	rm newlisp
diff --git a/makefile_linux_redhat_utf8_ffi b/makefile_linux_redhat_utf8_ffi
index 7de414c..c9f4525 100644
--- a/makefile_linux_redhat_utf8_ffi
+++ b/makefile_linux_redhat_utf8_ffi
@@ -11,7 +11,7 @@ DEFAULT_CFLAGS = -m32 -Wall -Wno-strict-aliasing -Wno-long-long -c -O2 -g -DREAD
 CC = gcc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m32 -g -lm -ldl -lreadline -lffi -o newlisp # for RedHat CentOS 
+	$(CC) $(LDFLAGS) $(OBJS) -m32 -g -lm -ldl -lreadline -lffi -o newlisp # for RedHat CentOS 
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_linux_utf8 b/makefile_linux_utf8
index c272f22..fb6576b 100644
--- a/makefile_linux_utf8
+++ b/makefile_linux_utf8
@@ -11,10 +11,10 @@ DEFAULT_CFLAGS = -m32 -Wall -Wno-strict-aliasing -Wno-long-long -c -O2 -g -DREAD
 CC = gcc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m32 -g -lm -ldl -lreadline -o newlisp # for UBUNTU Debian
-#	$(CC) $(OBJS) -m32 -g -lm -ldl -lreadline -ltermcap -o newlisp # slackware
-#	$(CC) $(OBJS) -m32 -g -lm -ldl -lreadline -lncurses -o newlisp # other Linux Dist
-#	$(CC) $(OBJS) -m32 -g -lm -ldl -o newlisp # without readline support
+	$(CC) $(LDFLAGS) $(OBJS) -m32 -g -lm -ldl -lreadline -o newlisp # for UBUNTU Debian
+#	$(CC) $(LDFLAGS) $(OBJS) -m32 -g -lm -ldl -lreadline -ltermcap -o newlisp # slackware
+#	$(CC) $(LDFLAGS) $(OBJS) -m32 -g -lm -ldl -lreadline -lncurses -o newlisp # other Linux Dist
+#	$(CC) $(LDFLAGS) $(OBJS) -m32 -g -lm -ldl -o newlisp # without readline support
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_linux_utf8_ffi b/makefile_linux_utf8_ffi
index 10b6dc2..24487c0 100644
--- a/makefile_linux_utf8_ffi
+++ b/makefile_linux_utf8_ffi
@@ -11,10 +11,10 @@ DEFAULT_CFLAGS = -fPIC -m32 -Wall -Wno-strict-aliasing -Wno-long-long -c -O2 -g
 CC = gcc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m32 -g -lm -ldl -lreadline -lffi -o newlisp # for UBUNTU Debian
-#	$(CC) $(OBJS) -m32 -g -lm -ldl -lreadline -ltermcap -o newlisp # slackware
-#	$(CC) $(OBJS) -m32 -g -lm -ldl -lreadline -lncurses -o newlisp # other Linux Dist
-#	$(CC) $(OBJS) -m32 -g -lm -ldl -o newlisp # without readline support
+	$(CC) $(LDFLAGS) $(OBJS) -m32 -g -lm -ldl -lreadline -lffi -o newlisp # for UBUNTU Debian
+#	$(CC) $(LDFLAGS) $(OBJS) -m32 -g -lm -ldl -lreadline -ltermcap -o newlisp # slackware
+#	$(CC) $(LDFLAGS) $(OBJS) -m32 -g -lm -ldl -lreadline -lncurses -o newlisp # other Linux Dist
+#	$(CC) $(LDFLAGS) $(OBJS) -m32 -g -lm -ldl -o newlisp # without readline support
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_netbsd b/makefile_netbsd
index e34c152..236f087 100644
--- a/makefile_netbsd
+++ b/makefile_netbsd
@@ -12,9 +12,9 @@ DEFAULT_CFLAGS = -m32 -Wall -Wno-uninitialized -Wno-strict-aliasing -O2 -c -g -D
 CC = gcc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -g -lm -lreadline -lncurses -o newlisp
+	$(CC) $(LDFLAGS) $(OBJS) -g -lm -lreadline -lncurses -o newlisp
 # to compile wihtout readline support 
-#	$(CC) $(OBJS) -g -lm -o newlisp
+#	$(CC) $(LDFLAGS) $(OBJS) -g -lm -o newlisp
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_netbsd_utf8 b/makefile_netbsd_utf8
index f683828..7ef0fe3 100644
--- a/makefile_netbsd_utf8
+++ b/makefile_netbsd_utf8
@@ -12,9 +12,9 @@ DEFAULT_CFLAGS = -m32 -Wall -Wno-uninitialized -Wno-strict-aliasing -O2 -c -g -D
 CC = gcc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -g -lm -lreadline -lncurses -o newlisp
+	$(CC) $(LDFLAGS) $(OBJS) -g -lm -lreadline -lncurses -o newlisp
 # without readline support
-#	$(CC) $(OBJS) -g -lm -o newlisp
+#	$(CC) $(LDFLAGS) $(OBJS) -g -lm -o newlisp
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_opensolaris b/makefile_opensolaris
index 6d7d02f..242de00 100644
--- a/makefile_opensolaris
+++ b/makefile_opensolaris
@@ -10,7 +10,7 @@ DEFAULT_CFLAGS = -m32 -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-str
 CC = gcc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -lm -ldl -lrt -lsocket -lnsl -o newlisp
+	$(CC) $(LDFLAGS) $(OBJS) -lm -ldl -lrt -lsocket -lnsl -o newlisp
 	@echo ""
 	@echo "do not use 'make install' install files manually; see Makefile for details"
 	@echo "for a minimum install just put newlisp into /usr/bin/newlisp
diff --git a/makefile_os2 b/makefile_os2
index 66d4f2a..9b2c9a2 100644
--- a/makefile_os2
+++ b/makefile_os2
@@ -11,8 +11,8 @@ DEFAULT_CFLAGS = -Wall -pedantic -Wno-uninitialized -Wno-strict-aliasing -Wno-lo
 CC = gcc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -Zomf -Zmt -lm -lreadline -lncurses -ldl -o newlisp.exe
-	#$(CC) $(OBJS) -Zomf -Zmt -lm -ldl -o newlisp.exe
+	$(CC) $(LDFLAGS) $(OBJS) -Zomf -Zmt -lm -lreadline -lncurses -ldl -o newlisp.exe
+	#$(CC) $(LDFLAGS) $(OBJS) -Zomf -Zmt -lm -ldl -o newlisp.exe
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_raspberrypi b/makefile_raspberrypi
index 1b14737..15054e6 100644
--- a/makefile_raspberrypi
+++ b/makefile_raspberrypi
@@ -17,8 +17,8 @@ CC = gcc
 
 
 default: $(OBJS)
-#	$(CC) $(OBJS) -g -lm -ldl -lreadline -o newlisp # with readline support 
-	$(CC) $(OBJS) -g -lm -ldl -o newlisp # without readline support
+#	$(CC) $(LDFLAGS) $(OBJS) -g -lm -ldl -lreadline -o newlisp # with readline support 
+	$(CC) $(LDFLAGS) $(OBJS) -g -lm -ldl -o newlisp # without readline support
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_raspberrypi_utf8 b/makefile_raspberrypi_utf8
index e4714aa..4e8caaa 100644
--- a/makefile_raspberrypi_utf8
+++ b/makefile_raspberrypi_utf8
@@ -16,8 +16,8 @@ CC = gcc
 
 
 default: $(OBJS)
-#	$(CC) $(OBJS) -g -lm -ldl -lreadline -o newlisp #  with readline support
-	$(CC) $(OBJS) -g -lm -ldl -o newlisp # without readline support
+#	$(CC) $(LDFLAGS) $(OBJS) -g -lm -ldl -lreadline -o newlisp #  with readline support
+	$(CC) $(LDFLAGS) $(OBJS) -g -lm -ldl -o newlisp # without readline support
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_sunos b/makefile_sunos
index a0e11a5..f130a02 100644
--- a/makefile_sunos
+++ b/makefile_sunos
@@ -10,7 +10,7 @@ DEFAULT_CFLAGS = -m32 -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-str
 CC = gcc 
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m32 -lm -ldl -lrt -lsocket -lnsl -lreadline -lncurses -o newlisp
+	$(CC) $(LDFLAGS) $(OBJS) -m32 -lm -ldl -lrt -lsocket -lnsl -lreadline -lncurses -o newlisp
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_sunosLP64 b/makefile_sunosLP64
index 711652b..a3e02fe 100644
--- a/makefile_sunosLP64
+++ b/makefile_sunosLP64
@@ -11,7 +11,7 @@ DEFAULT_CFLAGS = -m64 -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-str
 CC = gcc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m64 -lm -ldl -lrt -lsocket -lnsl -lreadline -lncurses -o newlisp
+	$(CC) $(LDFLAGS) $(OBJS) -m64 -lm -ldl -lrt -lsocket -lnsl -lreadline -lncurses -o newlisp
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_sunosLP64_utf8 b/makefile_sunosLP64_utf8
index 1da6dca..78c987c 100644
--- a/makefile_sunosLP64_utf8
+++ b/makefile_sunosLP64_utf8
@@ -11,7 +11,7 @@ DEFAULT_CFLAGS = -m64 -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-str
 CC = gcc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m64 -lm -ldl -lrt -lsocket -lnsl -lreadline -lncurses -o newlisp
+	$(CC) $(LDFLAGS) $(OBJS) -m64 -lm -ldl -lrt -lsocket -lnsl -lreadline -lncurses -o newlisp
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_sunos_utf8 b/makefile_sunos_utf8
index 5dd3aa4..57dbdc2 100644
--- a/makefile_sunos_utf8
+++ b/makefile_sunos_utf8
@@ -13,7 +13,7 @@ CC = gcc
 
 
 default: $(OBJS)
-	$(CC) $(OBJS) -m32 -lm -ldl -lrt -lsocket -lnsl -lreadline -lncurses -o newlisp
+	$(CC) $(LDFLAGS) $(OBJS) -m32 -lm -ldl -lrt -lsocket -lnsl -lreadline -lncurses -o newlisp
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
diff --git a/makefile_tru64 b/makefile_tru64
index 1e1956f..5590a49 100644
--- a/makefile_tru64
+++ b/makefile_tru64
@@ -11,10 +11,10 @@ DEFAULT_CFLAGS = -ieee -pedantic -c -O3 -DTRU64 -DNEWLISP64 -D_POSIX_PII_SOCKET
 CC = cc
 
 default: $(OBJS)
-	$(CC) $(OBJS) -lm -lrt -ldb -lbsd -o newlisp
+	$(CC) $(LDFLAGS) $(OBJS) -lm -lrt -ldb -lbsd -o newlisp
 
 readline: $(OBJS)
-	$(CC) $(OBJS) -lm -lrt -ldb -lbsd -lreadline -ltermcap -o newlisp
+	$(CC) $(LDFLAGS) $(OBJS) -lm -lrt -ldb -lbsd -lreadline -ltermcap -o newlisp
 
 .c.o:
 	$(CC) $(DEFAULT_CFLAGS) $<
