gwenhywfar  5.10.1
Functions
gwenbuild.c File Reference
#include "gwenbuild/types/gwenbuild_p.h"
#include "gwenbuild/builders/genericbuilder.h"
#include "gwenbuild/types/builder_be.h"
#include <gwenhywfar/debug.h>
#include <gwenhywfar/directory.h>
#include <gwenhywfar/text.h>
#include <gwenhywfar/stringlist.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
Include dependency graph for gwenbuild.c:

Go to the source code of this file.

Functions

static void _addBuildCommands (GWB_BUILD_CONTEXT *buildCtx, const GWB_BUILD_CMD_LIST *buildCmdList)
 
static int _addBuildCommandsFromBuilder (GWB_PROJECT *project, GWB_BUILD_CONTEXT *buildCtx)
 
static void _addExplicitBuildCommandsFromTargets (GWB_PROJECT *project, GWB_BUILD_CONTEXT *buildCtx)
 
static void _addFilesToBuildCtx (GWB_BUILD_CONTEXT *buildCtx, GWB_FILE_LIST2 *fileList)
 
static int _addOneSubTargetForTarget (GWB_TARGET *target, GWB_TARGET *subTarget)
 
static int _addOrBuildTargetSources (GWB_PROJECT *project, GWB_TARGET *target)
 
static int _addSourcesOrMkBuildersAndGetTheirOutputs (GWB_PROJECT *project, GWB_TARGET *target, GWB_FILE_LIST2 *sourceFileList, GWB_FILE_LIST2 *newOutputList)
 
static int _addSubTargets (GWB_PROJECT *project)
 
static int _addSubTargetsForTarget (GWB_PROJECT *project, GWB_TARGET *target, GWEN_STRINGLIST *usedTargetList)
 
static GWB_BUILDER_genBuilderForSourceFile (GWENBUILD *gwenbuild, GWB_CONTEXT *context, GWB_FILE *file)
 
static GWB_BUILDER_genBuilderForTarget (GWB_PROJECT *project, GWB_TARGET *target)
 
static GWB_BUILDER_getBuilderByName (GWENBUILD *gwenbuild, GWB_CONTEXT *context, const char *builderName)
 
void _readBuilderDescrList (GWENBUILD *gwenbuild)
 
void GWBUILD_AddBuildFilename (GWENBUILD *gwenbuild, const char *s)
 
void GWBUILD_AddFilesFromStringList (GWB_FILE_LIST2 *mainFileList, const char *sFolder, const GWEN_STRINGLIST *fileNameList, GWB_FILE_LIST2 *outFileList, uint32_t flagsToAdd, int copyFileForOutList)
 
void GWBUILD_AddFlags (GWENBUILD *gwenbuild, uint32_t f)
 
void GWBUILD_Debug_PrintBuildCmdList2 (const char *sName, const GWB_BUILD_CMD_LIST2 *buildCmdList2, int indent)
 
void GWBUILD_Debug_PrintBuilderList2 (const char *sName, const GWB_BUILDER_LIST2 *builderList2, int indent, int fullDump)
 
void GWBUILD_Debug_PrintDb (const char *sName, GWEN_DB_NODE *db, int indent)
 
void GWBUILD_Debug_PrintFile (const char *sName, const GWB_FILE *file, int indent)
 
void GWBUILD_Debug_PrintFileList2 (const char *sName, const GWB_FILE_LIST2 *fileList2, int indent)
 
void GWBUILD_Debug_PrintIntValue (const char *sName, int value, int indent)
 
void GWBUILD_Debug_PrintKvpList (const char *sName, const GWB_KEYVALUEPAIR_LIST *kvpList, int indent)
 
void GWBUILD_Debug_PrintOptionList (const char *sName, const GWB_OPTION_LIST *optionList, int indent)
 
void GWBUILD_Debug_PrintStringList (const char *sName, const GWEN_STRINGLIST *sl, int indent)
 
