diff --git a/harbour/ChangeLog b/harbour/ChangeLog
index 0842640a49..140ea4b74d 100644
--- a/harbour/ChangeLog
+++ b/harbour/ChangeLog
@@ -17,6 +17,38 @@
past entries belonging to author(s): Viktor Szakats.
*/
+2009-08-26 12:28 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
+ * INSTALL
+ + Added new section: HOW TO DO A PARTIAL [RE]BUILD
+ This wouldn't have been possible a week ago, the
+ situation was so much different and complicated for
+ various cases.
+ ! Cleaned msys/cygwin/
references and NOTEs.
+
+ * config/dyn.mk
+ * config/bin.mk
+ * config/global.mk
+ + config/bsd/libs.mk
+ * config/bsd/gcc.mk
+ + config/hpux/libs.mk
+ * config/hpux/gcc.mk
+ + config/darwin/libs.mk
+ * config/darwin/gcc.mk
+ * config/darwin/icc.mk
+ + config/linux/libs.mk
+ * config/linux/global.mk
+ + config/sunos/libs.mk
+ * config/sunos/gcc.mk
+ * config/sunos/sunpro.mk
+ % Moved "system" library logic to compiler libs.mk files
+ for all *nix compilers.
+
+ * config/dos/djgpp.mk
+ * config/global.mk
+ * DJGPP with win-based make messages converted to a warning
+ and moved next to the other similar warning detecting
+ another non-ideal combination.
+
2009-08-26 11:18 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* INSTALL
+ Documented HB_CCPATH, HB_CCPREFIX, HB_CCPOSTFIX config variables.
@@ -35,7 +67,7 @@
* config/linux/sunpro.mk
% Moved 'system' library name and path list forming logic to
platform global.mk.
- ; TODO: Also for other platforms.
+ ; TODO: Also for other platforms. [DONE]
* source/Makefile
! Fixed to use '-' separator between dynlib name and version
diff --git a/harbour/INSTALL b/harbour/INSTALL
index c86760662c..e747f17f5a 100644
--- a/harbour/INSTALL
+++ b/harbour/INSTALL
@@ -52,12 +52,6 @@ HOW TO BUILD AND INSTALL HARBOUR FROM SOURCE
> hello
You should see 'Hello world!' on screen.
- NOTES: - is your destination directory where executables,
- libraries and headers will be created. Use absolute paths
- only. For a peace of mind, avoid using spaces, quotes
- in the name. You can leave it empty, in this case the
- results will be created under the current directory tree.
-
on Windows hosts with POSIX shells (MSYS/Cygwin)
----------------------------------
You can also use these shells to build Harbour on Windows.
@@ -71,9 +65,7 @@ HOW TO BUILD AND INSTALL HARBOUR FROM SOURCE
> hello
You should see 'Hello world!' on screen.
- NOTES: - With Cygwin, should use Cygwin drive
- notation: /cygdrive/c for C:
- - When building for Borland C make sure that
+ NOTES: - When building for Borland C make sure that
GNU Make is executed when typing 'make',
Borland Make has the same name.
@@ -178,6 +170,20 @@ HOW TO BUILD AND INSTALL HARBOUR FROM SOURCE
You should see 'Hello world!' on screen.
+HOW TO DO A PARTIAL [RE]BUILD
+=============================
+
+ If you want to [re]build only a specific part of Harbour, like
+ one library, all contrib libs or core libs, you have to do
+ everything the same as for a full build, the only difference
+ is that you first have to go into the specific source directory
+ you want to [re]build. When starting GNU Make, all components
+ under that dir will be built:
+
+ cd source/rtl
+ [clean] [install]
+
+
HOW TO ENABLE OPTIONAL COMPONENTS BEFORE BUILD
==============================================
@@ -216,8 +222,7 @@ HOW TO ENABLE OPTIONAL COMPONENTS BEFORE BUILD
HB_INC_QT=C:\Qt\include
HB_INC_SQLITE3=C:\sqlite3 (defaults to locally hosted version on win/dos/os2)
- NOTES: - For MinGW + MSYS and Cygwin you have to use forward slashes
- and also Cygwin drive notation for Cygwin.
+ NOTES: - You need to use native path format to your shell.
- Spaces in directory names aren't currently supported.
(You can use short name alias on Windows platform, though)
- Don't put directory names inside double quotes.
@@ -401,6 +406,16 @@ OPTIONS AVAILABLE WHEN BUILDING HARBOUR
and /usr/local/harbour-- for
cross-builds. It's always set to /pkg//
when HB_BUILD_PKG is set to 'yes'.
+ Use absolute paths only. For a peace of mind,
+ avoid using spaces and quotes in the name.
+ You have to use path format native to your shell.
+ F.e. to specify C:\dir on Windows, with Cygwin
+ you should use /cygdrive/c/dir, with MSYS /c/dir.
+ It's also possible to use following macros:
+ {hb_top} - Source tree root dir.
+ {hb_plat} - Target platform
+ {hb_comp} - Target compiler
+ {hb_cpu} - Target CPU
- HB_BIN_INSTALL Override directory to install executables
- HB_LIB_INSTALL Override directory to install libraries
@@ -458,7 +473,7 @@ OPTIONS AVAILABLE WHEN BUILDING HARBOUR
- HB_CCPREFIX=[] Used with gcc family to specify
compiler/linker/archive tool name prefix.
- HB_CCPOSTFIX=[] Used with gcc family to specify compiler/linker
- tool postfix (usually version number).
+ tool name postfix (usually version number).
Cross-building
--------------
@@ -638,7 +653,7 @@ EXAMPLES
--8<--
rem ; Add these *before* above sample scripts to configure 3rd party dependencies.
- rem For 'MinGW + MSYS' and Cygwin you'll have to use forward slashes and
+ rem When using MSYS or Cygwin shell you'll have to use forward slashes and
rem also Cygwin drive notation for Cygwin.
set HB_INC_ADS=C:\ads\acesdk
set HB_INC_ALLEGRO=C:\allegro\include
diff --git a/harbour/config/bin.mk b/harbour/config/bin.mk
index 96509198bc..324dc0190e 100644
--- a/harbour/config/bin.mk
+++ b/harbour/config/bin.mk
@@ -52,6 +52,7 @@ HB_LIBS_TPL :=
_HB_RDD :=
_HB_VM :=
+-include $(TOP)$(ROOT)config/$(HB_PLATFORM)/libs.mk
include $(TOP)$(ROOT)config/$(HB_PLATFORM)/$(HB_COMPILER).mk
include $(TOP)$(ROOT)config/c.mk
include $(TOP)$(ROOT)config/prg.mk
diff --git a/harbour/config/bsd/gcc.mk b/harbour/config/bsd/gcc.mk
index faa1c4cdc8..9194e438b9 100644
--- a/harbour/config/bsd/gcc.mk
+++ b/harbour/config/bsd/gcc.mk
@@ -35,44 +35,10 @@ endif
LD := $(HB_CCACHE) $(HB_CCPREFIX)$(HB_CMP)$(HB_CCPOSTFIX)
LD_OUT := -o
-LIBPATHS := -L$(LIB_DIR)
-LDLIBS := $(foreach lib,$(LIBS),-l$(lib))
+LIBPATHS := $(LIB_DIR)
-ifneq ($(filter hbrtl, $(LIBS)),)
- # Add the specified GT driver library
- ifeq ($(HB_CRS_LIB),)
- HB_CRS_LIB := ncurses
- endif
- ifneq ($(filter gtcrs, $(LIBS)),)
- LDLIBS += -l$(HB_CRS_LIB)
- endif
- ifneq ($(filter gtsln, $(LIBS)),)
- LDLIBS += -lslang
- # In BSD, slang still needs curses :(
- ifeq ($(filter gtcrs, $(LIBS)),)
- LDLIBS += -l$(HB_CRS_LIB)
- endif
- endif
- ifneq ($(filter gtxwc, $(LIBS)),)
- LDLIBS += -lX11
- #LIBPATHS += -L/usr/X11R6/lib64
- LIBPATHS += -L/usr/X11R6/lib
- endif
-
- LIBPATHS += -L/usr/local/lib
-
- ifneq ($(filter -DHB_PCRE_REGEX, $(HB_USER_CFLAGS)),)
- LDLIBS += -lpcre
- endif
-
- ifneq ($(filter -DHB_EXT_ZLIB, $(HB_USER_CFLAGS)),)
- LDLIBS += -lz
- endif
-endif
-
-LDLIBS += -lm
-
-LDFLAGS += $(LIBPATHS)
+LDLIBS := $(foreach lib,$(LIBS) $(SYSLIBS),-l$(lib))
+LDFLAGS += $(foreach dir,$(LIBPATHS) $(SYSLIBPATHS),-L$(dir))
AR := $(HB_CCPREFIX)ar
ARFLAGS :=
diff --git a/harbour/config/bsd/libs.mk b/harbour/config/bsd/libs.mk
new file mode 100644
index 0000000000..32de62e853
--- /dev/null
+++ b/harbour/config/bsd/libs.mk
@@ -0,0 +1,38 @@
+#
+# $Id$
+#
+
+SYSLIBS :=
+SYSLIBPATHS :=
+
+ifneq ($(filter hbrtl, $(LIBS)),)
+ ifeq ($(HB_CRS_LIB),)
+ HB_CRS_LIB := ncurses
+ endif
+ ifneq ($(filter gtcrs, $(LIBS)),)
+ SYSLIBS += $(HB_CRS_LIB)
+ endif
+ ifneq ($(filter gtsln, $(LIBS)),)
+ SYSLIBS += slang
+ # In BSD, slang still needs curses :(
+ ifeq ($(filter gtcrs, $(LIBS)),)
+ SYSLIBS += $(HB_CRS_LIB)
+ endif
+ endif
+ ifneq ($(filter gtxwc, $(LIBS)),)
+ SYSLIBS += X11
+ # SYSLIBPATHS += /usr/X11R6/lib64
+ SYSLIBPATHS += /usr/X11R6/lib
+ endif
+
+ SYSLIBPATHS += /usr/local/lib
+
+ ifneq ($(filter -DHB_PCRE_REGEX, $(HB_USER_CFLAGS)),)
+ SYSLIBS += pcre
+ endif
+ ifneq ($(filter -DHB_EXT_ZLIB, $(HB_USER_CFLAGS)),)
+ SYSLIBS += z
+ endif
+endif
+
+SYSLIBS += m
diff --git a/harbour/config/darwin/gcc.mk b/harbour/config/darwin/gcc.mk
index c2564e7e22..2b99dcd728 100644
--- a/harbour/config/darwin/gcc.mk
+++ b/harbour/config/darwin/gcc.mk
@@ -48,42 +48,10 @@ endif
LD := $(HB_CCACHE) $(HB_CCPREFIX)$(HB_CMP)$(HB_CCPOSTFIX)
LD_OUT := -o$(subst x,x, )
-LIBPATHS := -L$(LIB_DIR)
-LDLIBS := $(foreach lib,$(LIBS),-l$(lib))
+LIBPATHS := $(LIB_DIR)
-ifneq ($(filter hbrtl, $(LIBS)),)
- # Add the specified GT driver library
- ifeq ($(HB_CRS_LIB),)
- HB_CRS_LIB := ncurses
- endif
- ifneq ($(filter gtcrs, $(LIBS)),)
- LDLIBS += -l$(HB_CRS_LIB)
- endif
- ifneq ($(filter gtsln, $(LIBS)),)
- LDLIBS += -lslang
- # In BSD, slang still needs curses :(
- ifeq ($(filter gtcrs, $(LIBS)),)
- LDLIBS += -l$(HB_CRS_LIB)
- endif
- endif
- ifneq ($(filter gtxwc, $(LIBS)),)
- LDLIBS += -lX11
- #LIBPATHS += -L/usr/X11R6/lib64
- LIBPATHS += -L/usr/X11R6/lib
- endif
-
- ifneq ($(filter -DHB_PCRE_REGEX, $(HB_USER_CFLAGS)),)
- LDLIBS += -lpcre
- endif
-
- ifneq ($(filter -DHB_EXT_ZLIB, $(HB_USER_CFLAGS)),)
- LDLIBS += -lz
- endif
-endif
-
-LDLIBS += -lm
-
-LDFLAGS += $(LIBPATHS)
+LDLIBS := $(foreach lib,$(LIBS) $(SYSLIBS),-l$(lib))
+LDFLAGS += $(foreach dir,$(LIBPATHS) $(SYSLIBPATHS),-L$(dir))
AR := libtool
ARFLAGS :=
diff --git a/harbour/config/darwin/icc.mk b/harbour/config/darwin/icc.mk
index debda3febc..fbf68f3c3c 100644
--- a/harbour/config/darwin/icc.mk
+++ b/harbour/config/darwin/icc.mk
@@ -41,42 +41,10 @@ endif
LD := $(HB_CCACHE) $(HB_CMP)
LD_OUT := -o
-LIBPATHS := -L$(LIB_DIR)
-LDLIBS := $(foreach lib,$(LIBS),-l$(lib))
+LIBPATHS := $(LIB_DIR)
-ifneq ($(filter hbrtl, $(LIBS)),)
- # Add the specified GT driver library
- ifeq ($(HB_CRS_LIB),)
- HB_CRS_LIB := ncurses
- endif
- ifneq ($(filter gtcrs, $(LIBS)),)
- LDLIBS += -l$(HB_CRS_LIB)
- endif
- ifneq ($(filter gtsln, $(LIBS)),)
- LDLIBS += -lslang
- # In BSD, slang still needs curses :(
- ifeq ($(filter gtcrs, $(LIBS)),)
- LDLIBS += -l$(HB_CRS_LIB)
- endif
- endif
- ifneq ($(filter gtxwc, $(LIBS)),)
- LDLIBS += -lX11
- #LIBPATHS += -L/usr/X11R6/lib64
- LIBPATHS += -L/usr/X11R6/lib
- endif
-
- ifneq ($(filter -DHB_PCRE_REGEX, $(HB_USER_CFLAGS)),)
- LDLIBS += -lpcre
- endif
-
- ifneq ($(filter -DHB_EXT_ZLIB, $(HB_USER_CFLAGS)),)
- LDLIBS += -lz
- endif
-endif
-
-LDLIBS += -lm
-
-LDFLAGS += $(LIBPATHS)
+LDLIBS := $(foreach lib,$(LIBS) $(SYSLIBS),-l$(lib))
+LDFLAGS += $(foreach dir,$(LIBPATHS) $(SYSLIBPATHS),-L$(dir))
AR := libtool
ARFLAGS :=
diff --git a/harbour/config/darwin/libs.mk b/harbour/config/darwin/libs.mk
new file mode 100644
index 0000000000..a92180a56c
--- /dev/null
+++ b/harbour/config/darwin/libs.mk
@@ -0,0 +1,35 @@
+#
+# $Id$
+#
+
+SYSLIBS :=
+SYSLIBPATHS :=
+
+ifneq ($(filter hbrtl, $(LIBS)),)
+ ifeq ($(HB_CRS_LIB),)
+ HB_CRS_LIB := ncurses
+ endif
+ ifneq ($(filter gtcrs, $(LIBS)),)
+ SYSLIBS += $(HB_CRS_LIB)
+ endif
+ ifneq ($(filter gtsln, $(LIBS)),)
+ SYSLIBS += slang
+ # In BSD, slang still needs curses :(
+ ifeq ($(filter gtcrs, $(LIBS)),)
+ SYSLIBS += $(HB_CRS_LIB)
+ endif
+ endif
+ ifneq ($(filter gtxwc, $(LIBS)),)
+ SYSLIBS += X11
+ # SYSLIBPATHS += /usr/X11R6/lib64
+ SYSLIBPATHS += /usr/X11R6/lib
+ endif
+ ifneq ($(filter -DHB_PCRE_REGEX, $(HB_USER_CFLAGS)),)
+ SYSLIBS += pcre
+ endif
+ ifneq ($(filter -DHB_EXT_ZLIB, $(HB_USER_CFLAGS)),)
+ SYSLIBS += z
+ endif
+endif
+
+SYSLIBS += m
diff --git a/harbour/config/dos/djgpp.mk b/harbour/config/dos/djgpp.mk
index c42e4e8b51..465436243f 100644
--- a/harbour/config/dos/djgpp.mk
+++ b/harbour/config/dos/djgpp.mk
@@ -2,19 +2,6 @@
# $Id$
#
-# NOTE: We do need DJGPP build of GNU Make on Windows
-# systems. The reason is that this uses special
-# trick to pass command lines to other DJGPP tools
-# (like gcc) to overcome 126 chars MS-DOS command
-# line length limitation. IOW: mingw32-make.exe
-# won't work with DJGPP on Windows hosts.
-# [vszakats]
-ifeq ($(HB_HOST_PLAT),win)
- ifneq ($(HB_MAKE_PLAT),dos)
- $(error ! Error: You must use DJGPP provided GNU Make on Windows hosts)
- endif
-endif
-
ifeq ($(HB_BUILD_MODE),cpp)
HB_CMP := gpp
else
diff --git a/harbour/config/dyn.mk b/harbour/config/dyn.mk
index abbedcb679..e87c3fdfd2 100644
--- a/harbour/config/dyn.mk
+++ b/harbour/config/dyn.mk
@@ -7,6 +7,7 @@ include $(TOP)$(ROOT)config/global.mk
ifneq ($(HB_PLATFORM),)
ifneq ($(HB_COMPILER),)
+-include $(TOP)$(ROOT)config/$(HB_PLATFORM)/libs.mk
include $(TOP)$(ROOT)config/$(HB_PLATFORM)/$(HB_COMPILER).mk
include $(TOP)$(ROOT)config/c.mk
include $(TOP)$(ROOT)config/prg.mk
diff --git a/harbour/config/global.mk b/harbour/config/global.mk
index b644d2b575..2c5b9bc92c 100644
--- a/harbour/config/global.mk
+++ b/harbour/config/global.mk
@@ -960,7 +960,20 @@ else
endif
ifeq ($(HB_INIT_DONE),)
- ifneq ($(HB_COMPILER),djgpp)
+ ifeq ($(HB_COMPILER),djgpp)
+ # NOTE: We do need DJGPP build of GNU Make on Windows
+ # systems. The reason is that this uses special
+ # trick to pass command lines to other DJGPP tools
+ # (like gcc) to overcome 126 chars MS-DOS command
+ # line length limitation. IOW: mingw32-make.exe
+ # won't work with DJGPP on Windows hosts.
+ # [vszakats]
+ ifeq ($(HB_HOST_PLAT),win)
+ ifneq ($(HB_MAKE_PLAT),dos)
+ $(warning ! Warning: You should use DJGPP provided MS-DOS GNU Make on Windows hosts)
+ endif
+ endif
+ else
ifeq ($(HB_HOST_PLAT)-$(HB_MAKE_PLAT),win-dos)
$(warning ! Warning: You're using MS-DOS GNU Make executable on Windows host.)
$(warning ! Not recommended combination. Some features will be disabled.)
diff --git a/harbour/config/hpux/gcc.mk b/harbour/config/hpux/gcc.mk
index f13d8cae13..937792dfc8 100644
--- a/harbour/config/hpux/gcc.mk
+++ b/harbour/config/hpux/gcc.mk
@@ -41,40 +41,10 @@ endif
LD := $(HB_CCACHE) $(HB_CCPREFIX)$(HB_CMP)$(HB_CCPOSTFIX)
LD_OUT := -o
-LIBPATHS := -L$(LIB_DIR)
-LDLIBS := $(foreach lib,$(LIBS),-l$(lib))
+LIBPATHS := $(LIB_DIR)
-ifneq ($(filter hbrtl, $(LIBS)),)
- # Add the specified GT driver library
- ifneq ($(filter gtcrs, $(LIBS)),)
- ifeq ($(HB_CRS_LIB),)
- HB_CRS_LIB := ncurses
- endif
- LDLIBS += -l$(HB_CRS_LIB)
- endif
- ifneq ($(filter gtsln, $(LIBS)),)
- LDLIBS += -lslang
- endif
- ifneq ($(filter gtxwc, $(LIBS)),)
- LDLIBS += -lX11
- #LIBPATHS += -L/usr/X11R6/lib64
- LIBPATHS += -L/usr/X11R6/lib
- endif
-
- ifneq ($(filter -DHB_PCRE_REGEX, $(HB_USER_CFLAGS)),)
- LDLIBS += -lpcre
- endif
-
- ifneq ($(filter -DHB_EXT_ZLIB, $(HB_USER_CFLAGS)),)
- LDLIBS += -lz
- endif
-
- LDLIBS += -lrt
-endif
-
-LDLIBS += -lm
-
-LDFLAGS += $(LIBPATHS)
+LDLIBS := $(foreach lib,$(LIBS) $(SYSLIBS),-l$(lib))
+LDFLAGS += $(foreach dir,$(LIBPATHS) $(SYSLIBPATHS),-L$(dir))
AR := $(HB_CCPREFIX)ar
ARFLAGS :=
diff --git a/harbour/config/hpux/libs.mk b/harbour/config/hpux/libs.mk
new file mode 100644
index 0000000000..60dd556f71
--- /dev/null
+++ b/harbour/config/hpux/libs.mk
@@ -0,0 +1,32 @@
+#
+# $Id$
+#
+
+SYSLIBS :=
+SYSLIBPATHS :=
+
+ifneq ($(filter hbrtl, $(LIBS)),)
+ ifeq ($(HB_CRS_LIB),)
+ HB_CRS_LIB := ncurses
+ endif
+ ifneq ($(filter gtcrs, $(LIBS)),)
+ SYSLIBS += $(HB_CRS_LIB)
+ endif
+ ifneq ($(filter gtsln, $(LIBS)),)
+ SYSLIBS += slang
+ endif
+ ifneq ($(filter gtxwc, $(LIBS)),)
+ SYSLIBS += X11
+ # SYSLIBPATHS += /usr/X11R6/lib64
+ SYSLIBPATHS += /usr/X11R6/lib
+ endif
+ ifneq ($(filter -DHB_PCRE_REGEX, $(HB_USER_CFLAGS)),)
+ SYSLIBS += pcre
+ endif
+ ifneq ($(filter -DHB_EXT_ZLIB, $(HB_USER_CFLAGS)),)
+ SYSLIBS += z
+ endif
+ SYSLIBS += rt
+endif
+
+SYSLIBS += m
diff --git a/harbour/config/linux/global.mk b/harbour/config/linux/global.mk
index bc80e74e21..6f963cad3b 100644
--- a/harbour/config/linux/global.mk
+++ b/harbour/config/linux/global.mk
@@ -26,35 +26,3 @@ ifeq ($(HB_SHELL),sh)
endif
endif
endif
-
-SYSLIBS :=
-SYSLIBPATHS :=
-
-ifneq ($(filter hbrtl, $(LIBS)),)
- ifeq ($(HB_CRS_LIB),)
- HB_CRS_LIB := ncurses
- endif
- ifneq ($(filter gtcrs, $(LIBS)),)
- SYSLIBS += $(HB_CRS_LIB)
- endif
- ifneq ($(filter gtsln, $(LIBS)),)
- SYSLIBS += slang
- endif
- ifneq ($(filter gtxwc, $(LIBS)),)
- SYSLIBS += X11
- # SYSLIBPATHS += /usr/X11R6/lib64
- SYSLIBPATHS += /usr/X11R6/lib
- endif
- ifeq ($(HB_GPM_MOUSE),yes)
- SYSLIBS += gpm
- endif
- ifneq ($(filter -DHB_PCRE_REGEX, $(HB_USER_CFLAGS)),)
- SYSLIBS += pcre
- endif
- ifneq ($(filter -DHB_EXT_ZLIB, $(HB_USER_CFLAGS)),)
- SYSLIBS += z
- endif
- SYSLIBS += rt dl
-endif
-
-SYSLIBS += m
diff --git a/harbour/config/linux/libs.mk b/harbour/config/linux/libs.mk
new file mode 100644
index 0000000000..0641200bc1
--- /dev/null
+++ b/harbour/config/linux/libs.mk
@@ -0,0 +1,58 @@
+#
+# $Id$
+#
+
+BIN_EXT :=
+DYN_EXT := .so
+DYN_PREF := lib
+
+HB_GT_LIBS += gttrm
+
+ifeq ($(HB_SHELL),sh)
+ ifneq ($(filter $(HB_COMPILER),gcc icc),)
+ ifeq ($(filter -fPIC,$(HB_USER_CFLAGS)),)
+ ifeq ($(filter -fpic,$(HB_USER_CFLAGS)),)
+ _UNAME_M := $(shell uname -m)
+ ifeq ($(findstring 86,$(_UNAME_M)),)
+ HB_CFLAGS += -fPIC
+ else
+ ifneq ($(findstring 64,$(_UNAME_M)),)
+ HB_CFLAGS += -fPIC
+ endif
+ endif
+ endif
+ endif
+ endif
+endif
+
+SYSLIBS :=
+SYSLIBPATHS :=
+
+ifneq ($(filter hbrtl, $(LIBS)),)
+ ifeq ($(HB_CRS_LIB),)
+ HB_CRS_LIB := ncurses
+ endif
+ ifneq ($(filter gtcrs, $(LIBS)),)
+ SYSLIBS += $(HB_CRS_LIB)
+ endif
+ ifneq ($(filter gtsln, $(LIBS)),)
+ SYSLIBS += slang
+ endif
+ ifneq ($(filter gtxwc, $(LIBS)),)
+ SYSLIBS += X11
+ # SYSLIBPATHS += /usr/X11R6/lib64
+ SYSLIBPATHS += /usr/X11R6/lib
+ endif
+ ifeq ($(HB_GPM_MOUSE),yes)
+ SYSLIBS += gpm
+ endif
+ ifneq ($(filter -DHB_PCRE_REGEX, $(HB_USER_CFLAGS)),)
+ SYSLIBS += pcre
+ endif
+ ifneq ($(filter -DHB_EXT_ZLIB, $(HB_USER_CFLAGS)),)
+ SYSLIBS += z
+ endif
+ SYSLIBS += rt dl
+endif
+
+SYSLIBS += m
diff --git a/harbour/config/sunos/gcc.mk b/harbour/config/sunos/gcc.mk
index 6032324477..1687da8ac4 100644
--- a/harbour/config/sunos/gcc.mk
+++ b/harbour/config/sunos/gcc.mk
@@ -39,40 +39,10 @@ endif
LD := $(HB_CCACHE) $(HB_CCPREFIX)$(HB_CMP)$(HB_CCPOSTFIX)
LD_OUT := -o
-LIBPATHS := -L$(LIB_DIR)
-LDLIBS := $(foreach lib,$(LIBS),-l$(lib))
+LIBPATHS := $(LIB_DIR)
-ifneq ($(filter hbrtl, $(LIBS)),)
- # Add the specified GT driver library
- ifneq ($(filter gtcrs, $(LIBS)),)
- ifeq ($(HB_CRS_LIB),)
- HB_CRS_LIB := curses
- endif
- LDLIBS += -l$(HB_CRS_LIB)
- endif
- ifneq ($(filter gtsln, $(LIBS)),)
- LDLIBS += -lslang
- endif
- ifneq ($(filter gtxwc, $(LIBS)),)
- LDLIBS += -lX11
- #LIBPATHS += -L/usr/X11R6/lib64
- LIBPATHS += -L/usr/X11R6/lib
- endif
-
- ifneq ($(filter -DHB_PCRE_REGEX, $(HB_USER_CFLAGS)),)
- LDLIBS += -lpcre
- endif
-
- ifneq ($(filter -DHB_EXT_ZLIB, $(HB_USER_CFLAGS)),)
- LDLIBS += -lz
- endif
-
- LDLIBS += -lrt -lsocket -lnsl -lresolv
-endif
-
-LDLIBS += -lm
-
-LDFLAGS += $(LIBPATHS)
+LDLIBS := $(foreach lib,$(LIBS) $(SYSLIBS),-l$(lib))
+LDFLAGS += $(foreach dir,$(LIBPATHS) $(SYSLIBPATHS),-L$(dir))
AR := $(HB_CCPREFIX)ar
ARFLAGS :=
diff --git a/harbour/config/sunos/libs.mk b/harbour/config/sunos/libs.mk
new file mode 100644
index 0000000000..59d7dfc01b
--- /dev/null
+++ b/harbour/config/sunos/libs.mk
@@ -0,0 +1,32 @@
+#
+# $Id$
+#
+
+SYSLIBS :=
+SYSLIBPATHS :=
+
+ifneq ($(filter hbrtl, $(LIBS)),)
+ ifeq ($(HB_CRS_LIB),)
+ HB_CRS_LIB := curses
+ endif
+ ifneq ($(filter gtcrs, $(LIBS)),)
+ SYSLIBS += $(HB_CRS_LIB)
+ endif
+ ifneq ($(filter gtsln, $(LIBS)),)
+ SYSLIBS += slang
+ endif
+ ifneq ($(filter gtxwc, $(LIBS)),)
+ SYSLIBS += X11
+ # SYSLIBPATHS += /usr/X11R6/lib64
+ SYSLIBPATHS += /usr/X11R6/lib
+ endif
+ ifneq ($(filter -DHB_PCRE_REGEX, $(HB_USER_CFLAGS)),)
+ SYSLIBS += pcre
+ endif
+ ifneq ($(filter -DHB_EXT_ZLIB, $(HB_USER_CFLAGS)),)
+ SYSLIBS += z
+ endif
+ SYSLIBS += rt socket nsl resolv
+endif
+
+SYSLIBS += m
diff --git a/harbour/config/sunos/sunpro.mk b/harbour/config/sunos/sunpro.mk
index 09997ae40e..cd449b77ee 100644
--- a/harbour/config/sunos/sunpro.mk
+++ b/harbour/config/sunos/sunpro.mk
@@ -68,39 +68,10 @@ endif
LD := $(HB_CCACHE) $(HB_CCPREFIX)$(HB_CMP)
LD_OUT := -o$(subst x,x, )
-LIBPATHS := -L$(LIB_DIR)
-LDLIBS := $(foreach lib,$(LIBS),-l$(lib))
+LIBPATHS := $(LIB_DIR)
-ifneq ($(filter hbrtl, $(LIBS)),)
- # Add the specified GT driver library
- ifneq ($(filter gtcrs, $(LIBS)),)
- ifeq ($(HB_CRS_LIB),)
- HB_CRS_LIB := curses
- endif
- LDLIBS += -l$(HB_CRS_LIB)
- endif
- ifneq ($(filter gtsln, $(LIBS)),)
- LDLIBS += -lslang
- endif
- ifneq ($(filter gtxwc, $(LIBS)),)
- LDLIBS += -lX11
- LIBPATHS += -L/usr/X11R6/lib
- endif
-
- ifneq ($(filter -DHB_PCRE_REGEX, $(HB_USER_CFLAGS)),)
- LDLIBS += -lpcre
- endif
-
- ifneq ($(filter -DHB_EXT_ZLIB, $(HB_USER_CFLAGS)),)
- LDLIBS += -lz
- endif
-
- LDLIBS += -lrt -lsocket -lnsl -lresolv
-endif
-
-LDLIBS += -lm
-
-LDFLAGS += $(LIBPATHS)
+LDLIBS := $(foreach lib,$(LIBS) $(SYSLIBS),-l$(lib))
+LDFLAGS += $(foreach dir,$(LIBPATHS) $(SYSLIBPATHS),-L$(dir))
AR := ar
ARFLAGS :=