From 830dbfd69cc65de940270cb7dec29beb8e555c65 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sat, 12 Sep 2009 09:01:27 +0000 Subject: [PATCH] 2009-09-12 11:00 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * INSTALL + Minor tuning here and there. * external/libhpdf/Makefile + Enabled libpng detection on darwin. * config/linux/icc.mk * config/linux/sunpro.mk + Implemented PIC compilation phase. * config/linux/global.mk * Deleted hacks dealing with PIC. Notice that now we use -fpic on gcc/icc, while it was previously set to -fPIC. The old hacks enabled PIC only for Intel x86/x86_64 ABIs, which is now removed. Pls speak up if we need to readd them on compiler level. This way it'd be possible to optimize out second compilation pass for ABIs which don't need special PIC code generation. To make this useful in a generic way, IMO we should fix ABI (CPU) HB_HOST_CPU/HB_CPU detection in global.mk for *nix systems, and do compiler level decisions based on HB_CPU value. * config/linux/gcc.mk * Minor option reordering. --- harbour/ChangeLog | 27 +++++++++++++++++++++++++++ harbour/INSTALL | 20 +++++++++----------- harbour/config/linux/gcc.mk | 2 +- harbour/config/linux/global.mk | 17 ----------------- harbour/config/linux/icc.mk | 8 +++----- harbour/config/linux/sunpro.mk | 9 +++------ harbour/external/libhpdf/Makefile | 2 +- 7 files changed, 44 insertions(+), 41 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 1c5b9c1055..7b334903dc 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,33 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-09-12 11:00 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * INSTALL + + Minor tuning here and there. + + * external/libhpdf/Makefile + + Enabled libpng detection on darwin. + + * config/linux/icc.mk + * config/linux/sunpro.mk + + Implemented PIC compilation phase. + + * config/linux/global.mk + * Deleted hacks dealing with PIC. Notice that now + we use -fpic on gcc/icc, while it was previously + set to -fPIC. The old hacks enabled PIC only for + Intel x86/x86_64 ABIs, which is now removed. Pls + speak up if we need to readd them on compiler + level. This way it'd be possible to optimize out second + compilation pass for ABIs which don't need special + PIC code generation. To make this useful in a generic + way, IMO we should fix ABI (CPU) HB_HOST_CPU/HB_CPU + detection in global.mk for *nix systems, and do + compiler level decisions based on HB_CPU value. + + * config/linux/gcc.mk + * Minor option reordering. + 2009-09-12 01:15 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * config/linux/gcc.mk + Enabled separate -fpic (with lowercase as a start) compilation diff --git a/harbour/INSTALL b/harbour/INSTALL index 90f25b937c..c240041e5e 100644 --- a/harbour/INSTALL +++ b/harbour/INSTALL @@ -110,8 +110,7 @@ HOW TO BUILD AND INSTALL HARBOUR FROM SOURCE -------------- (possible cross-build targets: Windows, Windows CE, MS-DOS, OS/2) - [ $ export HB_PLATFORM=<...> ] - $ make install + $ make install [HB_PLATFORM=<...>] To test it, type: $ cd tests @@ -123,10 +122,9 @@ HOW TO BUILD AND INSTALL HARBOUR FROM SOURCE -------------------------------------- (possible cross-build targets: Windows, Windows CE, MS-DOS) - [ $ export HB_PLATFORM=<...> ] - $ gmake install + $ gmake install [HB_PLATFORM=<...>] OR - $ make install + $ make install [HB_PLATFORM=<...>] To test it, type: $ cd tests @@ -216,18 +214,18 @@ HOW TO ENABLE OPTIONAL COMPONENTS BEFORE BUILD HB_INC_GD=C:\gd\include HB_INC_GPM= (on Linux only) HB_INC_LIBHARU=C:\libharu\include (defaults to locally hosted version) - HB_INC_LIBPNG=C:\libpng (defaults to locally hosted version on win/dos/os2) + HB_INC_LIBPNG=C:\libpng (defaults to locally hosted version if not found) HB_INC_MYSQL=C:\mysql\include HB_INC_ODBC= (may only be needed on non-Windows systems) HB_INC_OPENSSL=C:\openssl\inc32 OR C:\openssl\include - HB_INC_PCRE=C:\pcre (defaults to locally hosted version on win/dos/os2) - HB_INC_PNG= (defaults to locally hosted version on non-*nix and Darwin systems) + HB_INC_PCRE=C:\pcre (defaults to locally hosted version if not found) + HB_INC_PNG= (defaults to locally hosted version if not found) HB_INC_PGSQL=C:\pgsql\include HB_INC_QT=C:\Qt\include HB_INC_SLANG= (on *nix systems) - HB_INC_SQLITE3=C:\sqlite3 (defaults to locally hosted version on win/dos/os2) + HB_INC_SQLITE3=C:\sqlite3 (defaults to locally hosted version if not found) HB_INC_X11= (on *nix systems) - HB_INC_ZLIB=C:\zlib (defaults to locally hosted version on win/dos/os2) + HB_INC_ZLIB=C:\zlib (defaults to locally hosted version if not found) HB_INC_WATT= (on MS-DOS systems) To explicitly disable any given components, use the value 'no' (without @@ -252,7 +250,7 @@ HOW TO ENABLE OPTIONAL COMPONENTS BEFORE BUILD Darwin (Mac OS X) ----------------- 1.) Install MacPorts, follow their instructions: - http://www.macports.org/ + https://www.macports.org/ 2.) sudo port install pcre slang allegro freeimage gd2 mysql5-devel postgresql84 Linux (generic) diff --git a/harbour/config/linux/gcc.mk b/harbour/config/linux/gcc.mk index 2bddef02b7..50b320448c 100644 --- a/harbour/config/linux/gcc.mk +++ b/harbour/config/linux/gcc.mk @@ -12,7 +12,7 @@ OBJ_EXT := .o LIB_PREF := lib LIB_EXT := .a -HB_DYN_COPT := -fpic -DHB_DYNLIB +HB_DYN_COPT := -DHB_DYNLIB -fpic CC := $(HB_CCACHE) $(HB_CCPREFIX)$(HB_CMP)$(HB_CCPOSTFIX) CC_IN := -c diff --git a/harbour/config/linux/global.mk b/harbour/config/linux/global.mk index 6f963cad3b..7ddbb3215e 100644 --- a/harbour/config/linux/global.mk +++ b/harbour/config/linux/global.mk @@ -9,20 +9,3 @@ 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 diff --git a/harbour/config/linux/icc.mk b/harbour/config/linux/icc.mk index 4fb1354d54..f3ff1bd92d 100644 --- a/harbour/config/linux/icc.mk +++ b/harbour/config/linux/icc.mk @@ -12,6 +12,8 @@ OBJ_EXT := .o LIB_PREF := lib LIB_EXT := .a +HB_DYN_COPT := -DHB_DYNLIB -fpic + CC := $(HB_CCACHE) $(HB_CMP) CC_IN := -c CC_OUT := -o @@ -33,10 +35,6 @@ ifneq ($(HB_BUILD_OPTIM),no) CFLAGS += -O3 endif -# uncomment this if you want to force relocateable code for .so libs -# it's necessary on some platforms but can reduce performance -#CFLAGS += -fPIC - ifeq ($(HB_BUILD_DEBUG),yes) CFLAGS += -g endif @@ -54,7 +52,7 @@ ARFLAGS := AR_RULE = $(AR) $(ARFLAGS) $(HB_USER_AFLAGS) rcs $(LIB_DIR)/$@ $(^F) || ( $(RM) $(LIB_DIR)/$@ && false ) DY := $(CC) -DFLAGS := -shared -fPIC $(LIBPATHS) +DFLAGS := -shared $(LIBPATHS) DY_OUT := -o$(subst x,x, ) DLIBS := $(foreach lib,$(SYSLIBS),-l$(lib)) diff --git a/harbour/config/linux/sunpro.mk b/harbour/config/linux/sunpro.mk index ee77bd2f75..c7345eeaec 100644 --- a/harbour/config/linux/sunpro.mk +++ b/harbour/config/linux/sunpro.mk @@ -12,6 +12,8 @@ OBJ_EXT := .o LIB_PREF := lib LIB_EXT := .a +HB_DYN_COPT := -DHB_DYNLIB -KPIC + CC := $(HB_CCACHE) $(HB_CCPATH)$(HB_CCPREFIX)$(HB_CMP)$(HB_CCPOSTFIX) CC_IN := -c # NOTE: The ending space after -o is important, please preserve it. @@ -37,11 +39,6 @@ ifneq ($(HB_BUILD_OPTIM),no) CFLAGS += -xnolibmopt endif -# force position independent code for harbour shared library -# it's not optimal but without support for compilation in two passes -# we have to use this option also for static libraries and binaries -CFLAGS += -KPIC - export HB_ISAOPT CFLAGS += $(HB_ISAOPT) @@ -70,7 +67,7 @@ ARFLAGS := AR_RULE = $(AR) $(ARFLAGS) $(HB_USER_AFLAGS) rcs $(LIB_DIR)/$@ $(^F) || ( $(RM) $(LIB_DIR)/$@ && false ) DY := $(CC) -DFLAGS := -G -KPIC $(HB_ISAOPT) $(LIBPATHS) +DFLAGS := -G $(HB_ISAOPT) $(LIBPATHS) ifneq ($(HB_BUILD_OPTIM),no) DFLAGS += -fast -xnolibmopt endif diff --git a/harbour/external/libhpdf/Makefile b/harbour/external/libhpdf/Makefile index 02d8a586b0..ac4cd62ebb 100644 --- a/harbour/external/libhpdf/Makefile +++ b/harbour/external/libhpdf/Makefile @@ -99,7 +99,7 @@ ifeq ($(HB_SUPPORTED),yes) _DET_VAR_HAS_ := HB_HAS_PNG _DET_FLT_PLAT := _DET_FLT_COMP := - _DET_INC_DEFP := /usr/include + _DET_INC_DEFP := /usr/include /opt/local/include _DET_INC_LOCL := $(TOP)$(ROOT)external/libpng _DET_INC_HEAD := /png.h include $(TOP)$(ROOT)config/detfun.mk