void GWBUILD_Debug_PrintTargetList2 (const char *sName, const GWB_TARGET_LIST2 *targetList2, int indent, int fullDump)
 
void GWBUILD_Debug_PrintValue (const char *sName, const char *sValue, int indent)
 
void GWBUILD_DelFlags (GWENBUILD *gwenbuild, uint32_t f)
 
void GWBUILD_free (GWENBUILD *gwenbuild)
 
const char * GWBUILD_GetArchFromTriplet (const char *sTriplet)
 
GWEN_STRINGLISTGWBUILD_GetBuildFilenameList (const GWENBUILD *gwenbuild)
 
uint32_t GWBUILD_GetFlags (const GWENBUILD *gwenbuild)
 
const char * GWBUILD_GetHostArch ()
 
const char * GWBUILD_GetHostSystem ()
 
time_t GWBUILD_GetModificationTimeOfFile (const char *filename)
 
GWEN_STRINGLISTGWBUILD_GetPathFromEnvironment ()
 
const char * GWBUILD_GetSystemFromTriplet (const char *sTriplet)
 
int GWBUILD_GetTargetIsWindows (const GWENBUILD *gwenbuild)
 
const char * GWBUILD_GetTargetSystem (const GWENBUILD *gwenbuild)
 
GWB_BUILD_CONTEXTGWBUILD_MakeBuildCommands (GWB_PROJECT *project)
 
int GWBUILD_MakeBuildersForTargets (GWB_PROJECT *project)
 
GWENBUILDGWBUILD_new (void)
 
void GWBUILD_SetFlags (GWENBUILD *gwenbuild, uint32_t f)
 
void GWBUILD_SetTargetIsWindows (GWENBUILD *gwenbuild, int i)
 
void GWBUILD_SetTargetSystem (GWENBUILD *gwenbuild, const char *s)
 
GWBUILD_TARGETTYPE GWBUILD_TargetType_fromString (const char *s)
 
const char * GWBUILD_TargetType_toString (GWBUILD_TARGETTYPE tt)
 

Function Documentation

◆ _addBuildCommands()

void _addBuildCommands ( GWB_BUILD_CONTEXT buildCtx,
const GWB_BUILD_CMD_LIST *  buildCmdList 
)
static

Definition at line 842 of file gwenbuild.c.

References _addFilesToBuildCtx(), GWB_BuildCmd_dup(), GWB_BuildCmd_GetInFileList2(), GWB_BuildCmd_GetOutFileList2(), and GWB_BuildCtx_AddCommand().

Referenced by _addExplicitBuildCommandsFromTargets().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _addBuildCommandsFromBuilder()

int _addBuildCommandsFromBuilder ( GWB_PROJECT project,
GWB_BUILD_CONTEXT buildCtx 
)
static

Definition at line 773 of file gwenbuild.c.

References DBG_ERROR, DBG_INFO, GWB_Builder_AddBuildCmd(), GWB_Project_GetBuilderList(), GWEN_ERROR_NO_DATA, and NULL.

Referenced by GWBUILD_MakeBuildCommands().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _addExplicitBuildCommandsFromTargets()

void _addExplicitBuildCommandsFromTargets ( GWB_PROJECT project,
GWB_BUILD_CONTEXT buildCtx 
)
static

Definition at line 809 of file gwenbuild.c.

References _addBuildCommands(), GWB_Project_GetExplicitBuildList(), GWB_Project_GetTargetList(), and GWB_Target_GetExplicitBuildList().

Referenced by GWBUILD_MakeBuildCommands().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _addFilesToBuildCtx()

void _addFilesToBuildCtx ( GWB_BUILD_CONTEXT buildCtx,
GWB_FILE_LIST2 *  fileList 
)
static

Definition at line 859 of file gwenbuild.c.

References GWB_BuildCtx_AddFile(), GWB_File_dup(), GWB_File_GetId(), and GWB_File_SetId().

