Files
harbour-core/harbour/contrib/makefile.hbs
Viktor Szakats 4b671e29a3 2010-07-05 03:39 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* utils/hbmk2/hbmk2.pt_BR.po
  * utils/hbmk2/hbmk2.hu_HU.po
  * utils/hbmk2/hbmk2.prg
    + Added -instfile= option, instfiles= .hbc option and hbmk2 plugin
      API to add new files to the list of files to be copied to
      -instpath= targets. This option makes it possible to install
      extra files along the target lib or exe itself, f.e. headers
      or other supplementary files. This option only works for
      -instpath= options which point to a dir (not a file).

  * contrib/gtwvg/gtwvg.hbp
  * contrib/hbblat/hbblat.hbp
  * contrib/hbblink/hbblink.hbp
  * contrib/hbbz2/hbbz2.hbp
  * contrib/hbcairo/hbcairo.hbp
  * contrib/hbclipsm/hbclipsm.hbp
  * contrib/hbct/hbct.hbp
  * contrib/hbcurl/hbcurl.hbp
  * contrib/hbfimage/hbfimage.hbp
  * contrib/hbfoxpro/hbfoxpro.hbp
  * contrib/hbgd/hbgd.hbp
  * contrib/hbhpdf/hbhpdf.hbp
  * contrib/hbmysql/hbmysql.hbp
  * contrib/hbmzip/hbmzip.hbp
  * contrib/hbnf/hbnf.hbp
  * contrib/hbodbc/hbodbc.hbp
  * contrib/hbpgsql/hbpgsql.hbp
  * contrib/hbqt/gtqtc/gtqtc.hbp
  * contrib/hbqt/hbqt.hbp
  * contrib/hbsqlit3/hbsqlit3.hbp
  * contrib/hbssl/hbssl.hbp
  * contrib/hbtip/hbtip.hbp
  * contrib/hbtpathy/hbtpathy.hbp
  * contrib/hbwin/hbwin.hbp
  * contrib/hbxbp/hbxbp.hbp
  * contrib/hbxpp/hbxpp.hbp
  * contrib/rddads/rddads.hbp
  * contrib/rddsql/rddsql.hbp
  * contrib/xhb/xhb.hbp
    + Added -instfile= options for headers installed by Makefile.
    ; TODO: Make copying of headers to central dir unnecessary on
            *nix platforms as well.

  * contrib/makefile.hbs
    * Updated TODOs.

  * contrib/hbqt/gtqtc/gtqtc.hbp
    % Deleted -pi= option.

  * contrib/hbqt/gtqtc/gtqtcs/Makefile
    * Not needed to install headers from secondary (static) Makefile.

  * examples/gfspell/gfspell.hbp
  * examples/gtwvw/gtwvw.hbp
  * examples/hbapollo/hbapollo.hbp
  * examples/hbbtree/hbbtree.hbp
  * examples/hbdoc2/hbdoc2.hbp
  * examples/hbextern/hbextern.hbp
  * examples/hbsqlit2/hbsqlit2.hbp
  * examples/hbvpdf/hbvpdf.hbp
  * examples/ps32/ps32.hbp
  * examples/rddado/rddado.hbp
  * examples/superlib/superlib.hbp
    + Added -instfile= options for headers installed by Makefile.
    + Added -w option where missing.
    - Deleted -q0, -l where present.
    + Synced output setup with contribs.
    ! Added hbxpp.hbc reference for ps32.
    + Added dependency detection for hbsqlit2, hbapollo.
    ! hbdoc2 GT changed to GTCGI.

  ; Now the contrib and examples .hbp files are completely on the same 
    feature level.
2010-07-05 01:42:08 +00:00

335 lines
11 KiB
Handlebars

