usr.bin/make/suff.c
/*-
 *-----------------------------------------------------------------------
 * Suff_DoPaths --
 *	Extend the search paths for all suffixes to include the default
 *	search path.
 *
 * Results:
 *	None.
 *
 * Side Effects:
 *	The searchPath field of all the suffixes is extended by the
 *	directories in dirSearchPath. If paths were specified for the
 *	".h" suffix, the directories are stuffed into a global variable
 *	called ".INCLUDES" with each directory preceeded by a -I. The same
 *	is done for the ".a" suffix, except the variable is called
 *	".LIBS" and the flag is -L.
 *-----------------------------------------------------------------------
 */
Suff_DoPaths
Extend the search paths for all suffixes to include the default
search path.

None.

Side Effects:
The searchPath field of all the suffixes is extended by the
directories in dirSearchPath. If paths were specified for the
".h" suffix, the directories are stuffed into a global variable
called ".INCLUDES" with each directory preceeded by a -I. The same
is done for the ".a" suffix, except the variable is called
".LIBS" and the flag is -L.
Suff_DoPaths Extend the search paths for all suffixes to include the default search path . None . Side Effects : The searchPath field of all the suffixes is extended by the directories in dirSearchPath . If paths were specified for the " . h " suffix the directories are stuffed into a global variable called " . INCLUDES " with each directory preceeded by a - I . The same is done for the " . a " suffix except the variable is called " . LIBS " and the flag is - L .
void
Suff_DoPaths()
{
    register Suff   	*s;
    register LstNode  	ln;
    char		*ptr;
    Lst	    	    	inIncludes; 
    Lst	    	    	inLibs;	    
    if (Lst_Open (sufflist) == FAILURE) {
	return;
    }
    inIncludes = Lst_Init(FALSE);
    inLibs = Lst_Init(FALSE);
    while ((ln = Lst_Next (sufflist)) != NILLNODE) {
	s = (Suff *) Lst_Datum (ln);
	if (!Lst_IsEmpty (s->searchPath)) {
#ifdef INCLUDES
	    if (s->flags & SUFF_INCLUDE) {
		Dir_Concat(inIncludes, s->searchPath);
	    }
#endif 
#ifdef LIBRARIES
	    if (s->flags & SUFF_LIBRARY) {
		Dir_Concat(inLibs, s->searchPath);
	    }
#endif 
	    Dir_Concat(s->searchPath, dirSearchPath);
	} else {
	    Lst_Destroy (s->searchPath, Dir_Destroy);
	    s->searchPath = Lst_Duplicate(dirSearchPath, Dir_CopyDir);
	}
    }
    Var_Set(".INCLUDES", ptr = Dir_MakeFlags("-I", inIncludes), VAR_GLOBAL);
    free(ptr);
    Var_Set(".LIBS", ptr = Dir_MakeFlags("-L", inLibs), VAR_GLOBAL);
    free(ptr);
    Lst_Destroy(inIncludes, Dir_Destroy);
    Lst_Destroy(inLibs, Dir_Destroy);
    Lst_Close (sufflist);
}
void Suff_DoPaths ( ) { register Suff * s ; register LstNode ln ; char * ptr ; Lst inIncludes ; Lst inLibs ; if ( Lst_Open ( sufflist ) == FAILURE ) { return ; } inIncludes = Lst_Init ( FALSE ) ; inLibs = Lst_Init ( FALSE ) ; while ( ( ln = Lst_Next ( sufflist ) ) != NILLNODE ) { s = ( Suff * ) Lst_Datum ( ln ) ; if ( ! Lst_IsEmpty ( s -> searchPath ) ) { #ifdef INCLUDES if ( s -> flags & SUFF_INCLUDE ) { Dir_Concat ( inIncludes , s -> searchPath ) ; } #endif #ifdef LIBRARIES if ( s -> flags & SUFF_LIBRARY ) { Dir_Concat ( inLibs , s -> searchPath ) ; } #endif Dir_Concat ( s -> searchPath , dirSearchPath ) ; } else { Lst_Destroy ( s -> searchPath , Dir_Destroy ) ; s -> searchPath = Lst_Duplicate ( dirSearchPath , Dir_CopyDir ) ; } } Var_Set ( " " , ptr = Dir_MakeFlags ( " " , inIncludes ) , VAR_GLOBAL ) ; free ( ptr ) ; Var_Set ( " " , ptr = Dir_MakeFlags ( " " , inLibs ) , VAR_GLOBAL ) ; free ( ptr ) ; Lst_Destroy ( inIncludes , Dir_Destroy ) ; Lst_Destroy ( inLibs , Dir_Destroy ) ; Lst_Close ( sufflist ) ; }
Suff_DoPaths
      Extend the search paths for all suffixes to include the default
      search path.
Suff_DoPaths Extend the search paths for all suffixes to include the default search path .
/* Cumulative .INCLUDES path */ /* Cumulative .LIBS path */ /* INCLUDES */ /* LIBRARIES */