Referenced by _addBuildCommands().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _addOneSubTargetForTarget()

int _addOneSubTargetForTarget ( GWB_TARGET target,
GWB_TARGET subTarget 
)
static

◆ _addOrBuildTargetSources()

int _addOrBuildTargetSources ( GWB_PROJECT project,
GWB_TARGET target 
)
static

Definition at line 537 of file gwenbuild.c.

References _addSourcesOrMkBuildersAndGetTheirOutputs(), DBG_ERROR, DBG_INFO, GWB_Context_GetSourceFileList2(), GWB_Target_Dump(), GWB_Target_GetContext(), GWB_Target_GetId(), GWEN_ERROR_GENERIC, and NULL.

Referenced by GWBUILD_MakeBuildersForTargets().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _addSourcesOrMkBuildersAndGetTheirOutputs()

int _addSourcesOrMkBuildersAndGetTheirOutputs ( GWB_PROJECT project,
GWB_TARGET target,
GWB_FILE_LIST2 *  sourceFileList,
GWB_FILE_LIST2 *  newOutputList 
)
static

◆ _addSubTargets()

int _addSubTargets ( GWB_PROJECT project)
static

Definition at line 626 of file gwenbuild.c.

References _addSubTargetsForTarget(), DBG_INFO, GWB_Project_GetTargetList(), GWB_Target_GetUsedTargetNameList(), GWEN_StringList_Count(), and NULL.

Referenced by GWBUILD_MakeBuildersForTargets().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _addSubTargetsForTarget()

int _addSubTargetsForTarget ( GWB_PROJECT project,
GWB_TARGET target,
GWEN_STRINGLIST usedTargetList 
)
static

Definition at line 664 of file gwenbuild.c.

References _addOneSubTargetForTarget(), DBG_INFO, GWB_Project_GetTargetById(), GWEN_StringList_FirstEntry(), GWEN_StringListEntry_Data(), GWEN_StringListEntry_Next(), and NULL.

Referenced by _addSubTargets().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _genBuilderForSourceFile()

GWB_BUILDER * _genBuilderForSourceFile ( GWENBUILD gwenbuild,
GWB_CONTEXT context,
GWB_FILE file 
)
static

Definition at line 1095 of file gwenbuild.c.

References _getBuilderByName(), DBG_DEBUG, DBG_ERROR, DBG_INFO, GWB_Builder_AddSourceFile(), GWB_File_GetBuilder(), GWB_File_GetExt(), GWB_File_GetName(), GWB_File_SetBuilder(), and NULL.

Referenced by _addSourcesOrMkBuildersAndGetTheirOutputs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _genBuilderForTarget()

GWB_BUILDER * _genBuilderForTarget ( GWB_PROJECT project,
GWB_TARGET target 
)
static

◆ _getBuilderByName()

GWB_BUILDER * _getBuilderByName ( GWENBUILD gwenbuild,
GWB_CONTEXT context,
const char *  builderName 
)
static

Definition at line 1061 of file gwenbuild.c.

References _readBuilderDescrList(), DBG_ERROR, GWB_GBuilderDescr_GetXmlDescr(), GWB_GBuilderDescr_List_GetByName(), GWB_GenericBuilder_new(), GWEN_XMLNode_dup(), and NULL.

Referenced by _genBuilderForSourceFile(), and _genBuilderForTarget().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _readBuilderDescrList()

void _readBuilderDescrList ( GWENBUILD gwenbuild)

Definition at line 1044 of file gwenbuild.c.

References GWB_GBuilderDescr_ReadAll(), GWBUILD_GetTargetIsWindows(), GWEN_Buffer_AppendString(), GWEN_Buffer_free(), GWEN_Buffer_GetStart(), GWEN_Buffer_new(), and GWEN_DIR_SEPARATOR_S.

Referenced by _getBuilderByName().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWBUILD_AddBuildFilename()

void GWBUILD_AddBuildFilename ( GWENBUILD gwenbuild,
const char *  s 
)

