#/***************************************************************************** ## Copyright (C) 1994-2008 by David Gordon. ## All rights reserved. ## ## This software is part of a beta-test version of the Consed/Autofinish ## package. It should not be redistributed or ## used for any commercial purpose, including commercially funded ## sequencing, without written permission from the author and the ## University of Washington. ## ## This software is provided ``AS IS'' and any express or implied ## warranties, including, but not limited to, the implied warranties of ## merchantability and fitness for a particular purpose, are disclaimed. ## In no event shall the authors or the University of Washington be ## liable for any direct, indirect, incidental, special, exemplary, or ## consequential damages (including, but not limited to, procurement of ## substitute goods or services; loss of use, data, or profits; or ## business interruption) however caused and on any theory of liability, ## whether in contract, strict liability, or tort (including negligence ## or otherwise) arising in any way out of the use of this software, even ## if advised of the possibility of such damage. ## ## Building Consed from source is error prone and not simple which is ## why I provide executables. Due to time limitations I cannot ## provide any assistance in building Consed. Even if you do not ## modify the source, you may introduce errors due to using a ## different version of the compiler, a different version of motif, ## different versions of other libraries than I used, etc. For this ## reason, if you discover Consed bugs, I can only offer help with ## those bugs if you first reproduce those bugs with an executable ## provided by me--not an executable you have built. ## ## Modifying Consed is also difficult. Although Consed is modular, ## some modules are used by many other modules. Thus making a change ## in one place can have unforeseen effects on many other features. ## It may takes months for you to notice these other side-effects ## which may not seen connected at all. It is not feasable for me to ## provide help with modifying Consed sources because of the ## potentially huge amount of time involved. ## ##*****************************************************************************/ #!/usr/local/bin/perl -w # PURPOSE: to create the makefiles by creating the dependency lists # # DG, January 2000 # # HOW TO USE IT: This must be run on kwakiutl # makeDepend.perl (computer name) $szUsage = "makeDependMelakwa.perl (computer name)"; if ( $#ARGV != 0 ) { die "$szUsage" } $szTargetComputer = $ARGV[0]; %aComputers = ("chinook", 1, "enki", 1, "genefinder", 1, "hoh", 1, "haida", 1, "melakwa", 1, "kwakiutl", 1, "kiwa", 1, "tlingit", 1, "tyee", 1, "walrus", 1, "wherry", 1, "widget", 1, "winter", 1, "wit", 1 ); if ( !exists( $aComputers{ $szTargetComputer } ) ) { die "$szTargetComputer isn't found in list of acceptable computers"; } #goto testing; if ( -e "makeDependencies" ) { unlink( "makeDependencies" ) || die "couldn't delete makeDependencies"; } $szCommand = "cat mk_header_melakwa_for_make_dependencies >makeDependencies"; !system( $szCommand ) || die "couldn't execute $szCommand"; $szCommand = "cat mk_targets >>makeDependencies"; !system( $szCommand ) || die "couldn't execute $szCommand"; if ( -e "dependencies" ) { unlink( "dependencies" ) || die "couldn't delete dependencies"; } @aObjectFilesLeftAround = <*.o>; if ( $#aObjectFilesLeftAround >= 0 ) { !system( "rm *.o" ) || die "couldn't delete *.o"; } # just hides errors from widget's 1 second slower clock if ( $szTargetComputer eq "widget" ) { sleep 3; } $szCommand = "make -f makeDependencies dummy_dependencies >dependencies"; print "about to execute $szCommand\n"; !system( $szCommand ) || die "couldn't execute $szCommand"; # process dependencies file testing: rename( "dependencies", "dependencies.bu" ) || die "couldn't rename dependencies to dependencies.bu"; open( filRaw, "dependencies.bu" ) || die "couldn't open dependencies.bu"; open( filProcessed, ">dependencies" ) || die "couldn't open dependencies for output"; $szOldModule = ""; while( ) { # looks like: # g++ -w -DINLINE_RWTPTRORDEREDVECTOR -DINLINE_RWTVALORDEREDVECTOR -DINLINE_MBTVALVECTOR -DLINUX_COMPILE -D__BOOL_DEFINED -DANSI_C -DNO_POUND_POUND_MACROS -I/usr/X11R6/include -I/opt/motif12/include -MM -E -c findAncestralTrees.cpp # findAncestralTrees.o: findAncestralTrees.cpp rwcstring.h bool.h rwdefs.h \ # rwcsubstring.h rwtptrvector.h mbt_exception.h soGetErrno.h \ # soEmptyString.h rwtvalorderedvector.h rwtvalorderedvector_inc.cpp \ # assert.h consedParameters.h sysdepend.h filename.h consedResources.h \ # mbtPtrOrderedVector.h rwtptrorderedvector.h rwtptrorderedvector_inc.cpp \ # restrictionEnzyme.h assemblyViewTagTypeAndLine.h \ # mbtValOrderedVectorOfRWCString.h whatIsRunning.h findAncestralTrees.h # This gets rid of the g++ line if ( /^g\+\+ / ) { next; } # looks like this: # guiEditResources.o: guiEditResources.cpp guiEditResources.h \ # consedResources.h rwcstring.h bool.h rwdefs.h rwcsubstring.h filename.h \ # sysdepend.h rwtvalorderedvector.h mbt_exception.h soGetErrno.h \ # soEmptyString.h rwtvalorderedvector_inc.cpp \ # bIsNumericMaybeWithWhitespace.h popupErrorMessage.h bIsNumericDouble.h \ # guiapp.h motifutils.h guicolortext.h rwtptrorderedvector.h \ # rwtptrorderedvector_inc.cpp handleWindowManagerDelete2.h \ # hp_exception_kludge.h consedParameters.h mbtPtrOrderedVector.h \ # restrictionEnzyme.h assemblyViewTagTypeAndLine.h \ # mbtValOrderedVectorOfRWCString.h assert.h please_wait.h textbox.h \ # guiTopWindow.h waitUntilDialogIsVisible.h popupInfoMessage.h if (/^ / ) { @aWords = split; if ( $aWords[-1] eq "\\" ) { pop( @aWords ); } @aWords = &eliminateSystemFiles( @aWords ); push( @aIncludeFiles, @aWords ); # print "include files: ", @aIncludeFiles, "\n"; # print "after pushing words: ", @aWords, "\n"; } else { @aWords = split; $szModule = $aWords[0]; if ( $szModule !~ /:$/ ) { die "don't understand2 line $_"; } if ( $aWords[-1] eq "\\" ) { pop( @aWords ); } $szModule =~ s/:$//; if ( $szOldModule ne $szModule ) { if ( $szOldModule ne "" ) { &printOldModule(); } $szOldModule = $szModule; } shift @aWords; @aWords = &eliminateSystemFiles( @aWords ); @aIncludeFiles = @aWords; } } &printOldModule(); close( filRaw ); close( filProcessed ); if ( $szTargetComputer eq "chinook" ) { &cat_makefile( "mk_header_chinook", "makefile_chinook" ); } elsif ( $szTargetComputer eq "enki" ) { &cat_makefile( "mk_header_enki", "makefile_enki" ); } elsif ( $szTargetComputer eq "genefinder" ) { &cat_makefile( "mk_header_melakwa", "makefile_genefinder" ); } elsif ( $szTargetComputer eq "haida" ) { &cat_makefile( "mk_header_haida", "makefile_haida" ); &cat_makefile( "mk_header_haida64", "makefile_haida64" ); } elsif ( $szTargetComputer eq "hoh" ) { &cat_makefile( "mk_header_hoh", "makefile_hoh" ); } elsif ( $szTargetComputer eq "inapoo" ) { &cat_makefile( "mk_header_inapoo", "makefile_inapoo" ); } elsif( $szTargetComputer eq "melakwa" ) { &cat_makefile( "mk_header_melakwa", "makefile_melakwa" ); &cat_makefile( "mk_header_melakwa_dyn", "makefile_melakwa_dyn" ); } elsif ( $szTargetComputer eq "kwakiutl" ) { &cat_makefile( "mk_header_kwakiutl", "makefile_kwakiutl" ); &cat_makefile( "mk_header_kwakiutl_gprof", "makefile_kwakiutl_gprof" ); &cat_makefile( "mk_header_kwakiutl_opt", "makefile_kwakiutl_opt" ); &cat_makefile( "mk_header_kwakiutl_dyn", "makefile_kwakiutl_dyn" ); } elsif ( $szTargetComputer eq "kiwa" ) { &cat_makefile( "mk_header_kiwa", "makefile_kiwa" ); } elsif ( $szTargetComputer eq "tlingit" ) { &cat_makefile( "mk_header_tlingit", "makefile_tlingit" ); } elsif ( $szTargetComputer eq "tyee" ) { &cat_makefile( "mk_header_tyee", "makefile_tyee" ); } elsif ( $szTargetComputer eq "wally" ) { &cat_makefile( "mk_header_wally", "makefile_wally" ); } elsif( $szTargetComputer eq "walrus" ) { &cat_makefile( "mk_header_walrus", "makefile_walrus" ); } elsif( $szTargetComputer eq "wherry" ) { &cat_makefile( "mk_header_wherry", "makefile_wherry" ); &cat_makefile( "mk_header_wherry_dyn", "makefile_wherry_dyn" ); } elsif( $szTargetComputer eq "widget" ) { &cat_makefile( "mk_header_widget", "makefile_widget" ); } elsif( $szTargetComputer eq "wit" ) { &cat_makefile( "mk_header_wit_dyn", "makefile_wit" ); &cat_makefile( "mk_header_wit", "makefile_wit_static" ); } elsif( $szTargetComputer eq "winter" ) { &cat_makefile( "mk_header_winter", "makefile_winter" ); } # in all cases make a makefile for umpqua &cat_makefile( "mk_header_umpqua", "makefile_umpqua" ); $szNewMakefile = "makefile_" . $szTargetComputer; $szCommand = "cp $szNewMakefile makefile"; !system( $szCommand ) || die "couldn't execute $szCommand"; # cleanup # since I need dependencies for umpqua, for now I don't want to delete # this file #unlink( "dependencies" ); # unlink( "dependencies.bu" ); sub cat_makefile { $szMkHeader = $_[0]; $szMakefileName = $_[1]; if ( -e $szMakefileName ) { unlink( $szMakefileName ) || die "could not delete $szMakefileName"; } $szCommand = "cat $szMkHeader >$szMakefileName"; !system( $szCommand ) || die "could not execute $szCommand"; $szCommand = "cat mk_targets >>$szMakefileName"; !system( $szCommand ) || die "could not execute $szCommand"; # Nov 2006 since kwakiutl compiler cannot optimize guiEditResources.cpp # Jun 2007--let's not optimize guiEditResources on any computer so putting # it in mk_targets # if ( $szTargetComputer eq "kwakiutl" ) { # $szCommand = "cat mk_kwakiutl_guiEditResources >>$szMakefileName"; # !system( $szCommand ) || die "could not execute $szCommand"; # } $szCommand = "cat dependencies >>$szMakefileName"; !system( $szCommand ) || die "could not execute $szCommand"; } sub printOldModule() { my @aSortedIncludeFiles = sort @aIncludeFiles; print filProcessed "$szOldModule : \\\n"; print filProcessed "\t"; my $nHeadersOnLine = 0; my $szOneHeader; foreach $szOneHeader ( @aSortedIncludeFiles ) { if ( $nHeadersOnLine >= 3 ) { print filProcessed " \\\n"; print filProcessed "\t"; $nHeadersOnLine = 0; } print filProcessed " $szOneHeader"; ++$nHeadersOnLine; } print filProcessed"\n\n"; } sub eliminateSystemFiles { my @aWords = @_; my @aNewWords = (); foreach $szWord (@aWords ) { if ( $szWord !~ m!/usr/X11R6! ) { push( @aNewWords, $szWord ); } } return @aNewWords; }