(file) Return to ccd-icc CVS log (file) (dir) Up to [Development] / JSOC / build

File: [Development] / JSOC / build / ccd-icc (download)
Revision: 1.2, Mon Apr 18 16:15:51 2016 UTC (7 years, 5 months ago) by arta
Branch: MAIN
CVS Tags: Ver_LATEST, Ver_9-5, Ver_9-41, Ver_9-4, Ver_9-3, Ver_9-2, Ver_9-1, Ver_9-0, Ver_8-12, Ver_8-11, NetDRMS_Ver_LATEST, NetDRMS_Ver_9-5, NetDRMS_Ver_9-41, NetDRMS_Ver_9-4, NetDRMS_Ver_9-3, NetDRMS_Ver_9-2, NetDRMS_Ver_9-1, NetDRMS_Ver_9-0, NetDRMS_Ver_8-12, NetDRMS_Ver_8-11, HEAD
Changes since 1.1: +1 -1 lines
Do not include system header files in the compiler dependency files (.o.d). Otherwise, if you change systems after a make, everything gets remade

# CCDEPS-GCC (C) 2002 Emile van Bergen. Distribution of this file is allowed
# under the conditions detailed in the GNU General Public License (GPL). See 
# the file COPYING for more information.
# This script compiles and/or links one or more source or object files into a
# object file or executable target, and outputs all extra dependencies found
# while doing so in a file named target.d, which can be used by GNU Make.
# The script should be invoked the same way as your C compiler, that is,
# specifying the target using a -o option and the source or object files as 
# non-option arguments. It will generate dependencies in the form
# target target.d: dir/file1.c dir/file2.c header1.h header2.h
# dir/file1.c dir/file2.c header1.h header2.h:
# This version is intended for GCC, which can do compilation and dependency
# generation in one step. The name of the GCC version (default gcc) can be
# overridden using the CC environment variable.
# 2003/1/8: EvB: adapted for gcc 3.2, still handles 2.95 as well.
#   This was necessary because gcc 3.2 handles -MD differently than gcc 2.95:
#   where the old version generated a .d file for each source, in the current
#   directory, the new one does almost completely what this script intended to
#   do: generate one .d file in the same directory and with the same file name
#   as the target.
#   The only fixups 3.2's .d files still need are:
#   - changing the file name; gcc 3.2 strips the suffix of the target before 
#     appending the .d, so targets x and x.o will both produce x.d, which is
#     not what we want;
#   - adding the implicit dependencies as prerequisiteless targets, so that
#     make will just consider the target out of date if one does not exist
#     anymore; 
#   - adding the .d file as depending on the same prerequisites as our real
#     target so that it will be considered out of date if one of the files
#     mentioned in it are updated or missing.
#   Basically, this version does all that by simply including the file
#   <strippedtarget>.d file in the list of .d files we look for. We may end
#   up generating the same file name, but that already was handled correctly.
#   Otherwise we perform the normal routine, so that we /know/ the targets will
#   be correct, directories and all, regardless of variations in gcc behaviour.


while [ x"$1" != x ]
	case "$1" in
		-o) tgt="$2" ; shift ;;	# target specifier option
		-x|-u|-b|-V) shift ;;	# options with arg after space
		-*) ;;			# standard options
		*) fil="$fil $1" ;;	# source or object files


# If we're not processing any .c files (link only), run gcc as-is and we're done

expr "$fil" : ".*\.c" >/dev/null || exec $CC $cmdline

# Otherwise, run the gcc with the -MD option, which generates a .d file
# in the current directory for each .c or .cc source file processed.
# These files are post-processed (replacing the incorrectly named target
# with the real target specified with -o, and adding the .d file), concatenated
# into one .d file that is named based on the target name, and put in the
# correct directory. Further, all prerequisites are added as bare targets,
# preventing errors when files are missing due to renaming or restructuring
# headers, but causing the files dependent on them to be considered out of
# date. (GNU Make feature).
# Makefiles must include the .d files like this: -include $(OBJS_$(d):.o=.d)
# or, when compiling and linking in one step: -include $(TGTS_$(d):%=%.d)

rm -f $dep

$CC -MMD $cmdline

dgcc3=`echo $tgt | sed -e 's/\.[^.]*$//'`.d
dgcc=`echo $fil | sed -e 's/[^ 	]*\.[^c]//' -e 's/\.c/\.d/g' -e 's%.*/%%g'`

if [ $res != 0 ]
	rm -f $dgcc3 $dgcc
	exit $res

for tf in $dgcc3 $dgcc
	if [ -f $tf ] && mv $tf $dep.tmp
		sed -e "s%.*:%$tgt $dep:%" < $dep.tmp >> $dep
		sed -e 's%^.*:%%' -e 's%^ *%%' -e 's% *\\$%%' -e 's%$%:%' \
			< $dep.tmp >> $dep
		rm -f $dep.tmp

[ "$found" = "1" ] && exit 0

echo ERROR: $0: Cannot find any compiler-generated dependency files\!
exit 1

Karen Tian
Powered by
ViewCVS 0.9.4