Definition at line 147 of file gwenbuild.c.

References GWEN_StringList_AppendString().

Referenced by _addBuildFileNameToGwBuild().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWBUILD_AddFilesFromStringList()

void GWBUILD_AddFilesFromStringList ( GWB_FILE_LIST2 *  mainFileList,
const char *  sFolder,
const GWEN_STRINGLIST fileNameList,
GWB_FILE_LIST2 *  outFileList,
uint32_t  flagsToAdd,
int  copyFileForOutList 
)

Definition at line 1009 of file gwenbuild.c.

References GWB_File_AddFlags(), GWB_File_dup(), GWB_File_List2_GetOrCreateFile(), GWEN_StringList_FirstEntry(), GWEN_StringListEntry_Data(), and GWEN_StringListEntry_Next().

Referenced by _readFilesFromDataNode().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWBUILD_AddFlags()

void GWBUILD_AddFlags ( GWENBUILD gwenbuild,
uint32_t  f 
)

Definition at line 98 of file gwenbuild.c.

Referenced by GWB_Setup().

Here is the caller graph for this function:

◆ GWBUILD_Debug_PrintBuildCmdList2()

void GWBUILD_Debug_PrintBuildCmdList2 ( const char *  sName,
const GWB_BUILD_CMD_LIST2 *  buildCmdList2,
int  indent 
)

Definition at line 436 of file gwenbuild.c.

References GWB_BuildCmd_Dump().

Referenced by GWB_BuildCtx_Dump(), and GWB_BuildCtx_FillWaitingQueue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWBUILD_Debug_PrintBuilderList2()

void GWBUILD_Debug_PrintBuilderList2 ( const char *  sName,
const GWB_BUILDER_LIST2 *  builderList2,
int  indent,
int  fullDump 
)

Definition at line 409 of file gwenbuild.c.

References GWB_Builder_Dump().

Referenced by GWB_Project_Dump().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWBUILD_Debug_PrintDb()

void GWBUILD_Debug_PrintDb ( const char *  sName,
GWEN_DB_NODE db,
int  indent 
)

Definition at line 273 of file gwenbuild.c.

References GWEN_DB_Dump().

Referenced by GWB_Context_Dump().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWBUILD_Debug_PrintFile()

void GWBUILD_Debug_PrintFile ( const char *  sName,
const GWB_FILE file,
int  indent 
)

Definition at line 287 of file gwenbuild.c.

References GWB_FILE_FLAGS_DIST, GWB_FILE_FLAGS_GENERATED, GWB_FILE_FLAGS_INSTALL, GWB_File_GetFileType(), GWB_File_GetFlags(), GWB_File_GetFolder(), GWB_File_GetId(), GWB_File_GetInstallPath(), and GWB_File_GetName().

Referenced by GWB_Target_Dump(), and GWBUILD_Debug_PrintFileList2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWBUILD_Debug_PrintFileList2()

void GWBUILD_Debug_PrintFileList2 ( const char *  sName,
const GWB_FILE_LIST2 *  fileList2,
int  indent 
)

Definition at line 334 of file gwenbuild.c.

References GWBUILD_Debug_PrintFile(), and NULL.

Referenced by GWB_BuildCmd_Dump(), GWB_BuildCtx_Dump(), GWB_Builder_Dump(), GWB_Context_Dump(), GWB_Project_Dump(), and GWB_Target_Dump().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWBUILD_Debug_PrintIntValue()

void GWBUILD_Debug_PrintIntValue ( const char *  sName,
int  value,
int  indent 
)

Definition at line 236 of file gwenbuild.c.

Referenced by GWB_BuildCmd_Dump(), GWB_Project_Dump(), and GWB_Target_Dump().

Here is the caller graph for this function:

◆ GWBUILD_Debug_PrintKvpList()

void GWBUILD_Debug_PrintKvpList ( const char *  sName,
const GWB_KEYVALUEPAIR_LIST *  kvpList,
int  indent 
)

