Skip to content

Salakksson/fastdep.sh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fastdep - C/C++ dependancy caching script

image

Usage

fastdep [-d <depfile>] [-o <object>] [--compiler <compiler>] <file>
returns: <file> <dep1> <dep2> <dep3> ... in stdout

<compiler> must support the -MM flag such as gcc
<object> is the object <file> compiles to

the following is an example of usage within a shell script, fastdep is used to skip files we know we dont need to compile

objects=""
for file in src/*.c
do
	out=${file/src/$BUILD_DIR}.o
	objects="$objects $out"
	
	skip=true
	
	for dep in $(fastdep $file -o $out -d $DEPFILE)
	do
		if [ $file -nt $out ];
		then
			skip=false;
		fi
	done

	if $skip;
	then
		echo × skipping $file$out
		continue
	fi
	
	echo $CC -c $CCFLAGS $file -o $out
	$CC -c $CCFLAGS $file -o $out
done

$CC $objects -o $TARGET

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published