1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: mkcreate.cxx,v $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
32 // MARKER(update_precomp.py): autogen include statement, do not remove
33 #include "precompiled_tools.hxx"
39 #include "bootstrp/mkcreate.hxx"
40 #include "bootstrp/inimgr.hxx"
41 #include "bootstrp/appdef.hxx"
42 #include <tools/geninfo.hxx>
43 #include <tools/iparser.hxx>
44 #include "bootstrp/prj.hxx"
46 char const *NoBuildProject
[] = {
48 "EndOf_NoBuildProject"
51 char const *LimitedPath
[] = {
52 "jurt\\com\\sun\\star",
61 // class SourceDirectory
64 /*****************************************************************************/
65 SourceDirectory::SourceDirectory( const ByteString
&rDirectoryName
,
66 USHORT nOperatingSystem
, SourceDirectory
*pParentDirectory
)
67 /*****************************************************************************/
68 : ByteString( rDirectoryName
),
69 pParent( pParentDirectory
),
70 pSubDirectories( NULL
),
71 nOSType( nOperatingSystem
),
73 pDependencies( NULL
),
74 pCodedDependencies( NULL
),
75 pCodedIdentifier( NULL
)
78 if ( !pParent
->pSubDirectories
)
79 pParent
->pSubDirectories
= new SourceDirectoryList();
80 pParent
->pSubDirectories
->InsertSorted( this );
81 nDepth
= pParent
->nDepth
+ 1;
85 /*****************************************************************************/
86 SourceDirectory::~SourceDirectory()
87 /*****************************************************************************/
89 delete pSubDirectories
;
92 /*****************************************************************************/
93 CodedDependency
*SourceDirectory::AddCodedDependency(
94 const ByteString
&rCodedIdentifier
, USHORT nOperatingSystems
)
95 /*****************************************************************************/
97 CodedDependency
*pReturn
= NULL
;
99 if ( !pCodedDependencies
) {
100 pCodedDependencies
= new SByteStringList();
101 pReturn
= new CodedDependency( rCodedIdentifier
, nOperatingSystems
);
102 pCodedDependencies
->PutString(( ByteString
* ) pReturn
);
106 pCodedDependencies
->IsString( (ByteString
*) (& rCodedIdentifier
) );
107 if ( nPos
== NOT_THERE
) {
109 new CodedDependency( rCodedIdentifier
, nOperatingSystems
);
110 pCodedDependencies
->PutString(( ByteString
* ) pReturn
);
114 ( CodedDependency
* ) pCodedDependencies
->GetObject( nPos
);
115 pReturn
->TryToMerge( rCodedIdentifier
, nOperatingSystems
);
121 /*****************************************************************************/
122 CodedDependency
*SourceDirectory::AddCodedIdentifier(
123 const ByteString
&rCodedIdentifier
, USHORT nOperatingSystems
)
124 /*****************************************************************************/
126 CodedDependency
*pReturn
= NULL
;
128 if ( !pCodedIdentifier
) {
129 pCodedIdentifier
= new SByteStringList();
130 pReturn
= new CodedDependency( rCodedIdentifier
, nOperatingSystems
);
131 pCodedIdentifier
->PutString(( ByteString
* ) pReturn
);
135 pCodedIdentifier
->IsString( ( ByteString
*) (& rCodedIdentifier
) );
136 if ( nPos
== NOT_THERE
) {
138 new CodedDependency( rCodedIdentifier
, nOperatingSystems
);
139 pCodedIdentifier
->PutString(( ByteString
* ) pReturn
);
143 ( CodedDependency
* ) pCodedIdentifier
->GetObject( nPos
);
144 pReturn
->TryToMerge( rCodedIdentifier
, nOperatingSystems
);
147 if ( pParent
&& pParent
->nDepth
> 1 )
148 pParent
->AddCodedIdentifier( rCodedIdentifier
, nOperatingSystems
);
153 /*****************************************************************************/
154 ByteString
SourceDirectory::GetFullPath()
155 /*****************************************************************************/
157 ByteString sFullPath
;
159 sFullPath
= pParent
->GetFullPath();
160 sFullPath
+= ByteString( PATH_SEPARATOR
);
167 /*****************************************************************************/
168 SourceDirectory
*SourceDirectory::GetRootDirectory()
169 /*****************************************************************************/
174 return pParent
->GetRootDirectory();
177 /*****************************************************************************/
178 SourceDirectory
*SourceDirectory::GetSubDirectory(
179 const ByteString
&rDirectoryPath
, USHORT nOperatingSystem
)
180 /*****************************************************************************/
187 while ( bSubs
&& ByteString( LimitedPath
[ nIndex
]) != "EndOf_LimitedPath" ) {
188 SourceDirectory
*pActDir
= this;
189 ByteString
sLimitation( LimitedPath
[ nIndex
]);
192 for ( ULONG i
= sLimitation
.GetTokenCount( '\\' ); i
> 0 && !bBreak
; i
-- ) {
193 if (( !pActDir
) || ( *pActDir
!= sLimitation
.GetToken(( USHORT
)( i
- 1 ), '\\' )))
196 pActDir
= pActDir
->pParent
;
204 sSearch
= rDirectoryPath
;
207 sSearch
= rDirectoryPath
.GetToken( 0, PATH_SEPARATOR
);
209 SourceDirectory
*pSubDirectory
= NULL
;
211 if ( pSubDirectories
)
212 pSubDirectory
= pSubDirectories
->Search( sSearch
);
214 if ( !pSubDirectory
)
215 pSubDirectory
= new SourceDirectory(
216 sSearch
, nOperatingSystem
, this );
218 pSubDirectory
->nOSType
|= nOperatingSystem
;
220 if ( sSearch
.Len() == rDirectoryPath
.Len())
221 return pSubDirectory
;
223 ByteString sPath
= rDirectoryPath
.Copy( sSearch
.Len() + 1 );
225 return pSubDirectory
->GetSubDirectory( sPath
, nOperatingSystem
);
228 /*****************************************************************************/
229 SourceDirectory
*SourceDirectory::GetDirectory(
230 const ByteString
&rDirectoryName
, USHORT nOperatingSystem
)
231 /*****************************************************************************/
233 ByteString
sDirectoryName( rDirectoryName
);
235 sDirectoryName
.SearchAndReplaceAll( "\\", "/" );
238 SourceDirectory
*pRoot
= GetRootDirectory();
240 if ( sDirectoryName
.Search( *pRoot
) != 0 )
243 if ( sDirectoryName
.Len() == pRoot
->Len())
246 if ( sDirectoryName
.GetChar( pRoot
->Len()) == PATH_SEPARATOR
) {
247 ByteString sSub
= sDirectoryName
.Copy( pRoot
->Len() + 1 );
248 return pRoot
->GetSubDirectory( sSub
, nOperatingSystem
);
254 /*****************************************************************************/
255 SourceDirectory
*SourceDirectory::Insert( const ByteString
&rDirectoryName
,
256 USHORT nOperatingSystem
)
257 /*****************************************************************************/
259 SourceDirectory
*pSubDirectory
= NULL
;
260 if ( pSubDirectories
)
261 pSubDirectory
= pSubDirectories
->Search( rDirectoryName
);
263 if ( !pSubDirectory
)
264 pSubDirectory
= new SourceDirectory(
265 rDirectoryName
, nOperatingSystem
, this );
267 return pSubDirectory
;
270 /*****************************************************************************/
271 Dependency
*SourceDirectory::ResolvesDependency(
272 CodedDependency
*pCodedDependency
)
273 /*****************************************************************************/
275 if ( !pCodedIdentifier
)
278 ULONG nPos
= pCodedIdentifier
->IsString( pCodedDependency
);
279 if ( nPos
!= NOT_THERE
) {
280 CodedDependency
*pIdentifier
=
281 ( CodedDependency
* ) pCodedIdentifier
->GetObject( nPos
);
283 pIdentifier
->GetOperatingSystem() &
284 pCodedDependency
->GetOperatingSystem();
285 Dependency
*pReturn
= new Dependency( *this, nResult
);
286 nResult
^= pCodedDependency
->GetOperatingSystem();
287 pCodedDependency
->SetOperatingSystem( nResult
);
294 /*****************************************************************************/
295 void SourceDirectory::ResolveDependencies()
296 /*****************************************************************************/
298 if ( !pSubDirectories
)
301 for ( ULONG i
= 0; i
< pSubDirectories
->Count(); i
++ ) {
302 SourceDirectory
*pActDirectory
=
303 ( SourceDirectory
* ) pSubDirectories
->GetObject( i
);
304 if ( pActDirectory
->pSubDirectories
)
305 pActDirectory
->ResolveDependencies();
307 if ( pActDirectory
->pCodedDependencies
) {
308 while ( pActDirectory
->pCodedDependencies
->Count())
310 CodedDependency
*pCodedDependency
= ( CodedDependency
* )
311 pActDirectory
->pCodedDependencies
->GetObject(( ULONG
) 0 );
315 ( k
< pSubDirectories
->Count()) &&
316 ( pCodedDependency
->GetOperatingSystem() != OS_NONE
);
319 Dependency
*pDependency
=
320 ((SourceDirectory
*) pSubDirectories
->GetObject( k
))->
321 ResolvesDependency( pCodedDependency
);
324 if ( !pActDirectory
->pDependencies
)
325 pActDirectory
->pDependencies
= new SByteStringList();
326 pActDirectory
->pDependencies
->PutString( pDependency
);
329 if ( pCodedDependency
->GetOperatingSystem()) {
330 if ( !pCodedDependencies
)
331 pCodedDependencies
= new SByteStringList();
332 pCodedDependencies
->PutString( pCodedDependency
);
335 delete pCodedDependency
;
336 pActDirectory
->pCodedDependencies
->Remove(( ULONG
) 0 );
342 /*****************************************************************************/
343 ByteString
SourceDirectory::GetTarget()
344 /*****************************************************************************/
348 if ( !pDependencies
)
352 while ( k
< pDependencies
->Count()) {
353 if ( *this == *pDependencies
->GetObject( k
))
354 delete pDependencies
->Remove( k
);
359 if ( !pDependencies
->Count()) {
360 delete pDependencies
;
361 pDependencies
= NULL
;
365 BOOL bDependsOnPlatform
= FALSE
;
366 for ( ULONG i
= 0; i
< pDependencies
->Count(); i
++ )
367 if ((( Dependency
* ) pDependencies
->GetObject( i
))->
368 GetOperatingSystem() != OS_ALL
)
369 bDependsOnPlatform
= TRUE
;
371 ByteString
sTarget( *this );
372 sTarget
.SearchAndReplaceAll( "\\", "$/" );
373 if ( !bDependsOnPlatform
) {
376 for ( ULONG i
= 0; i
< pDependencies
->Count(); i
++ ) {
377 ByteString
sDependency( *pDependencies
->GetObject( i
));
378 sDependency
.SearchAndReplaceAll( "\\", "$/" );
380 sReturn
+= sDependency
;
384 ByteString
sUNX( ".IF \"$(GUI)\" == \"UNX\"\n" );
389 ByteString
sWNT( ".IF \"$(GUI)\" == \"WNT\"\n" );
394 ByteString
sOS2( ".IF \"$(GUI)\" == \"OS2\"\n" );
399 for ( ULONG i
= 0; i
< pDependencies
->Count(); i
++ ) {
400 Dependency
*pDependency
=
401 ( Dependency
* ) pDependencies
->GetObject( i
);
402 ByteString
sDependency( *pDependency
);
403 sDependency
.SearchAndReplaceAll( "\\", "$/" );
405 if ( pDependency
->GetOperatingSystem() & OS_UNX
) {
410 if ( pDependency
->GetOperatingSystem() & OS_WIN32
) {
415 if ( pDependency
->GetOperatingSystem() & OS_OS2
) {
424 sReturn
+= "\n.ENDIF\n";
428 sReturn
+= "\n.ENDIF\n";
432 sReturn
+= "\n.ENDIF\n";
435 sReturn
.EraseTrailingChars( '\n' );
439 /*****************************************************************************/
440 ByteString
SourceDirectory::GetSubDirsTarget()
441 /*****************************************************************************/
445 if ( pSubDirectories
) {
446 BOOL bDependsOnPlatform
= FALSE
;
447 for ( ULONG i
= 0; i
< pSubDirectories
->Count(); i
++ )
448 if ((( SourceDirectory
* ) pSubDirectories
->GetObject( i
))->
449 GetOperatingSystems() != OS_ALL
)
450 bDependsOnPlatform
= TRUE
;
452 if ( !bDependsOnPlatform
) {
453 sReturn
= "RC_SUBDIRS = ";
455 for ( ULONG i
= 0; i
< pSubDirectories
->Count(); i
++ ) {
456 ByteString
sSubDirectory( *pSubDirectories
->GetObject( i
));
457 sSubDirectory
.SearchAndReplaceAll( "\\", "$/" );
458 sReturn
+= " \\\n\t";
459 sReturn
+= sSubDirectory
;
464 ByteString
sUNX( ".IF \"$(GUI)\" == \"UNX\"\n" );
465 sUNX
+= "RC_SUBDIRS = ";
468 ByteString
sWNT( ".IF \"$(GUI)\" == \"WNT\"\n" );
469 sWNT
+= "RC_SUBDIRS = ";
472 ByteString
sOS2( ".IF \"$(GUI)\" == \"OS2\"\n" );
473 sOS2
+= "RC_SUBDIRS = ";
476 for ( ULONG i
= 0; i
< pSubDirectories
->Count(); i
++ ) {
477 SourceDirectory
*pDirectory
=
478 ( SourceDirectory
* ) pSubDirectories
->GetObject( i
);
479 ByteString
sDirectory( *pDirectory
);
480 sDirectory
.SearchAndReplaceAll( "\\", "$/" );
482 if ( pDirectory
->GetOperatingSystems() & OS_UNX
) {
487 if ( pDirectory
->GetOperatingSystems() & OS_WIN32
) {
492 if ( pDirectory
->GetOperatingSystems() & OS_OS2
) {
500 sReturn
+= "\n.ENDIF\n";
504 sReturn
+= "\n.ENDIF\n";
508 sReturn
+= "\n.ENDIF\n";
515 /*****************************************************************************/
516 USHORT
SourceDirectory::GetOSType( const ByteString
&sDependExt
)
517 /*****************************************************************************/
520 if ( sDependExt
== "" )
522 else if ( sDependExt
== "N" || sDependExt
== "W" )
524 else if ( sDependExt
== "U" )
526 else if ( sDependExt
== "P" )
531 /*****************************************************************************/
532 SourceDirectory
*SourceDirectory::CreateRootDirectory(
533 const ByteString
&rRoot
, const ByteString
&rVersion
, BOOL bAll
)
534 /*****************************************************************************/
536 IniManager aIniManager
;
537 aIniManager
.Update();
539 ByteString
sDefLst( GetDefStandList());
540 ByteString
sStandLst( aIniManager
.ToLocal( sDefLst
));
541 String s
= String( sStandLst
, gsl_getSystemTextEncoding());
542 InformationParser aParser
;
544 // "Reading database %s ...\n", sStandLst.GetBuffer());
545 GenericInformationList
*pVerList
= aParser
.Execute(
549 ByteString sPath( rVersion );
551 sPath += ByteString( "/settings/solarlist" );
553 sPath += ByteString( "/settings/unxsolarlist" );
555 ByteString sSolarList( _SOLARLIST );
557 GenericInformation *pInfo = pVerList->GetInfo( sPath, TRUE );
559 ByteString aIniRoot( GetIniRoot() );
560 DirEntry aIniEntry( String( aIniRoot, RTL_TEXTENCODING_ASCII_US ));
561 aIniEntry += DirEntry( String( pInfo->GetValue(), RTL_TEXTENCODING_ASCII_US )).GetBase( PATH_SEPARATOR );
562 sSolarList = ByteString( aIniEntry.GetFull(), RTL_TEXTENCODING_ASCII_US );
565 sSolarList = aIniManager.ToLocal( sSolarList );
567 "Reading directory information %s ...\n", sSolarList.GetBuffer());
570 ByteString
sVersion( rVersion
);
571 Star
aStar( pVerList
, sVersion
, TRUE
, rRoot
.GetBuffer());
573 // "Creating virtual directory tree ...\n" );
576 SourceDirectory
*pSourceRoot
= new SourceDirectory( rRoot
, OS_ALL
);
578 for ( ULONG i
= 0; i
< aStar
.Count(); i
++ ) {
579 Prj
*pPrj
= aStar
.GetObject( i
);
581 BOOL bBuildable
= TRUE
;
584 while ( bBuildable
&& ByteString( NoBuildProject
[ nIndex
]) != "EndOf_NoBuildProject" ) {
585 bBuildable
= ( ByteString( NoBuildProject
[ nIndex
]) != pPrj
->GetProjectName());
590 SourceDirectory
*pProject
= pSourceRoot
->Insert( pPrj
->GetProjectName(), OS_ALL
);
592 SByteStringList
*pPrjDependencies
= pPrj
->GetDependencies( FALSE
);
593 if ( pPrjDependencies
)
594 for ( ULONG x
= 0; x
< pPrjDependencies
->Count(); x
++ )
595 pProject
->AddCodedDependency( *pPrjDependencies
->GetObject( x
), OS_ALL
);
597 pProject
->AddCodedIdentifier( pPrj
->GetProjectName(), OS_ALL
);
599 for ( ULONG j
= 0; j
< pPrj
->Count(); j
++ ) {
600 CommandData
*pData
= pPrj
->GetObject( j
);
601 if ( bAll
|| ( pData
->GetCommandType() == COMMAND_NMAKE
)) {
602 ByteString
sDirPath( rRoot
);
603 sDirPath
+= ByteString( PATH_SEPARATOR
);
604 sDirPath
+= pData
->GetPath();
605 SourceDirectory
*pDirectory
=
606 pSourceRoot
->InsertFull( sDirPath
, pData
->GetOSType());
607 SByteStringList
*pDependencies
= pData
->GetDependencies();
608 if ( pDependencies
) {
609 for ( ULONG k
= 0; k
< pDependencies
->Count(); k
++ ) {
610 ByteString
sDependency(*pDependencies
->GetObject( k
));
611 ByteString
sDependExt(sDependency
.GetToken( 1, '.' ));
612 sDependExt
.ToUpperAscii();
613 pDirectory
->AddCodedDependency(
614 sDependency
.GetToken( 0, '.' ), GetOSType( sDependExt
));
617 ByteString sIdentifier
= pData
->GetLogFile();
618 ByteString sIdExt
= sIdentifier
.GetToken( 1, '.' );
619 sIdExt
.ToUpperAscii();
620 pDirectory
->AddCodedIdentifier( sIdentifier
.GetToken( 0, '.' ), GetOSType( sIdExt
));
629 /*****************************************************************************/
630 BOOL
SourceDirectory::RemoveDirectoryTreeAndAllDependencies()
631 /*****************************************************************************/
636 SourceDirectoryList
*pParentContent
= pParent
->pSubDirectories
;
638 while ( i
< pParentContent
->Count()) {
639 SourceDirectory
*pCandidate
=
640 ( SourceDirectory
* )pParentContent
->GetObject( i
);
641 if ( pCandidate
== this ) {
642 pParentContent
->Remove( i
);
645 if ( pCandidate
->pDependencies
) {
646 ULONG nPos
= pCandidate
->pDependencies
->IsString( this );
647 if ( nPos
!= NOT_THERE
)
648 delete pCandidate
->pDependencies
->Remove( nPos
);
657 /*****************************************************************************/
658 BOOL
SourceDirectory::CreateRecursiveMakefile( BOOL bAllChilds
)
659 /*****************************************************************************/
661 if ( !pSubDirectories
)
664 fprintf( stdout
, "%s", GetFullPath().GetBuffer());
666 String
aTmpStr( GetFullPath(), gsl_getSystemTextEncoding());
667 DirEntry
aEntry( aTmpStr
);
668 if ( !aEntry
.Exists()) {
669 fprintf( stdout
, " ... no directory!n" );
674 while( j
< pSubDirectories
->Count()) {
675 String
sSubDirectory(
676 (( SourceDirectory
* ) pSubDirectories
->GetObject( j
))->
678 gsl_getSystemTextEncoding()
680 DirEntry
aSubDirectory( sSubDirectory
);
681 if ( !aSubDirectory
.Exists())
682 (( SourceDirectory
* ) pSubDirectories
->GetObject( j
))->
683 RemoveDirectoryTreeAndAllDependencies();
688 DirEntry
aRCFile( String( "makefile.rc", gsl_getSystemTextEncoding()));
689 DirEntry
aRCEntry( aEntry
);
692 DirEntry
aMKFile( String( "makefile.mk", gsl_getSystemTextEncoding()));
693 DirEntry
aMKEntry( aEntry
);
696 BOOL bMakefileMk
= FALSE
;
697 if ( aMKEntry
.Exists()) {
698 if ( nDepth
== 1 && *this == ByteString( "api" ))
699 fprintf( stdout
, " ... makefile.mk exists, ignoring (hack: prj == api)!" );
701 fprintf( stdout
, " ... makefile.mk exists, including!" );
706 SvFileStream
aMakefile( aRCEntry
.GetFull(), STREAM_STD_WRITE
| STREAM_TRUNC
);
707 if ( !aMakefile
.IsOpen()) {
708 fprintf( stdout
, " ... failed!\n" );
713 "#*************************************************************************\n"
715 "# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.\n"
717 "# Copyright 2008 by Sun Microsystems, Inc.\n"
719 "# OpenOffice.org - a multi-platform office productivity suite\n"
721 "# $RCSfile: mkcreate.cxx,v $\n"
723 "# $Revision: 1.18 $\n"
725 "# This file is part of OpenOffice.org.\n"
727 "# OpenOffice.org is free software: you can redistribute it and/or modify\n"
728 "# it under the terms of the GNU Lesser General Public License version 3\n"
729 "# only, as published by the Free Software Foundation.\n"
731 "# OpenOffice.org is distributed in the hope that it will be useful,\n"
732 "# but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
733 "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
734 "# GNU Lesser General Public License version 3 for more details\n"
735 "# (a copy is included in the LICENSE file that accompanied this code).\n"
737 "# You should have received a copy of the GNU Lesser General Public License\n"
738 "# version 3 along with OpenOffice.org. If not, see\n"
739 "# <http://www.openoffice.org/license.html>\n"
740 "# for a copy of the LGPLv3 License.\n"
742 "#*************************************************************************\n"
745 if ( !bMakefileMk
) {
747 sHeader
+= ByteString(
750 "# mark this makefile as a recursive one\n"
756 "# implementation of cvs checkout\n"
759 ".IF \"$(checkout)\"==\"\"\n"
760 "all_target: ALLTAR\n"
761 ".ELSE\t# \"$(checkout)\"==\"\"\n"
762 ".IF \"$(checkout)\"==\"true\"\n"
765 ".ELSE\t# \"$(checkout)\"==\"true\"\n"
767 "\t_cvs co -r$(checkout) $@\n"
768 ".ENDIF\t# \"$(checkout)\"==\"true\"\n"
769 "all_subdirs : $(RC_SUBDIRS)\n"
770 ".ENDIF\t# \"$(checkout)\"==\"\"\n"
774 sHeader
+= ByteString(
777 "# mark this makefile as a recursive one\n"
783 sHeader
+= ByteString(
784 ".IF \"$(build_deliver)\"==\"true\"\n"
785 "all_target:\t\t\\\n"
788 ".ELSE # \"$(build_deliver)\"==\"true\"\n"
789 "all_target: ALLTAR\n"
790 ".ENDIF # \"$(build_deliver)\"==\"true\"\n"
793 sHeader
+= ByteString(
794 "all_target: ALLTAR\n"
800 sHeader
+= ByteString(
801 ".IF \"$(build_deliver)\"==\"true\"\n"
802 "all_target:\t\t\\\n"
805 ".ELSE # \"$(build_deliver)\"==\"true\"\n"
806 "all_target: ALLTAR\n"
807 ".ENDIF # \"$(build_deliver)\"==\"true\"\n"
810 sHeader
+= ByteString(
813 "# macro RC_SUBDIRS handles iteration over\n"
814 "# all mandatory sub directories\n"
818 aMakefile
.WriteLine( sHeader
);
819 aMakefile
.WriteLine( GetSubDirsTarget());
822 ByteString
sBootstrapTarget(
824 "# bootstrap target\n"
826 "bootstrap .PHONY :\n"
827 "\t@config_office/bootstrap\n\n"
829 aMakefile
.WriteLine( sBootstrapTarget
);
830 ByteString
sConfigureTarget(
832 "# configure target\n"
834 "configure .PHONY SETDIR=config_office :\n"
837 aMakefile
.WriteLine( sConfigureTarget
);
839 else if ( nDepth
== 1 ) {
840 ByteString
sDeliverTarget(
842 "# deliver target to handle\n"
843 "# project dependencies\n"
845 "TG_DELIVER : $(RC_SUBDIRS)\n"
848 aMakefile
.WriteLine( sDeliverTarget
);
857 ".INCLUDE : makefile.mk\n"
861 sInclude
+= ByteString(
863 "all_rc_target: ALLTAR\n"
866 aMakefile
.WriteLine( sInclude
);
871 "# single directory targets for\n"
872 "# dependency handling between directories\n"
875 aMakefile
.WriteLine( sComment
);
877 for ( ULONG i
= 0; i
< pSubDirectories
->Count(); i
++ ) {
879 (( SourceDirectory
* )pSubDirectories
->GetObject( i
))->
883 aMakefile
.WriteLine( sTarget
);
889 if ( !bMakefileMk
) {
890 sFooter
+= ByteString(
892 "# central target makefile\n"
897 sFooter
+= ByteString(
898 ".INCLUDE : target.mk\n"
902 sFooter
+= ByteString(
903 ".IF \"$(checkout)\"==\"\"\n"
904 ".INCLUDE : target.mk\n"
905 ".ENDIF\t#\"$(checkout)\"==\"\"\n"
909 sFooter
+= ByteString(
911 "#*************************************************************************\n"
913 aMakefile
.WriteLine( sFooter
);
917 fprintf( stdout
, "\n" );
919 BOOL bSuccess
= TRUE
;
921 for ( ULONG k
= 0; k
< pSubDirectories
->Count(); k
++ )
922 if ( !(( SourceDirectory
* ) pSubDirectories
->GetObject( k
))->
923 CreateRecursiveMakefile( TRUE
))
930 // class SourceDirectoryList
933 /*****************************************************************************/
934 SourceDirectoryList::~SourceDirectoryList()
935 /*****************************************************************************/
937 for ( ULONG i
= 0; i
< Count(); i
++ )
938 delete GetObject( i
);
941 /*****************************************************************************/
942 SourceDirectory
*SourceDirectoryList::Search(
943 const ByteString
&rDirectoryName
)
944 /*****************************************************************************/
946 ULONG nPos
= IsString( ( ByteString
* ) (&rDirectoryName
) );
947 if ( nPos
!= LIST_ENTRY_NOTFOUND
)
948 return ( SourceDirectory
* ) GetObject( nPos
);