diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 30e8931e11..8b6fddab89 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,21 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-02-19 16:44 UTC+0100 Viktor Szakats (harbour.01 syenar hu) + * utils/hbmk/hbmk2.prg + + Added object archive support for (currently) gcc compilers. + .a file are gathered like .o files, and they can be added + to the internal command line templates using the {OA} macro. + I've added these after {O} macros in gcc cmdlines. + (Przemek's request #9. Please review.) + * Minor internal change to system location detection. + + * harbour-win-spec + * harbour-wce-spec + * harbour.spec + * mpkg_tgz.sh + % Removed -r make flags. No longer needed. + 2009-02-19 15:37 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/vm/thread.c ! fixed yest another stupid typo in new OS2 conditional variable diff --git a/harbour/harbour-wce-spec b/harbour/harbour-wce-spec index 88452f7bf9..5333ed42e6 100644 --- a/harbour/harbour-wce-spec +++ b/harbour/harbour-wce-spec @@ -90,7 +90,7 @@ export HB_HOST_BUILD=yes export HB_ARCHITECTURE=linux export HB_COMPILER=gcc export HB_USER_CFLAGS="-O2 -DHB_FM_STATISTICS_OFF" -make -r +make export HB_HOST_BUILD=lib export HB_ARCHITECTURE=win @@ -117,7 +117,7 @@ export HB_INC_INSTALL=%{_includedir}/%{name} export HB_LIB_INSTALL=%{_libdir}/%{name} export HB_CONTRIBLIBS="gtwvg hbbmcdx hbbtree hbclipsm hbct hbgt hbmisc hbmzip hbtip hbvpdf hbwin hbziparc rddado xhb %{!?_without_nf:hbnf} %{?_with_odbc:hbodbc} %{?_with_curl:hbcurl} %{?_with_ads:rddads} %{?_with_gd:hbgd} %{?_with_pgsql:hbpgsql} %{?_with_mysql:hbmysql} %{?_with_allegro:gtalleg}" -make -r +make ###################################################################### ## Install. @@ -158,7 +158,7 @@ mkdir -p $HB_BIN_INSTALL mkdir -p $HB_INC_INSTALL mkdir -p $HB_LIB_INSTALL -make -r -i install +make -i install [ "%{?_with_odbc:1}" ] || rm -f $HB_LIB_INSTALL/libhbodbc.a [ "%{?_with_allegro:1}" ] || rm -f $HB_LIB_INSTALL/libgtalleg.a diff --git a/harbour/harbour-win-spec b/harbour/harbour-win-spec index 2eea181f4d..c750edd9ce 100644 --- a/harbour/harbour-win-spec +++ b/harbour/harbour-win-spec @@ -90,7 +90,7 @@ export HB_HOST_BUILD=yes export HB_ARCHITECTURE=linux export HB_COMPILER=gcc export HB_USER_CFLAGS="-O2 -DHB_FM_STATISTICS_OFF" -make -r +make export HB_HOST_BUILD=lib export HB_ARCHITECTURE=win @@ -117,7 +117,7 @@ export HB_INC_INSTALL=%{_includedir}/%{name} export HB_LIB_INSTALL=%{_libdir}/%{name} export HB_CONTRIBLIBS="gtwvg hbbmcdx hbbtree hbclipsm hbct hbgt hbmisc hbmzip hbtip hbvpdf hbwin hbziparc rddado xhb %{!?_without_nf:hbnf} %{?_with_odbc:hbodbc} %{?_with_curl:hbcurl} %{?_with_ads:rddads} %{?_with_gd:hbgd} %{?_with_pgsql:hbpgsql} %{?_with_mysql:hbmysql} %{?_with_allegro:gtalleg}" -make -r +make ###################################################################### ## Install. @@ -158,7 +158,7 @@ mkdir -p $HB_BIN_INSTALL mkdir -p $HB_INC_INSTALL mkdir -p $HB_LIB_INSTALL -make -r -i install +make -i install [ "%{?_with_odbc:1}" ] || rm -f $HB_LIB_INSTALL/libhbodbc.a [ "%{?_with_allegro:1}" ] || rm -f $HB_LIB_INSTALL/libgtalleg.a diff --git a/harbour/harbour.spec b/harbour/harbour.spec index 8ceb833a5c..2880a508df 100644 --- a/harbour/harbour.spec +++ b/harbour/harbour.spec @@ -384,7 +384,7 @@ case "`uname -m`" in ;; esac -make -r +make ###################################################################### ## Install. @@ -412,7 +412,7 @@ mkdir -p $HB_BIN_INSTALL mkdir -p $HB_INC_INSTALL mkdir -p $HB_LIB_INSTALL -make -r -i install +make -i install [ "%{?_with_allegro:1}" ] || rm -f $HB_LIB_INSTALL/libgtalleg.a [ "%{?_without_gtcrs:1}" ] && rm -f $HB_LIB_INSTALL/libgtcrs.a @@ -445,7 +445,7 @@ then do pushd utils/${utl} rm -fR "./${HB_ARCHITECTURE}/${HB_COMPILER}" - make -r install + make install strip ${HB_BIN_INSTALL}/${utl} popd done diff --git a/harbour/mpkg_tgz.sh b/harbour/mpkg_tgz.sh index df5c3774cc..d5d23687c7 100755 --- a/harbour/mpkg_tgz.sh +++ b/harbour/mpkg_tgz.sh @@ -205,13 +205,13 @@ fi # build umask 022 -$MAKE -r clean -$MAKE -r +$MAKE clean +$MAKE for l in ${hb_contrib} do (cd "contrib/$l" - $MAKE -r clean - $MAKE -r) + $MAKE clean + $MAKE ) done # install @@ -227,11 +227,11 @@ export HB_LIB_INSTALL="$HB_INST_PREF$HB_LIB_INSTALL" mkdir -p $HB_BIN_INSTALL mkdir -p $HB_INC_INSTALL mkdir -p $HB_LIB_INSTALL -$MAKE -r -i install +$MAKE -i install for l in ${hb_contrib} do (cd "contrib/$l" - $MAKE -r -i install) + $MAKE -i install) done # Keep the size of the binaries to a minimim. @@ -278,7 +278,7 @@ then do (cd "utils/${utl}" rm -fR "./${HB_ARCHITECTURE}/${HB_COMPILER}" - $MAKE -r install + $MAKE install ${CCPREFIX}strip "${HB_BIN_INSTALL}/${utl}${hb_exesuf}") done fi diff --git a/harbour/utils/hbmk/hbmk2.prg b/harbour/utils/hbmk/hbmk2.prg index 365e0d389b..7fbc6dfb6d 100644 --- a/harbour/utils/hbmk/hbmk2.prg +++ b/harbour/utils/hbmk/hbmk2.prg @@ -56,6 +56,7 @@ #include "hbgtinfo.ch" #include "hbver.ch" +/* TODO: Sync default switches with Harbour build systems. */ /* TODO: Add support for wildcarded input source. Only if only one source file is specified. */ /* TODO: Add support for more hbmk script features. */ /* TODO: Add support for Windows resource files. */ @@ -67,17 +68,12 @@ /* TODO: Support for more compilers/platforms. */ /* TODO: Cleanup on variable names. */ -/* + remove -n from default harbour switches ? */ +/* - remove -n from default harbour switches ? */ /* + 2. compiler autodetection for two kinds of dir layouts. */ /* * 7. output file name auto detection should respect the compilation mode, f.e. hbmk -cmp a.prg it should generate a.{o,obj} not 'a' or 'a.exe'. QUESTION: What to do for multiple .prgs? */ /* * 8. Stripping "lib" ".so/.dll/.a" ? */ -/* * 9. We should have support for passing object archives (.a) in - link file list and then pass it to GCC without -l parameter. - Using 'mylib.a' and '-lmylib' as GCC parameters has different - meaning so mylib.a should not be converted to -lmylib but simply - passed to GCC as is. */ ANNOUNCE HB_GTSYS REQUEST HB_GT_CGI_DEFAULT @@ -162,6 +158,7 @@ FUNCTION Main( ... ) LOCAL s_cPROGNAME LOCAL s_cMAPNAME LOCAL s_aOBJ + LOCAL s_aOBJA LOCAL s_aOBJUSER LOCAL s_aCLEAN @@ -419,8 +416,6 @@ FUNCTION Main( ... ) s_aLIBPATH := {} - lSysLoc := .F. - s_cHB_BIN_INSTALL := PathSepToTarget( GetEnv( "HB_BIN_INSTALL" ) ) s_cHB_LIB_INSTALL := PathSepToTarget( GetEnv( "HB_LIB_INSTALL" ) ) s_cHB_INC_INSTALL := PathSepToTarget( GetEnv( "HB_INC_INSTALL" ) ) @@ -431,16 +426,12 @@ FUNCTION Main( ... ) DO CASE CASE hb_DirBase() == "/opt/harbour/" - lSysLoc := .T. - s_cHB_INSTALL_PREFIX := "/opt/harbour" CASE hb_DirBase() == "/usr/local/bin/" .OR. ; hb_DirBase() == "/usr/bin/" .OR. ; hb_DirBase() == "/opt/bin/" - lSysLoc := .T. - tmp := Left( hb_DirBase(), Len( hb_DirBase() ) - Len( "bin/" ) ) IF Empty( s_cHB_BIN_INSTALL ) s_cHB_BIN_INSTALL := tmp + "bin" @@ -482,12 +473,19 @@ FUNCTION Main( ... ) s_cHB_INC_INSTALL := DirAddPathSep( s_cHB_INSTALL_PREFIX ) + "include" ENDIF - AAddNotEmpty( s_aLIBPATH, s_cHB_LIB_INSTALL ) + /* Detect system locations to enable shared library option by default */ + lSysLoc := hb_DirBase() == "/usr/local/bin/" .OR. ; + hb_DirBase() == "/usr/bin/" .OR. ; + hb_DirBase() == "/opt/harbour/" .OR. ; + hb_DirBase() == "/opt/bin/" IF t_lInfo OutStd( "hbmk: Using Harbour: " + s_cHB_BIN_INSTALL + " " + s_cHB_INC_INSTALL + " " + s_cHB_LIB_INSTALL + hb_osNewLine() ) ENDIF + /* Add main Harbour library dir to lib path list */ + AAddNotEmpty( s_aLIBPATH, s_cHB_LIB_INSTALL ) + /* Build with shared libs by default, if we're installed to default system locations. */ IF lSysLoc .AND. ( t_cARCH $ "bsd|hpux|sunos|linux" .OR. t_cARCH == "darwin" ) @@ -519,6 +517,7 @@ FUNCTION Main( ... ) s_aRESCMP := {} s_aLIBUSER := {} s_aOBJUSER := {} + s_aOBJA := {} s_cPROGDIR := NIL s_cPROGNAME := NIL @@ -650,15 +649,16 @@ FUNCTION Main( ... ) CASE Lower( FN_ExtGet( cParam ) ) == ".prg" ; AAdd( s_aPRG , PathSepToTarget( cParam ) ) ; DEFAULT s_cPROGNAME TO PathSepToSelf( cParam ) CASE Lower( FN_ExtGet( cParam ) ) == ".rc" ; AAdd( s_aRESSRC , PathSepToTarget( cParam ) ) CASE Lower( FN_ExtGet( cParam ) ) == ".res" ; AAdd( s_aRESCMP , PathSepToTarget( cParam ) ) + CASE Lower( FN_ExtGet( cParam ) ) == ".a" ; AAdd( s_aOBJA , PathSepToTarget( cParam ) ) CASE Lower( FN_ExtGet( cParam ) ) $ ".o|.obj" ; AAdd( s_aOBJUSER, PathSepToTarget( cParam ) ) ; DEFAULT s_cPROGNAME TO PathSepToSelf( cParam ) CASE Lower( FN_ExtGet( cParam ) ) $ ".c|.cpp" ; AAdd( s_aC , PathSepToTarget( cParam ) ) ; DEFAULT s_cPROGNAME TO PathSepToSelf( cParam ) - CASE Lower( FN_ExtGet( cParam ) ) $ ".a|.lib" ; AAddNotEmpty( s_aLIBUSER, PathSepToTarget( ArchCompFilter( cParam ) ) ) + CASE Lower( FN_ExtGet( cParam ) ) $ ".lib" ; AAddNotEmpty( s_aLIBUSER, PathSepToTarget( ArchCompFilter( cParam ) ) ) OTHERWISE ; AAdd( s_aPRG , PathSepToTarget( cParam ) ) ; DEFAULT s_cPROGNAME TO PathSepToSelf( cParam ) ENDCASE NEXT /* Start doing the make process. */ - IF ( Len( s_aPRG ) + Len( s_aC ) + Len( s_aOBJUSER ) ) == 0 + IF ( Len( s_aPRG ) + Len( s_aC ) + Len( s_aOBJUSER ) + Len( s_aOBJA ) ) == 0 OutErr( "hbmk: Error: No source files were specified." + hb_osNewLine() ) PauseForKey() RETURN 4 @@ -750,6 +750,7 @@ FUNCTION Main( ... ) {C} list of C files, {O} list of object files, + {OA} list of object archive (.a) files, {L} list of lib files, {OPTC} C compiler flags (user + automatic), {OPTL} linker flags (user + automatic), @@ -785,7 +786,7 @@ FUNCTION Main( ... ) cLibExt := NIL cObjExt := ".o" cBin_CompC := iif( t_cCOMP == "gpp", "g++", "gcc" ) - cOpt_CompC := "{C} {O} -O3 -o{E} {OPTC} -I{I} {A}" + cOpt_CompC := "{C} {O} {OA} -O3 -o{E} {OPTC} -I{I} {A}" cLibPathPrefix := "-L" cLibPathSep := " " IF t_cARCH == "linux" @@ -821,7 +822,7 @@ FUNCTION Main( ... ) cLibExt := NIL cObjExt := ".o" cBin_CompC := "gcc" - cOpt_CompC := "{C} {O} -O3 -o{E} {OPTC} -I{I} {A}" + cOpt_CompC := "{C} {O} {OA} -O3 -o{E} {OPTC} -I{I} {A}" cLibPathPrefix := "-L" cLibPathSep := " " IF s_lMAP @@ -856,7 +857,7 @@ FUNCTION Main( ... ) cLibExt := NIL cObjExt := ".o" cBin_CompC := "gcc" - cOpt_CompC := "{C} {O} -O3 -o{E} {OPTC} -I{I} {A}{SCRIPT}" + cOpt_CompC := "{C} {O} {OA} -O3 -o{E} {OPTC} -I{I} {A}{SCRIPT}" cLibPathPrefix := "-L" cLibPathSep := " " IF t_cCOMP == "rsx32" @@ -1103,7 +1104,7 @@ FUNCTION Main( ... ) nErrorLevel := 0 - IF ( Len( s_aPRG ) + Len( s_aC ) + iif( Empty( cBin_Link ), Len( s_aOBJUSER ), 0 ) ) > 0 + IF ( Len( s_aPRG ) + Len( s_aC ) + iif( Empty( cBin_Link ), Len( s_aOBJUSER ) + Len( s_aOBJA ), 0 ) ) > 0 IF ! Empty( cBin_CompC ) @@ -1111,6 +1112,7 @@ FUNCTION Main( ... ) cOpt_CompC := StrTran( cOpt_CompC, "{C}" , ArrayToList( ArrayJoin( ListCook( s_aPRG, NIL, ".c" ), s_aC ) ) ) cOpt_CompC := StrTran( cOpt_CompC, "{O}" , ArrayToList( ListCook( s_aOBJUSER, cObjPrefix ) ) ) + cOpt_CompC := StrTran( cOpt_CompC, "{OA}" , ArrayToList( s_aOBJA ) ) cOpt_CompC := StrTran( cOpt_CompC, "{L}" , ArrayToList( s_aLIB ) ) cOpt_CompC := StrTran( cOpt_CompC, "{OPTC}", iif( s_lBLDFLGC, hb_Version( HB_VERSION_FLAG_C ) + " ", "" ) +; GetEnv( "HB_USER_CFLAGS" ) + " " + ArrayToList( s_aOPTC ) ) @@ -1158,11 +1160,12 @@ FUNCTION Main( ... ) ENDIF ENDIF - IF nErrorLevel == 0 .AND. ! lStopAfterCComp .AND. ( Len( s_aOBJ ) + Len( s_aOBJUSER ) ) > 0 .AND. ! Empty( cBin_Link ) + IF nErrorLevel == 0 .AND. ! lStopAfterCComp .AND. ( Len( s_aOBJ ) + Len( s_aOBJUSER ) + Len( s_aOBJA ) ) > 0 .AND. ! Empty( cBin_Link ) /* Linking */ cOpt_Link := StrTran( cOpt_Link, "{O}" , ArrayToList( ListCook( ArrayJoin( s_aOBJ, s_aOBJUSER ), cObjPrefix ) ) ) + cOpt_Link := StrTran( cOpt_Link, "{OA}" , ArrayToList( s_aOBJA ) ) cOpt_Link := StrTran( cOpt_Link, "{L}" , ArrayToList( s_aLIB ) ) cOpt_Link := StrTran( cOpt_Link, "{OPTL}", iif( s_lBLDFLGL, hb_Version( HB_VERSION_FLAG_LINKER ) + " ", "" ) +; GetEnv( "HB_USER_LDFLAGS" ) + " " + ArrayToList( s_aOPTL ) )