head	1.13;
access;
symbols;
locks; strict;
comment	@# @;


1.13
date	95.04.25.20.57.09;	author narain;	state Exp;
branches;
next	1.12;

1.12
date	95.04.25.04.53.54;	author narain;	state Exp;
branches;
next	1.11;

1.11
date	95.04.14.20.04.52;	author sanjeev;	state Exp;
branches;
next	1.10;

1.10
date	95.03.24.18.14.35;	author sanjeev;	state Exp;
branches;
next	1.9;

1.9
date	95.02.28.21.10.33;	author jyelon;	state Exp;
branches;
next	1.8;

1.8
date	95.02.28.20.57.25;	author jyelon;	state Exp;
branches;
next	1.7;

1.7
date	95.02.28.20.41.15;	author jyelon;	state Exp;
branches;
next	1.6;

1.6
date	95.02.16.22.38.23;	author knauff;	state Exp;
branches;
next	1.5;

1.5
date	95.02.03.19.24.11;	author sanjeev;	state Exp;
branches;
next	1.4;

1.4
date	94.11.30.18.26.41;	author narain;	state Exp;
branches;
next	1.3;

1.3
date	94.11.18.20.24.55;	author narain;	state Exp;
branches;
next	1.2;

1.2
date	94.11.09.21.21.36;	author sanjeev;	state Exp;
branches;
next	1.1;

1.1
date	94.10.14.21.01.27;	author brunner;	state Exp;
branches;
next	;


desc
@@