/*
* $Id$
*/
/*
* This Harbour script is part of the GNU Make-based build system.
* WARNING: Running it separately is not supported.
*
* Copyright 2010 Viktor Szakats (harbour.01 syenar.hu)
* See COPYING for licensing terms.
*/
/* TODO:
1. error handling / reporting / feedback
2. add .dll generation for contrib libs
3. avoid long cmdlines to make ms-dos hosts happy
4. solve the automatic in-dir make clean/install/rebuild
workflow
*/
/* #pragma warninglevel=3 */
/* TOFIX: Ugly hack to avoid #include "directry.ch" */
#define F_NAME 1 /* File name */
#define F_ATTR 5 /* File attribute */
#define _PS_ hb_osPathSeparator()
STATIC s_lTest
PROCEDURE Main( ... )
LOCAL cBase := ""
LOCAL cRoot := "../"
LOCAL aImpLibs := {;
"gtalleg/gtalleg.hbi" ,;
"hbblat/hbblat.hbi" ,;
"hbcairo/hbcairo.hbi" ,;
"hbcurl/hbcurl.hbi" ,;
"hbfbird/hbfbird.hbi" ,;
"hbfimage/hbfimage.hbi" ,;
"hbgd/hbgd.hbi" ,;
"hbhpdf/hbhpdf.hbi" ,;
"hbmysql/hbmysql.hbi" ,;
"hbpgsql/hbpgsql.hbi" ,;
"hbssl/hbssl.hbi" ,;
"rddads/rddads.hbi" ,;
"sddfb/sddfb.hbi" ,;
"sddmy/sddmy.hbi" ,;
"sddoci/sddoci.hbi" ,;
"sddpg/sddpg.hbi" }
/* external libs hosted locally */
LOCAL aLibsPass0 := {}
LOCAL aLibsPass1 := {;
"hbblink/hbblink.hbp" ,;
"hbbz2/hbbz2.hbp" ,; /* uses: bz2 (external) */
"hbclipsm/hbclipsm.hbp" ,;
"hbcomm/hbcomm.hbp" ,;
"hbct/hbct.hbp" ,;
"hbfoxpro/hbfoxpro.hbp" ,;
"hbfship/hbfship.hbp" ,;
"hbgt/hbgt.hbp" ,;
"hbmemio/hbmemio.hbp" ,;
"hbmisc/hbmisc.hbp" ,;
"hbmzip/hbmzip.hbp" ,; /* uses: minizip (external) */
"hbnetio/hbnetio.hbp" ,;
"hbnf/hbnf.hbp" ,;
"hbodbc/hbodbc.hbp" ,;
"hbsms/hbsms.hbp" ,;
"hbsqlit3/hbsqlit3.hbp" ,; /* uses: sqlite3 (external) */
"hbtpathy/hbtpathy.hbp" ,;
"hbwin/hbwin.hbp" ,;
"hbxpp/hbxpp.hbp" ,;
"rddbmcdx/hbbmcdx.hbp" }
LOCAL aLibsPass2 := {;
"gtalleg/gtalleg.hbp" ,;
"gtalleg/gtallegs.hbp" ,;
"hbblat/hbblat.hbp" ,;
"hbcairo/hbcairo.hbp" ,;
"hbcups/hbcups.hbp" ,;
"hbcurl/hbcurl.hbp" ,;
"hbcurl/hbcurls.hbp" ,;
"hbfbird/hbfbird.hbp" ,;
"hbfimage/hbfimage.hbp" ,;
"hbgd/hbgd.hbp" ,; /* uses: hbct */
"hbhpdf/hbhpdf.hbp" ,;
"hbmysql/hbmysql.hbp" ,;
"hbpgsql/hbpgsql.hbp" ,;
"hbqt/hbqt.hbp" ,;
"hbqt/hbqtcore.hbp" ,;
"hbqt/hbqtcores.hbp" ,;
"hbqt/hbqtgui.hbp" ,;
"hbqt/hbqtguis.hbp" ,;
"hbqt/hbqtnetwork.hbp" ,;
"hbqt/hbqtnetworks.hbp" ,;
"hbqt/hbqts.hbp" ,;
"hbssl/hbssl.hbp" ,;
"hbssl/hbssls.hbp" ,;
"hbxbp/hbxbp.hbp" ,; /* uses: hbqt */
"rddads/rddads.hbp" ,;
"rddsql/rddsql.hbp" ,;
"sddfb/sddfb.hbp" ,; /* uses: rddsql */
"sddmy/sddmy.hbp" ,; /* uses: rddsql */
"sddoci/sddoci.hbp" ,; /* uses: rddsql */
"sddodbc/sddodbc.hbp" ,; /* uses: rddsql */
"sddpg/sddpg.hbp" ,; /* uses: rddsql */
"sddsqlt3/sddsqlt3.hbp" } /* uses: rddsql, sqlite3 (external) */
LOCAL aLibsPass3 := {;
"gtwvg/gtwvg.hbp" ,; /* uses: hbwin */
"hbtip/hbtip.hbp" ,;
"hbtip/hbtipssl.hbp" ,; /* uses: hbssl */
"hbziparc/hbziparc.hbp" ,; /* uses: hbmzip */
"xhb/xhb.hbp" } /* uses: hbct, hbtip, hbwin */
LOCAL aUtils := {;
"hbnetio/utils/hbnetio.hbp" ,; /* uses: hbnetio */
"hbide/hbide.hbp" } /* uses: hbxbp, hbqt */
LOCAL aAll
LOCAL hItem
LOCAL cProject
LOCAL cProjectDir
LOCAL cInstallDirVar
LOCAL cTargetDir
LOCAL cBaseOptions := ""
LOCAL cOptionsPre
LOCAL cOptionsPost
LOCAL lBuildName
LOCAL cFilter := GetEnv( "HB_CONTRIBLIBS" )
LOCAL aFilter
LOCAL lFilterNegative
LOCAL aParams := hb_AParams()
LOCAL tmp
s_lTest := AScan( aParams, "test" ) > 0
IF AScan( aParams, "migr" ) > 0
OutStd( "! New contrib make orchestrator test run." + iif( AScan( aParams, "clean" ) > 0, " CLEAN", "" ) + iif( AScan( aParams, "install" ) > 0, " INSTALL", "" ) + " " + hb_dirBase() + " " + CurDir() + hb_osNewLine() )
/* testing with a limited set of contribs */
aLibsPass1 := {;
"hbblink/hbblink.hbp" ,;
"hbclipsm/hbclipsm.hbp" ,;
"rddbmcdx/hbbmcdx.hbp" }
aLibsPass2 := {}
aLibsPass3 := {}
aUtils := {;
"hbnetio/utils/hbnetio.hbp" }
ENDIF
IF Empty( GetEnv( "HB_PLATFORM" ) ) .OR. ;
Empty( GetEnv( "HB_COMPILER" ) ) .OR. ;
Empty( GetEnv( "HB_HOST_BIN_DIR" ) )
ErrorLevel( 9 )
RETURN
ENDIF
IF cFilter == "no"
ErrorLevel( 0 )
RETURN
ENDIF
SetCancel( .F. )
/* Converting build options to hbmk2 options */
IF GetEnv( "HB_BUILD_MODE" ) == "cpp"
cBaseOptions += " -cpp=yes"
ELSEIF GetEnv( "HB_BUILD_MODE" ) == "c"
cBaseOptions += " -cpp=no"
ENDIF
IF GetEnv( "HB_BUILD_DEBUG" ) == "yes"
cBaseOptions += " -debug"
ENDIF
IF ! Empty( GetEnv( "HB_BUILD_NAME" ) )
cBaseOptions += " -build=" + GetEnv( "HB_BUILD_NAME" )
lBuildName := .T.
ELSE
lBuildName := .F.
ENDIF
FOR EACH tmp IN aParams
tmp := Lower( tmp )
NEXT
/* Parse filter */
aFilter := iif( Empty( cFilter ), {}, hb_ATokens( cFilter,, .T. ) )
IF Len( aFilter ) >= 1 .AND. aFilter[ 1 ] == "no"
hb_ADel( aFilter, 1, .T. )
lFilterNegative := .T.
ELSE
lFilterNegative := .F.
ENDIF
/* Start building */
aAll := {;
{ "type" => "implib", "list" => aImpLibs },;
{ "type" => "lib" , "list" => aLibsPass0 },;
{ "type" => "lib" , "list" => aLibsPass1 },;
{ "type" => "lib" , "list" => aLibsPass2 },;
{ "type" => "lib" , "list" => aLibsPass3 },;
{ "type" => "bin" , "list" => aUtils },;
{ "type" => "lib" , "list" => hb_ATokens( GetEnv( "HB_ADDONS_LIB" ),, .T. ) },;
{ "type" => "bin" , "list" => hb_ATokens( GetEnv( "HB_ADDONS_BIN" ),, .T. ) } }
FOR EACH hItem IN aAll
FOR EACH cProject IN hItem[ "list" ]
IF ! Empty( cProject )
cProject := StrTran( cProject, "\", "/" )
IF ( tmp := At( "/", cProject ) ) > 0
cProjectDir := Left( cProject, tmp - 1 )
ELSE
cProjectDir := ""
ENDIF
IF Empty( aFilter ) .OR. ;
iif( lFilterNegative,;
AScan( aFilter, {| tmp | tmp == cProjectDir } ) == 0,;
AScan( aFilter, {| tmp | tmp == cProjectDir } ) > 0 )
cOptionsPre := cBaseOptions
cOptionsPost := ""
SWITCH hItem[ "type" ]
CASE "lib"
CASE "implib"
cTargetDir := cRoot + "lib/${hb_plat}/${hb_comp}" + iif( lBuildName, "/${hb_build}", "" )
cInstallDirVar := "HB_LIB_INSTALL"
EXIT
CASE "bin"
cTargetDir := cRoot + "bin/${hb_plat}/${hb_comp}" + iif( lBuildName, "/${hb_build}", "" )
cInstallDirVar := "HB_BIN_INSTALL"
IF GetEnv( "HB_BUILD_SHARED" ) == "yes"
cOptionsPre += " -shared"
ENDIF
EXIT
ENDSWITCH
IF AScan( aParams, "clean" ) > 0
call_hbmk2( cBase + cProject, cTargetDir, cOptionsPre + " -clean", cOptionsPost )
ELSEIF AScan( aParams, "install" ) > 0
IF ! Empty( GetEnv( cInstallDirVar ) ) .AND. ;
( ! ( hItem[ "type" ] == "implib" ) .OR. GetEnv( "HB_BUILD_IMPLIB" ) == "yes" )
call_hbmk2( cBase + cProject, cTargetDir, cOptionsPre + " -inc -instpath=${" + cInstallDirVar + "}/", cOptionsPost )
ENDIF
ELSE
call_hbmk2( cBase + cProject, cTargetDir, cOptionsPre + " -inc", cOptionsPost )
ENDIF
/* Highly experimental */
IF hItem[ "type" ] == "lib" .AND. GetEnv( "HB_BUILD_CONTRIB_DLL" ) == "yes" .AND. ;
hb_FileExists( FN_ExtSet( cBase + cProject, ".hbc" ) )
cInstallDirVar := "HB_BIN_INSTALL"
/* TOFIX: Add -implib option. It collides with static lib so needs to be resolved. */
cOptionsPost := " -hbdyn -nohblib- -shared " + FN_ExtSet( cProject, ".hbc" )
IF AScan( aParams, "clean" ) > 0
call_hbmk2( cBase + cProject, cTargetDir, cOptionsPre + " -clean", cOptionsPost )
ELSEIF AScan( aParams, "install" ) > 0
IF ! Empty( GetEnv( cInstallDirVar ) ) .AND. ;
( ! ( hItem[ "type" ] == "implib" ) .OR. GetEnv( "HB_BUILD_IMPLIB" ) == "yes" )
call_hbmk2( cBase + cProject, cTargetDir, cOptionsPre + " -inc -instpath=${" + cInstallDirVar + "}/", cOptionsPost )
ENDIF
ELSE
call_hbmk2( cBase + cProject, cTargetDir, cOptionsPre + " -inc", cOptionsPost )
ENDIF
ENDIF
ELSE
/* OutStd( hb_StrFormat( "'%s' project skipped" + hb_osNewLine(), cProject ) ) */
ENDIF
ENDIF
NEXT
NEXT
ErrorLevel( 0 )
RETURN
STATIC FUNCTION call_hbmk2( cProject, cTargetDir, cOptionsPre, cOptionsPost )
LOCAL nErrorLevel
LOCAL cDir, cName
hb_FNameSplit( cProject, @cDir, @cName )
nErrorLevel := mk_hb_processRun( PathSepToSelf( GetEnv( "HB_HOST_BIN_DIR" ) ) + _PS_ + "hbmk2" +;
" -quiet -lang=en -width=0 -q0" + cOptionsPre +;
" " + cProject +;
cOptionsPost +;
" -workdir=" + cTargetDir + "/${hb_work}/" + cName + "${hb_workdynsub}" +;
" -o" + cTargetDir + "/" )
IF nErrorLevel != 0
OutStd( hb_StrFormat( "'%s' returned status: %s" + hb_osNewLine(), cProject, hb_ntos( nErrorLevel ) ) )
RETURN .F.
ENDIF
RETURN .T.
STATIC FUNCTION mk_hb_processRun( cCommand )
OutStd( cCommand + hb_osNewLine() )
RETURN iif( s_lTest, 0, hb_processRun( cCommand ) )
STATIC FUNCTION FN_ExtSet( cFileName, cExt )
LOCAL cDir, cName
hb_FNameSplit( cFileName, @cDir, @cName )
RETURN hb_FNameMerge( cDir, cName, cExt )
STATIC FUNCTION PathSepToSelf( cFileName )
#if defined( __PLATFORM__WINDOWS ) .OR. ;
defined( __PLATFORM__DOS ) .OR. ;
defined( __PLATFORM__OS2 )
RETURN StrTran( cFileName, "/", "\" )
#else
RETURN StrTran( cFileName, "\", "/" )
#endif