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

File: [Development] / JSOC / build / ccd-gcc (download)
Revision: (vendor branch), Mon Oct 1 23:12:21 2007 UTC (15 years, 2 months ago) by arta
Branch: Vtag
CVS Tags: Ver_DRMSLATEST, Ver_8-8, Ver_8-7, Ver_8-6, Ver_8-5, Ver_8-4, Ver_8-3, Ver_8-2, Ver_8-10, Ver_8-1, Ver_8-0, Ver_7-1, Ver_7-0, Ver_6-4, Ver_6-3, Ver_6-2, Ver_6-1, Ver_6-0, Ver_5-9, Ver_5-8, Ver_5-7, Ver_5-6, Ver_5-5, Ver_5-3, Ver_5-2, Ver_5-14, Ver_5-13, Ver_5-12, Ver_5-11, Ver_5-10, Ver_5-1, Ver_5-0, Ver_4-7, Ver_4-6, Ver_4-5, Ver_4-4, Ver_4-3, Ver_4-2, Ver_4-1, Ver_4-0, NewTree01_cp09_JSOC, NewTree01_cp08_JSOC, NewTree01_cp07_JSOC, NewTree01_cp06_JSOC, NewTree01_cp05_JSOC, NewTree01_cp04_JSOC, NewTree01_cp03_JSOC, NewTree01_cp02_JSOC, NewTree01_cp01_JSOC, NetDRMS_Ver_9-9, NetDRMS_Ver_8-8, NetDRMS_Ver_8-7, NetDRMS_Ver_8-6, NetDRMS_Ver_8-5, NetDRMS_Ver_8-4, NetDRMS_Ver_8-3, NetDRMS_Ver_8-2, NetDRMS_Ver_8-10, NetDRMS_Ver_8-1, NetDRMS_Ver_8-0, NetDRMS_Ver_7-1, NetDRMS_Ver_7-0, NetDRMS_Ver_6-4, NetDRMS_Ver_6-3, NetDRMS_Ver_6-2, NetDRMS_Ver_6-1, NetDRMS_Ver_6-0, NetDRMS_Ver_2-7, NetDRMS_Ver_2-6, NetDRMS_Ver_2-5, NetDRMS_Ver_2-4, NetDRMS_Ver_2-3, NetDRMS_Ver_2-2, NetDRMS_Ver_2-1, NetDRMS_Ver_2-0b1, NetDRMS_Ver_2-0b, NetDRMS_Ver_2-0a2, NetDRMS_Ver_2-0a1, NetDRMS_Ver_2-0a, NetDRMS_Ver_2-0, NetDRMS_Ver_1-1, NetDRMS_Ver_1-0, NetDRMS_Ver_0-9, NetDRMS_Ver_0-8, NetDRMS_Ver_0-7
Changes since 1.1: +0 -0 lines
First new, reorganized JSOC tree

# 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 -MD $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