1.13
log
@Added tempdumdecls in Object list for Converse only version
Added case network-hp-cc (Robert's version)
@
text
@#!/bin/csh -f
############################################################################
# RCS INFORMATION:
#
#       $RCSfile: charmc,v $
#       $Author: narain $      $Locker: narain $              $State: Exp $
#       $Revision: 1.12 $        $Date: 1995/04/25 04:53:54 $
#
############################################################################
# DESCRIPTION:
#
############################################################################
# REVISION HISTORY:
#
# $Log: charmc,v $
# Revision 1.12  1995/04/25  04:53:54  narain
# changed the objects linked in when -converse is used
#
# Revision 1.11  1995/04/14  20:04:52  sanjeev
# integrating Charm and Converse
#
# Revision 1.10  1995/03/24  18:14:35  sanjeev
# removed qm
#
# Revision 1.9  1995/02/28  21:10:33  jyelon
# *** empty log message ***
#
# Revision 1.8  1995/02/28  20:57:25  jyelon
# Made charmc recognize the -I/include/file/directory and -L/lib/file/dir
# options.
#
# Revision 1.7  1995/02/28  20:41:15  jyelon
# Corrected bug - didn't work if you had CC, CPLUS, etc in your
# environment.  Also corrected bug - didn't always put .o files in
# consistent location.
#
# Revision 1.6  1995/02/16  22:38:23  knauff
# Sending unknown flags to the preprocessor as well.
#
# Revision 1.5  1995/02/03  19:24:11  sanjeev
# put in externs in module_init.c file
#
# Revision 1.4  1994/11/30  18:26:41  narain
# Added code to create a file with calls to module init functions in a single
# function. (Note : The option to directly give a list of modules is not correct
# yet).
#   -- Narain
#
# Revision 1.3  1994/11/18  20:24:55  narain
# Added a -main option to specify that the main is in the user program
#  - Sanjeev and Narain
#
# Revision 1.2  1994/11/09  21:21:36  sanjeev
# separated qm, etc
#
# Revision 1.1  1994/10/14  21:01:27  brunner
# Initial revision
#
############################################################################
#
# Configuration instructions:
#
# DEFAULT_MACHTYPE ---
#
#  The value of this variable is patched in automatically
#  by the INSTALL and SUPER_INSTALL scripts.
#

set DEFAULT_MACHTYPE=network-sun

##############################################################################
#
# Initialize the main controlling variables, then setup error handler
#
##############################################################################

set OPTS_CC=
set OPTS_CPLUS=
set OPTS_LD=
set OPTS_CPP=
set FILES=
set OBJECTFILES=
set LIBRARIES=
set CONVERSE=
onintr failure

##############################################################################
#
# The following section attempts to locate charm.
#
##############################################################################

set ORIGDIR=$cwd

# Try to find charm by looking in directory where charmc is

if ($?CHARMROOT == 0) then
    set SCRIPT=$0
    if ($SCRIPT:h != $SCRIPT:t) then
        cd $SCRIPT:h
        set SCRIPT=$SCRIPT:t
    else
        foreach dir ($path)
            if (-x $dir/$SCRIPT && ! -d $dir/$SCRIPT) then
                cd $dir
                break
            endif
        end
    endif
    while (x`find $SCRIPT -type l -print` == x$SCRIPT)
        set SCRIPT=`ls -al ./$SCRIPT:t | sed -e "s@@.*-> @@@@"`
        if ($SCRIPT:h != $SCRIPT:t) then
            cd $SCRIPT:h
            set SCRIPT=$SCRIPT:t
        endif
    end
    if (-e $cwd/.charm-beacon) then
        cd ..
        setenv CHARMROOT $cwd
    endif
endif

# Try to find charm by searching the path

if ($?CHARMROOT == 0) then
    echo -n 'Searching your path for charm... '
    foreach dir ($path)
        if (-e $dir/.charm-beacon) then
            cd $dir/..
            setenv CHARMROOT $cwd
            echo " found $cwd"
            break
        endif
    end
    if ($?CHARMROOT == 0) echo ' failed.'
endif

# Give an error message

if ($?CHARMROOT == 0) then
    echo ''
    echo 'Error - cannot find the charm directories.'
    echo ''
    echo 'Normally, charmc and the other charm scripts automatically'
    echo 'locate the charm directory, using the following strategy:'
    echo ''
    echo '  Step 1. It looks in the directory specified in $CHARMROOT.'
    echo ''
    echo '  Step 2. It looks in the directory from which charmc was run.'
    echo ''
    echo '  Step 3. It looks in every directory in your $PATH'
    echo ''
    echo 'If it searches all these places, and doesnt find the file'
    echo 'called ".charm-beacon" (which is normally hidden in the charm'
    echo 'bin-directory), it will give up.'
    echo ''
    goto failure
    endif
endif

cd $ORIGDIR

##############################################################################
#
# Parse the arguments
#
# Don't do any analysis in here, just the parsing.
#
##############################################################################


set argindex=1
while ($argindex <= $#argv)
    set arg=$argv[$argindex]
    @@ argindex = $argindex + 1

    switch ($arg)
        case "-machine"
            set MACHTYPE=$argv[$argindex]
            @@ argindex = $argindex + 1
            breaksw

        case "-language"
            set LANGUAGE=$argv[$argindex]
            @@ argindex = $argindex + 1
            breaksw

#	case "-qm"
#            set QMSTRAT=$argv[$argindex]
#            @@ argindex = $argindex + 1
#            breaksw
#
	case "-balance"
            set BALANCE=$argv[$argindex]
            @@ argindex = $argindex + 1
            breaksw

        case "-queue"
            set QUEUE=$argv[$argindex]
            @@ argindex = $argindex + 1
            breaksw

        case "-memory"
            set MEMORY=$argv[$argindex]
            @@ argindex = $argindex + 1
            breaksw

	case "-execmode"
            set EXECMODE=$argv[$argindex]
            @@ argindex = $argindex + 1
            breaksw

        case "-main"
            set MAINOBJ=
            breaksw

        case "-converse"
            set CONVERSE=1
            breaksw

        case "-verbose"
            set VERBOSE=1
            breaksw

        case "-save"
            set SAVE=1
            breaksw

        case "-cc"
            set OVERRIDE_CC=( $argv[$argindex] )
            @@ argindex = $argindex + 1
            breaksw

        case "-c++"
            set OVERRIDE_CPLUS=( $argv[$argindex] )
            @@ argindex = $argindex + 1
            breaksw

        case "-ld"
            set OVERRIDE_LD=( $argv[$argindex] )
            @@ argindex = $argindex + 1
            breaksw

        case "-cc-option"
            set OPTS_CC=( $OPTS_CC $argv[$argindex] )
            @@ argindex = $argindex + 1
            breaksw

        case "-c++-option"
            set OPTS_CPLUS=( $OPTS_CPLUS $argv[$argindex] )
            @@ argindex = $argindex + 1
            breaksw

        case "-purify"
            set PURIFY = yes
            breaksw

        case "-ld-option"
            set OPTS_LD=( $OPTS_LD $argv[$argindex] )
            @@ argindex = $argindex + 1
            breaksw

        case "-c":
            set NOLINK=1
            breaksw

	case "-o":
            set OBJECT=$argv[$argindex]
            @@ argindex = $argindex + 1
            breaksw

# Options for specifying modules 
	
	case "-modules":
	    set ACT_MOD_LIST = $argv[$argindex]
	    @@ argindex = $argindex + 1
	    breaksw

	case "-module_file":
	    set MOD_FILE_NAME = $argv[$argindex]
	    @@ argindex = $argindex + 1
	    breaksw

        case "-D*"
            set OPTS_CPP=( $OPTS_CPP "$arg" )
            set OPTS_CC=( $OPTS_CC "$arg" )
            set OPTS_CPLUS=( $OPTS_CPLUS "$arg" )
            breaksw

        case "-I*"
            set OPTS_CPP=( $OPTS_CPP "$arg" )
            set OPTS_CC=( $OPTS_CC "$arg" )
            set OPTS_CPLUS=( $OPTS_CPLUS "$arg" )
            breaksw

        case "-L*"
            set OPTS_CC=( $OPTS_CC "$arg" )
            set OPTS_CPLUS=( $OPTS_CPLUS "$arg" )
            set OPTS_LD=( $OPTS_LD "$arg" )
            breaksw

        case "-g"
            set OPTS_CC=( $OPTS_CC $arg )
            set OPTS_CPLUS=( $OPTS_CPLUS $arg )
            set OPTS_LD=( $OPTS_LD $arg )
            breaksw

        case "-O*"
            set OPTS_CC=( $OPTS_CC $arg )
            set OPTS_CPLUS=( $OPTS_CPLUS $arg )
            breaksw

        case "-l*"
            set LIBRARIES=( $LIBRARIES $arg )
            breaksw

        case "-s"
            set OPTS_LD=( $OPTS_LD $arg )
            breaksw

        case "-*"
            echo "passing unrecognized option $arg to all compilers and linkers"
            set OPTS_CC=( $OPTS_CC $arg )
            set OPTS_CPLUS=( $OPTS_CPLUS $arg )
            set OPTS_LD=( $OPTS_LD $arg )
	    set OPTS_CPP=( $OPTS_CPP $arg )
            breaksw

        case "*.*"
            set FILES=( $FILES "$arg" )
            breaksw
        
        default:
            echo "Unrecognized argument $arg"
            goto failure

    endsw
end

##############################################################################
#
# Check for valid choice of MACHTYPE
#
##############################################################################

if ($?MACHTYPE == 0) set MACHTYPE=$DEFAULT_MACHTYPE

if (! -e $CHARMROOT/bin/$MACHTYPE.machine.script) then
    echo ''
    echo 'error - there is no installed charm for "'$MACHTYPE'"'
    echo ''
    goto failure
endif

set ROOTMACH=$CHARMROOT/$MACHTYPE

##############################################################################
#
# Check for valid choice of LANGUAGE
#
##############################################################################

if ($?LANGUAGE == 0) set LANGUAGE=charm

switch ($LANGUAGE)
    case "charm"
    case "charm++":
        breaksw
    default:
        echo "charmc: Unrecognized choice of language $LANGUAGE"
endsw



##############################################################################
#
# Check for valid EXECMODE and select compatible options
#
##############################################################################

if ($?EXECMODE == 0) set EXECMODE=notrace

switch ($EXECMODE)
    case "normal":
        echo 'charmc: note - normal has been renamed to notrace. Continuing.'
    case "notrace":
        set EXECMODE=notrace
        set LOGEXEC=nothing
        set EXTRAEXEC=normal
        set EXECDIR=normal
        breaksw
    case "summary":
        set EXECMODE=summary
        set LOGEXEC=summary
        set EXTRAEXEC=normal
        set EXECDIR=normal
        breaksw
    case "projections":
        set EXECMODE=projections
        set LOGEXEC=projections
        set EXTRAEXEC=record
        set EXECDIR=debug
        breaksw
    case "record":
        set EXECMODE=record
        set LOGEXEC=record
        set EXTRAEXEC=record
        set EXECDIR=debug
        breaksw
    case "replay":
        set EXECMODE=replay
        set LOGEXEC=replay
        set EXTRAEXEC=replay
        set EXECDIR=debug
        breaksw
    default:
        echo "Link ERROR : Unknown execmode value"
        goto failure
endsw

# Check that execmode is compatible with queue and balance

if ($EXECMODE == replay) then
    if ($?QUEUE == 0) set QUEUE=replay
    if ($?BALANCE == 0) set BALANCE=replay
#    if ($?QMSTRAT == 0) set QMSTRAT=replay
    if ($QUEUE != replay) then
        echo "Ignoring -queue $QUEUE, incompatible with -execmode replay"
    endif
    if ($BALANCE != replay) then
        echo "Ignoring -balance $BALANCE, incompatible with -execmode replay"
    endif
#    if ($QMSTRAT != replay) then
#        echo "Ignoring -qm $QMSTRAT, incompatible with -execmode replay"
#    endif
    set QUEUE=replay
    set BALANCE=replay
    set QMSTRAT=replay
endif


##############################################################################
#
# Check for valid choice of MEMORY
#
##############################################################################

if ($?MEMORY == 0) set MEMORY=table

switch ($MEMORY)
    case "table":
    case "unix":
    case "leak":
        breaksw;
    default:
        echo "charmc : Unknown memory strategy $MEMORY"
        goto failure
endsw


##############################################################################
#
# Check for valid choice of QUEUE
#
##############################################################################

if ($?QUEUE == 0) set QUEUE=fifo

switch ($QUEUE)
    case "stack":
    case "fifo":
    case "fl":
    case "bfifo":
    case "ififo":
    case "bstack":
    case "istack":
    case "rand":
    case "replay":
        breaksw
    default:
	echo "charmc : Unknown queue strategy $QUEUE"
        goto failure
endsw


##############################################################################
#
# Check for valid choice of BALANCE
#
##############################################################################

if ($?BALANCE == 0) set BALANCE=rand

switch ($BALANCE)
    case "acwn":
    case "rand":
    case "mngr":
    case "tok":
    case "btok":
    case "replay":
    case "recv":
        breaksw
    default:
        echo "charmc : Unknown load balancer $BALANCE"
        goto failure
endsw

if ( $BALANCE == btok ) then
        if ( ($QUEUE != bfifo) && ($QUEUE != bstack) ) then
                echo "WARNING : btok strategy needs bfifo or bstack queueing strategy"
        endif
endif


##############################################################################
#
# Check for valid choice of QMSTRAT
#
##############################################################################

if ($?QMSTRAT == 0) set QMSTRAT=default

switch ($QMSTRAT)
    case "default":
    case "simple":
    case "easy":
    case "replay":
        breaksw
    default:
        echo "charmc : Unknown queue manager $QMSTRAT"
        goto failure
endsw

##############################################################################
#
# Check for empty MAINOBJ and set to default
#
##############################################################################

if ($?MAINOBJ == 0) set MAINOBJ=$ROOTMACH/$EXECDIR/default_main.o

##############################################################################
#
# Load machine-specific configuration data.
#
##############################################################################

source $CHARMROOT/bin/$MACHTYPE.machine.script

# The following switch should not have to be here.

switch ($MACHTYPE)
	case 'solaris-threads':
	case 'uniprocessor-sun':
	case 'uniprocessor-solaris':
	case 'uniprocessor-hp':
	case 'uniprocessor-rs6000':
	case 'sequent':
	case 'max':
	case 'balance':
	case 'fx2800':
            set SHARED=1
            breaksw
	case 'ipsc2':
	case 'i860':
	case 'i860R':
	case 'ncube2':
	case 'sp1':
	case 'ncube3':
	case 'cm5':
	case 'paragon':
	case 'sunmos':
	case 'network-sun':
	case 'network-hp':
	case 'network-hp-cc':
	case 'network-rs6000':
	case 'network-solaris':
            set SHARED=0
            breaksw
endsw

# The following switch should not have to be here.

switch ($MACHTYPE)
        case 'network-sun':
        case 'network-solaris':
        case 'network-rs6000':
        case 'network-hp':
        case 'network-hp-cc':
        case 'i860R':
        case 'ncube2':
        case 'ipsc2':
            set HAVEHOST=1
            breaksw
        default:
            set HAVEHOST=0
            breaksw
endsw

##############################################################################
#
# Verify correctness of machine-script.
#
##############################################################################


if ($?NODE_LOADS == 0) then
    echo "Configurarion file must set NODE_LOADS"
    goto failure
endif

if ($?NODE_CC == 0) then
    echo "Configuration file must set NODE_CC"
    goto failure
endif

if ($?NODE_CPLUS == 0) then
    echo "Configuration file must set NODE_CPLUS"
    goto failure
endif

if ($?NODE_LD == 0) then
    echo "Configuration file must set NODE_LD"
    goto failure
endif

if ($?NODE_LDPLUS == 0) then
    echo "Configuration file must set NODE_LDPLUS"
    goto failure
endif

set CC = ($NODE_CC)
set CPLUS = ($NODE_CPLUS)
set LD = ($NODE_LD)
set LDPLUS = ($NODE_LDPLUS)

##############################################################################
#
# Handle overrides
#
##############################################################################

if ($?OVERRIDE_CC) then
    set CC[1]=""
    set CC = ( $OVERRIDE_CC $CC )
endif

if ($?OVERRIDE_CPLUS) then
    set CPLUS[1]=""
    set CPLUS = ( $OVERRIDE_CPLUS $CPLUS )
endif

if ($?OVERRIDE_LD) then
    set LD[1]=""
    set LD = ( $OVERRIDE_LD $LD )
endif

if ($?OVERRIDE_LD) then
    set LDPLUS[1]=""
    set LDPLUS = ( $OVERRIDE_LD $LDPLUS )
endif

##############################################################################
#
# Compile all specified files
#
# All temporary files named *.TMP.* for easy cleanup.
#
##############################################################################

foreach FILE ($FILES)
    set BASE=$FILE:r
    set TMP=$BASE:t.TMP
    if ($?OBJECT == 0) set OBJECT=$BASE:t
    if (${BASE}.o != $FILE) then
        echo "compiling $FILE for machine=$MACHTYPE"
        /bin/rm -f $BASE.o $BASE.f.o
    endif
    switch ($FILE)
        case "*.p"
            if ($?VERBOSE) echo "$CPP $OPTS_CPP -I$CHARMROOT/$MACHTYPE/include $BASE.p > $TMP.cpp"
            $CPP $OPTS_CPP -I$CHARMROOT/$MACHTYPE/include $BASE.p > $TMP.cpp
            if ($?VERBOSE) echo "$CHARMROOT/bin/spacefilter.$MACHTYPE < $TMP.cpp | $M4 > $TMP.space"
            $CHARMROOT/bin/spacefilter.$MACHTYPE < $TMP.cpp | $M4 > $TMP.space
            if ($?VERBOSE) echo "$CHARMROOT/bin/translate.$MACHTYPE $TMP.space $TMP.c"
            $CHARMROOT/bin/translate.$MACHTYPE $TMP.space $TMP.c
            if ($status) goto failure
            if ($?VERBOSE) echo "$CC $OPTS_CC $TMP.c -o $TMP.o"
            $CC $OPTS_CC $TMP.c -o $TMP.o
            if ($status) goto failure
            if ($?NOLINK) then
                if ($?VERBOSE) echo "/bin/mv $TMP.o $BASE.o"
                /bin/mv $TMP.o $BASE.o
            else
                set OBJECTFILES=( $OBJECTFILES $TMP.o )
            endif
            breaksw
        case "*.P"
            echo 'extern "C" {' > $TMP.P.c
            echo '#include <stdio.h>' >> $TMP.P.c
            echo '}' >> $TMP.P.c
            echo '#line 1 "'$BASE.P'"' >> $TMP.P.c
            /bin/cat $BASE.P >> $TMP.P.c
            if ($?VERBOSE) echo "$CPLUSPP $OPTS_CPP -I$CHARMROOT/$MACHTYPE/include $TMP.P.c > $TMP.cpp"
            $CPLUSPP $OPTS_CPP -I$CHARMROOT/$MACHTYPE/include $TMP.P.c > $TMP.cpp
            if ($?VERBOSE) echo "$CHARMROOT/bin/spacefilter++.$MACHTYPE $TMP.cpp | $M4 > $TMP.space"
            $CHARMROOT/bin/spacefilter++.$MACHTYPE $TMP.cpp | $M4 > $TMP.space
            if ($?VERBOSE) echo "$CHARMROOT/bin/translate++.$MACHTYPE $TMP.space $TMP.C"
            $CHARMROOT/bin/translate++.$MACHTYPE $TMP.space $TMP.C
            if ($status) goto failure
            if ($?VERBOSE) echo "$CPLUS $OPTS_CPLUS $TMP.C -o $TMP.o"
            $CPLUS $OPTS_CPLUS $TMP.C -o $TMP.o
            if ($status) goto failure
            if ($?NOLINK) then
                if ($?VERBOSE) echo "/bin/mv $TMP.o $BASE.o"
                /bin/mv $TMP.o $BASE.o
            else
                set OBJECTFILES=( $OBJECTFILES $TMP.o )
            endif
            breaksw
        case "*.c"
            echo "compiling $FILE for machine=$MACHTYPE"
            if ($?VERBOSE) echo "$CC $OPTS_CC $BASE.c -o $BASE.o"
            $CC $OPTS_CC $BASE.c -o $BASE.o
            if ($status) goto failure
            if ($?NOLINK == 0) then
                if ($?VERBOSE) echo "/bin/mv $BASE.o $TMP.o"
                /bin/mv $BASE.o $TMP.o
                set OBJECTFILES=( $OBJECTFILES $TMP.o )
            endif
            breaksw
        case "*.C"
            echo "compiling $FILE for machine=$MACHTYPE"
            if ($?VERBOSE) echo "$CPLUS $OPTS_CPLUS $BASE.c -o $BASE.o"
            $CPLUS $OPTS_CPLUS $BASE.C -o $BASE.o
            if ($status) goto failure
            if ($?NOLINK == 0) then
                if ($?VERBOSE) echo "/bin/mv $BASE.o $TMP.o"
                /bin/mv $BASE.o $TMP.o
                set OBJECTFILES=( $OBJECTFILES $TMP.o )
            endif
            breaksw
        case "*.f"
        case "*.F"
        case "*.fc"
        case "*.FC"
            echo "charmc: I'm not yet smart enough to compile $FILE"
            goto failure
        case "*.o"
            set OBJECTFILES=( $OBJECTFILES $BASE.o )
            breaksw
        default:
            echo "file with unrecognized extension $FILE"
            goto failure
    endsw
end


##############################################################################
#
# Link, if so requested, and fetch charmhost (if any).
#
##############################################################################

if ($?NOLINK) goto success


if ( $CONVERSE ) then
    set OBJECTFILES= ( $OBJECTFILES \
			"$ROOTMACH/$EXECDIR/converse.o" \
			"$ROOTMACH/$EXECDIR/fifo.o" \
			"$ROOTMACH/$EXECDIR/ck_objdir/machine.o" \
        		"$ROOTMACH/$EXECDIR/qs_objdir/n_qs_$QUEUE.o"  \
		        "$ROOTMACH/$EXECDIR/ck_objdir/$LOGEXEC.o"  \
        		"$ROOTMACH/$EXECDIR/mem_objdir/mem_$MEMORY.o"  \
#        		"$ROOTMACH/$EXECDIR/ldb_objdir/n_ldb.$BALANCE.o"  \
#	       		"$ROOTMACH/$EXECDIR/node_condsnd.o"  \
	       		"$ROOTMACH/$EXECDIR/tempdumdecls.o"  \
        		$NODE_LOADS \
		     )
    switch ($LANGUAGE)
    case "charm":
	set LOADER="$LD $OPTS_LD"
        breaksw
    case "charm++":
	set LOADER="$LDPLUS $OPTS_LD"
	breaksw
    endsw

    goto link

endif




set MODFILE = module_init_fn

if(-e $MODFILE.c) mv $MODFILE.c $MODFILE.bak

if(-e module.list) then
	set MOD_LIST = module.list
endif
# If the shell variable MODULE_LIST carries a value
if($?MODULE_LIST != 0)	then
	set MOD_LIST = $MODULE_LIST
endif
# If a modules list file was specified in the charmc options
if($?MOD_FILE_NAME != 0) then
	set MOD_LIST = $MOD_FILE_NAME
endif


if($?ACT_MOD_LIST != 0) then

	echo Using the module list : \"$ACT_MOD_LIST\"

        echo " " > $MODFILE.c
        foreach i ( $ACT_MOD_LIST)
                echo 'extern void _CK_'$i'_init();' >> $MODFILE.c
        end
	echo '_CK_module_init_fn()' >> $MODFILE.c
	echo '{' >> $MODFILE.c
	foreach i ( $ACT_MOD_LIST)
		echo '      _CK_'$i'_init();' >> $MODFILE.c
	end
	echo '}' >> $MODFILE.c

else if($?MOD_LIST) then
# No list of modules was specified in the charmc options
	
	echo Using module list in file \"$MOD_LIST\"
	if(!(-e $MOD_LIST)) (echo $MOD_LIST does not exist )#; exit)

        echo " " > $MODFILE.c
        foreach i ( `cat "$MOD_LIST"` )
                echo 'extern void _CK_'$i'_init();' >> $MODFILE.c
        end
	echo '_CK_module_init_fn()' >> $MODFILE.c
	echo '{' >> $MODFILE.c
	foreach i ( `cat "$MOD_LIST"` )
		echo '        _CK_'$i'_init();' >> $MODFILE.c
	end
	echo '}' >> $MODFILE.c

endif

if(-e $MODFILE.c) then
	$CC -c $MODFILE.c
else
	echo "WARNING : File with module init functions not created"
endif

# Uncomment the below line when the module init functions have been implemented
if (-e $MODFILE.o) set OBJECTFILES = ($OBJECTFILES $MODFILE.o)
 
echo "linking $OBJECT with -language $LANGUAGE -machine $MACHTYPE"

switch ($LANGUAGE)
    case "charm":
        set OBJECTFILES= ( $OBJECTFILES "$ROOTMACH/$EXECDIR/ck_objdir/dummy_cplus.o" )
	if($?PURIFY) then
	    set LOADER="purify $LD $OPTS_LD"
	else
	    set LOADER="$LD $OPTS_LD"
	endif
        breaksw
    case "charm++":
        set OBJECTFILES= ( $OBJECTFILES "$ROOTMACH/$EXECDIR/ck_objdir/cplus.o" )
	if($?PURIFY) then
	    set LOADER="purify $LDPLUS $OPTS_LD"
	else
	    set LOADER="$LDPLUS $OPTS_LD"
	endif
	breaksw
endsw

if ($SHARED) then
    set OBJECTFILES= ( $OBJECTFILES \
        "$ROOTMACH/$EXECDIR/ck_objdir/ckobj.o" \
        "$ROOTMACH/$EXECDIR/ck_objdir/$LOGEXEC.o"  \
        "$ROOTMACH/$EXECDIR/ck_objdir/obj_$EXTRAEXEC.o"  \
        "$ROOTMACH/$EXECDIR/mem_objdir/mem_$MEMORY.o"  \
        "$ROOTMACH/$EXECDIR/qs_objdir/qs_$QUEUE.o"  \
        $NODE_LOADS )
else
    set OBJECTFILES= ( $OBJECTFILES \
	"$ROOTMACH/$EXECDIR/converse.o" \
	"$ROOTMACH/$EXECDIR/fifo.o" \
	"$ROOTMACH/$EXECDIR/ck_objdir/machine.o" \
        "$ROOTMACH/$EXECDIR/ck_objdir/$LOGEXEC.o"  \
        "$ROOTMACH/$EXECDIR/mem_objdir/n_mem_$MEMORY.o"  \
        "$ROOTMACH/$EXECDIR/qs_objdir/n_qs_$QUEUE.o"  \
        "$ROOTMACH/$EXECDIR/ck_objdir/ckobj.node.o"  \
        "$ROOTMACH/$EXECDIR/ck_objdir/node_$EXTRAEXEC.o"  \
        "$ROOTMACH/$EXECDIR/ldb_objdir/n_ldb.$BALANCE.o"  \
#        "$ROOTMACH/$EXECDIR/node_qm_$QMSTRAT.o"  \
	$MAINOBJ \
        $NODE_LOADS )
endif


link:

if ($?VERBOSE) echo "$LOADER -o $OBJECT $OBJECTFILES -L$ROOTMACH/userlib $LIBRARIES -lm"
$LOADER -o $OBJECT $OBJECTFILES -L$ROOTMACH/userlib $LIBRARIES -lm
if ($status) goto failure

if ($HAVEHOST) then
    /bin/rm -f charmhost
    /bin/ln -s $CHARMROOT/$MACHTYPE/$EXECDIR/charmhost charmhost
endif

goto success

########################################################################
#
# Clean up files and exit
#
########################################################################


success:
    set STATUS=0
    goto end

failure:
    echo 'charmc: aborting.'
    set STATUS=1
    goto end

end:
    if ($?SAVE == 0) then
        foreach FILE ($FILES)
            set BASE=$FILE:r
            set TMP=$BASE:t.TMP
            /bin/rm -f $TMP.P.c $TMP.C $TMP.cpp $TMP.space $TMP.o
            /bin/rm -f $TMP.c $TMP.c.0.h $TMP.c.1.h $TMP.c.2.h $BASE:t.headers
        end
    endif
    exit ($STATUS)
@


1.12
log
@changed the objects linked in when -converse is used
@
text
@d6 2
a7 2
#       $Author: sanjeev $      $Locker: narain $              $State: Exp $
#       $Revision: 1.11 $        $Date: 1995/04/14 20:04:52 $
d16 3
d575 1
d589 1
d778 1
@


1.11
log
@integrating Charm and Converse
@
text
@d6 2
a7 2
#       $Author: sanjeev $      $Locker: sanjeev $              $State: Exp $
#       $Revision: 1.10 $        $Date: 1995/03/24 18:14:35 $
d16 3
d770 1
a770 1
        		"$ROOTMACH/$EXECDIR/mem_objdir/n_mem_$MEMORY.o"  \
d772 1
@


1.10
log
@removed qm
@
text
@d6 2
a7 2
#       $Author: jyelon $      $Locker: sanjeev $              $State: Exp $
#       $Revision: 1.9 $        $Date: 1995/02/28 21:10:33 $
d16 3
d78 1
d211 4
d759 28
d878 3
a880 1
        "$ROOTMACH/$EXECDIR/ck_objdir/ckobj.node.o"  \
a881 1
        "$ROOTMACH/$EXECDIR/ck_objdir/node_$EXTRAEXEC.o"  \
d884 2
d891 3
@


1.9
log
@*** empty log message ***
@
text
@d6 2
a7 2
#       $Author: jyelon $      $Locker: jyelon $              $State: Exp $
#       $Revision: 1.8 $        $Date: 1995/02/28 20:57:25 $
d16 3
d178 5
a182 5
	case "-qm"
            set QMSTRAT=$argv[$argindex]
            @@ argindex = $argindex + 1
            breaksw

d412 1
a412 1
    if ($?QMSTRAT == 0) set QMSTRAT=replay
d419 3
a421 3
    if ($QMSTRAT != replay) then
        echo "Ignoring -qm $QMSTRAT, incompatible with -execmode replay"
    endif
d848 1
a848 1
        "$ROOTMACH/$EXECDIR/node_qm_$QMSTRAT.o"  \
@


1.8
log
@Made charmc recognize the -I/include/file/directory and -L/lib/file/dir
options.
@
text
@d7 1
a7 1
#       $Revision: 1.7 $        $Date: 1995/02/28 20:41:15 $
d16 4
d274 1
a274 1
            set OPTC_CPP=( $OPTS_CPP "$arg" )
@


1.7
log
@Corrected bug - didn't work if you had CC, CPLUS, etc in your
environment.  Also corrected bug - didn't always put .o files in
consistent location.
@
text
@d6 2
a7 2
#       $Author: knauff $      $Locker: jyelon $              $State: Exp $
#       $Revision: 1.6 $        $Date: 1995/02/16 22:38:23 $
d16 5
d267 12
@


1.6
log
@Sending unknown flags to the preprocessor as well.
@
text
@d6 2
a7 2
#       $Author: sanjeev $      $Locker: knauff $              $State: Exp $
#       $Revision: 1.5 $        $Date: 1995/02/03 19:24:11 $
d16 3
d562 1
a562 3
# Compensate for differences in shared-memory scripts
#
# Allow overrides to specifications in machine script
a565 3
if (($?NODE_CC == 1)&&($?CC == 0)) then
    set CC="$NODE_CC"
endif
d567 3
a569 2
if (($?NODE_CPLUS == 1)&&($?CPLUS == 0)) then
    set CPLUS="$NODE_CPLUS"
d572 3
a574 6
if (($?NODE_LD == 1)&&($?LD == 0)) then
    set LD="$NODE_LD"
endif

if (($?NODE_LDPLUS == 1)&&($?LDPLUS == 0)) then
    set LDPLUS="$NODE_LDPLUS"
d577 2
a578 2
if ($?CC == 0) then
    echo "Configuration file for $MACHTYPE must set CC or NODE_CC"
d582 2
a583 2
if ($?CPLUS == 0) then
    echo "Configuration file for $MACHTYPE must set CPLUS or NODE_CPLUS"
d587 2
a588 2
if ($?LD == 0) then
    echo "Configuration file for $MACHTYPE must set LD or NODE_LD"
d592 4
a595 4
if ($?LDPLUS == 0) then
    echo "Configuration file for $MACHTYPE must set LDPLUS or NODE_LDPLUS"
    goto failure
endif
d597 5
a601 4
set CC = ($CC)
set CPLUS = ($CPLUS)
set LD = ($LD)
set LDPLUS = ($LDPLUS)
d627 1
a627 1
# All temporary files named *_TMP.* for easy cleanup.
d648 2
a649 2
            if ($?VERBOSE) echo "$CC $OPTS_CC $TMP.c"
            $CC $OPTS_CC $TMP.c
d671 2
a672 2
            if ($?VERBOSE) echo "$CPLUS $OPTS_CPLUS $TMP.C"
            $CPLUS $OPTS_CPLUS $TMP.C
d683 2
a684 2
            if ($?VERBOSE) echo "$CC $OPTS_CC $BASE.c"
            $CC $OPTS_CC $BASE.c
d694 2
a695 2
            if ($?VERBOSE) echo "$CPLUS $OPTS_CPLUS $BASE.c"
            $CPLUS $OPTS_CPLUS $BASE.C
d815 1
a815 1
        $LOADS )
@


1.5
log
@put in externs in module_init.c file
@
text
@d6 2
a7 2
#       $Author: narain $      $Locker: sanjeev $              $State: Exp $
#       $Revision: 1.4 $        $Date: 1994/11/30 18:26:41 $
d16 3
d285 1
@


1.4
log
@Added code to create a file with calls to module init functions in a single
function. (Note : The option to directly give a list of modules is not correct
yet).
  -- Narain
@
text
@d6 2
a7 2
#       $Author: narain $      $Locker: narain $              $State: Exp $
#       $Revision: 1.3 $        $Date: 1994/11/18 20:24:55 $
d16 6
d747 5
a751 1
	echo '_CK_module_init_fn()' > $MODFILE.c
d764 5
a768 1
	echo '_CK_module_init_fn()' > $MODFILE.c
d780 1
a780 1
#	echo "WARNING : File with module init functions not created"
d784 1
a784 1
#if (-e $MODFILE.o) set OBJECTFILES = ($OBJECTFILES $MODFILE.o)
@


1.3
log
@Added a -main option to specify that the main is in the user program
 - Sanjeev and Narain
@
text
@d6 2
a7 2
#       $Author: sanjeev $      $Locker:  $              $State: Exp $
#       $Revision: 1.2 $        $Date: 1994/11/09 21:21:36 $
d16 4
d234 12
d720 52
@


1.2
log
@separated qm, etc
@
text
@d6 2
a7 2
#       $Author: brunner $      $Locker: sanjeev $              $State: Exp $
#       $Revision: 1.1 $        $Date: 1994/10/14 21:01:27 $
d16 3
d32 1
a32 1
set DEFAULT_MACHTYPE=network-solaris
d175 4
d307 1
d467 7
d742 1
@


1.1
log
@Initial revision
@
text
@d5 3
a7 3
# 	$RCSfile$
# 	$Author$	$Locker$		$State$
#	$Revision$	$Date$
d15 4
a18 1
# $Log$
d29 1
a29 1
set DEFAULT_MACHTYPE=network-sun
d147 5
d351 1
d358 3
d363 1
d433 26
d726 1
@