Definition at line 247 of file gwenbuild.c.

References GWB_KeyValuePair_GetKey(), GWB_KeyValuePair_GetValue(), and GWBUILD_Debug_PrintValue().

Referenced by GWB_BuildCmd_Dump(), GWB_Context_Dump(), GWB_Option_Dump(), and GWB_Project_Dump().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWBUILD_Debug_PrintOptionList()

void GWBUILD_Debug_PrintOptionList ( const char *  sName,
const GWB_OPTION_LIST *  optionList,
int  indent 
)

Definition at line 388 of file gwenbuild.c.

References GWB_Option_Dump().

Referenced by GWB_Project_Dump().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWBUILD_Debug_PrintStringList()

void GWBUILD_Debug_PrintStringList ( const char *  sName,
const GWEN_STRINGLIST sl,
int  indent 
)

Definition at line 463 of file gwenbuild.c.

References GWEN_StringList_FirstEntry(), GWEN_StringListEntry_Data(), and GWEN_StringListEntry_Next().

Referenced by GWB_Option_Dump(), and GWB_Target_Dump().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWBUILD_Debug_PrintTargetList2()

void GWBUILD_Debug_PrintTargetList2 ( const char *  sName,
const GWB_TARGET_LIST2 *  targetList2,
int  indent,
int  fullDump 
)

Definition at line 361 of file gwenbuild.c.

References GWB_Target_Dump().

Referenced by GWB_Project_Dump().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWBUILD_Debug_PrintValue()

void GWBUILD_Debug_PrintValue ( const char *  sName,
const char *  sValue,
int  indent 
)

Definition at line 225 of file gwenbuild.c.

Referenced by GWB_BuildCmd_Dump(), GWB_Builder_Dump(), GWB_Context_Dump(), GWB_Option_Dump(), GWB_Project_Dump(), GWB_Target_Dump(), and GWBUILD_Debug_PrintKvpList().

Here is the caller graph for this function:

◆ GWBUILD_DelFlags()

void GWBUILD_DelFlags ( GWENBUILD gwenbuild,
uint32_t  f 
)

Definition at line 105 of file gwenbuild.c.

◆ GWBUILD_free()

void GWBUILD_free ( GWENBUILD gwenbuild)

Definition at line 72 of file gwenbuild.c.

References GWEN_FREE_OBJECT, and GWEN_StringList_free().

Here is the call graph for this function:

◆ GWBUILD_GetArchFromTriplet()

const char* GWBUILD_GetArchFromTriplet ( const char *  sTriplet)

Definition at line 985 of file gwenbuild.c.

References GWEN_Text_ComparePattern().

Referenced by _determineTarget().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWBUILD_GetBuildFilenameList()

GWEN_STRINGLIST* GWBUILD_GetBuildFilenameList ( const GWENBUILD gwenbuild)

Definition at line 140 of file gwenbuild.c.

Referenced by GWB_Utils_WriteBuildFileList().

Here is the caller graph for this function:

◆ GWBUILD_GetFlags()

uint32_t GWBUILD_GetFlags ( const GWENBUILD gwenbuild)

Definition at line 84 of file gwenbuild.c.

Referenced by _determineTarget(), and _genBuilderForTarget().

Here is the caller graph for this function:

◆ GWBUILD_GetHostArch()

const char* GWBUILD_GetHostArch ( void  )

Definition at line 906 of file gwenbuild.c.

Referenced by _determineTarget().

Here is the caller graph for this function:

◆ GWBUILD_GetHostSystem()

const char* GWBUILD_GetHostSystem ( void  )

Definition at line 954 of file gwenbuild.c.

Referenced by _determineTarget().

Here is the caller graph for this function:

◆ GWBUILD_GetModificationTimeOfFile()

time_t GWBUILD_GetModificationTimeOfFile ( const char *  filename)

Definition at line 885 of file gwenbuild.c.

References DBG_INFO, and NULL.

Referenced by _checkDatesOfFileAgainstList(), _filesChanged(), _getHighestModificationTime(), and _getLowestModificationTime().

Here is the caller graph for this function:

◆ GWBUILD_GetPathFromEnvironment()

GWEN_STRINGLIST* GWBUILD_GetPathFromEnvironment ( void  )

Definition at line 154 of file gwenbuild.c.

References GWEN_StringList_fromString2(), GWEN_TEXT_FLAGS_CHECK_BACKSLASH, GWEN_TEXT_FLAGS_DEL_LEADING_BLANKS, GWEN_TEXT_FLAGS_DEL_QUOTES, GWEN_TEXT_FLAGS_DEL_TRAILING_BLANKS, and NULL.

Referenced by _determineTools(), and _parseProg().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWBUILD_GetSystemFromTriplet()

const char* GWBUILD_GetSystemFromTriplet ( const char *  sTriplet)

Definition at line 997 of file gwenbuild.c.

References GWEN_Text_ComparePattern().

Referenced by _determineTarget().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWBUILD_GetTargetIsWindows()

int GWBUILD_GetTargetIsWindows ( const GWENBUILD gwenbuild)

Definition at line 126 of file gwenbuild.c.

Referenced by _readBuilderDescrList(), and GWB_GenericBuilder_Factory().

Here is the caller graph for this function:

◆ GWBUILD_GetTargetSystem()

const char* GWBUILD_GetTargetSystem ( const GWENBUILD gwenbuild)

Definition at line 112 of file gwenbuild.c.

◆ GWBUILD_MakeBuildCommands()

GWB_BUILD_CONTEXT* GWBUILD_MakeBuildCommands ( GWB_PROJECT project)

Definition at line 750 of file gwenbuild.c.

References _addBuildCommandsFromBuilder(), _addExplicitBuildCommandsFromTargets(), DBG_INFO, GWB_BuildCtx_free(), GWB_BuildCtx_new(), GWB_BuildCtx_SetInitialSourceDir(), GWB_Context_GetInitialSourceDir(), GWB_Project_GetRootContext(), and NULL.

Referenced by GWB_Setup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWBUILD_MakeBuildersForTargets()

int GWBUILD_MakeBuildersForTargets ( GWB_PROJECT project)

Definition at line 489 of file gwenbuild.c.

References _addOrBuildTargetSources(), _addSubTargets(), _genBuilderForTarget(), DBG_INFO, GWB_Project_AddBuilder(), GWB_Project_GetTargetList(), GWB_Target_SetBuilder(), GWEN_ERROR_GENERIC, and NULL.

Referenced by GWB_Setup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWBUILD_new()

GWENBUILD* GWBUILD_new ( void  )

Definition at line 60 of file gwenbuild.c.

References GWEN_NEW_OBJECT, and GWEN_StringList_new().

Referenced by GWB_Setup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWBUILD_SetFlags()

void GWBUILD_SetFlags ( GWENBUILD gwenbuild,
uint32_t  f 
)

Definition at line 91 of file gwenbuild.c.

◆ GWBUILD_SetTargetIsWindows()

void GWBUILD_SetTargetIsWindows ( GWENBUILD gwenbuild,
int  i 
)

Definition at line 133 of file gwenbuild.c.

Referenced by _determineTarget().

Here is the caller graph for this function:

◆ GWBUILD_SetTargetSystem()

void GWBUILD_SetTargetSystem ( GWENBUILD gwenbuild,
const char *  s 
)

Definition at line 119 of file gwenbuild.c.

References NULL.

Referenced by _determineTarget().

Here is the caller graph for this function:

◆ GWBUILD_TargetType_fromString()

GWBUILD_TARGETTYPE GWBUILD_TargetType_fromString ( const char *  s)

◆ GWBUILD_TargetType_toString()

const char* GWBUILD_TargetType_toString ( GWBUILD_TARGETTYPE  tt)