49 |
cat ./p1.tmp | awk '(NF>2 && $2==":"){ print $0 }' > ./p2.tmp |
cat ./p1.tmp | awk '(NF>2 && $2==":"){ print $0 }' > ./p2.tmp |
50 |
matched=0 |
matched=0 |
51 |
for i in $PACKAGES ; do |
for i in $PACKAGES ; do |
52 |
line=`grep $i ./p2.tmp` |
line=`grep "^ *$i" ./p2.tmp` |
53 |
RETVAL=$? |
RETVAL=$? |
54 |
if test "x$RETVAL" = x0 ; then |
if test "x$RETVAL" = x0 ; then |
55 |
matched=1 |
matched=1 |
72 |
|
|
73 |
tmp1=`uname`"_"`uname -m` |
tmp1=`uname`"_"`uname -m` |
74 |
tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` |
tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` |
75 |
PLATFORM=`echo $tmp2 | sed -e 's/i[3-6]86/ia32/'` |
PLATFORM=`echo $tmp2 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'` |
76 |
OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")` |
OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")` |
77 |
echo " The platform appears to be: $PLATFORM" |
echo " The platform appears to be: $PLATFORM" |
78 |
# if test "x$OFLIST" = x ; then |
# if test "x$OFLIST" = x ; then |
239 |
echo " -disable=NAME | --disable=NAME" |
echo " -disable=NAME | --disable=NAME" |
240 |
echo " -enable NAME | --enable NAME" |
echo " -enable NAME | --enable NAME" |
241 |
echo " -enable=NAME | --enable=NAME" |
echo " -enable=NAME | --enable=NAME" |
242 |
|
echo " -standarddirs NAME | --standarddirs NAME" |
243 |
|
echo " -standarddirs=NAME | --standarddirs=NAME" |
244 |
echo " -noopt NAME | --noopt NAME" |
echo " -noopt NAME | --noopt NAME" |
245 |
echo " -noopt=NAME | --noopt=NAME" |
echo " -noopt=NAME | --noopt=NAME" |
246 |
# echo " -cpp NAME | --cpp NAME" |
# echo " -cpp NAME | --cpp NAME" |
315 |
TOOLSDIR= |
TOOLSDIR= |
316 |
SOURCEDIRS= |
SOURCEDIRS= |
317 |
INCLUDEDIRS= |
INCLUDEDIRS= |
318 |
|
STANDARDDIRS= |
319 |
|
|
320 |
PWD=`pwd` |
PWD=`pwd` |
321 |
MAKE=make |
MAKE=make |
326 |
EXECUTABLE= |
EXECUTABLE= |
327 |
EXEHOOK= |
EXEHOOK= |
328 |
EXEDIR= |
EXEDIR= |
329 |
|
PACKAGES_CONF= |
330 |
|
IEEE= |
331 |
|
if test "x$MITGCM_IEEE" != x ; then |
332 |
|
IEEE=$MITGCM_IEEE |
333 |
|
fi |
334 |
|
|
335 |
# The following state can be set directly by command-line switches |
# The following state can be set directly by command-line switches |
336 |
gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE NOOPT" |
gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE NOOPT" |
337 |
gm_s2="FC IEEE MPI JAM DUMPSTATE" |
gm_s2="FC IEEE MPI JAM DUMPSTATE STANDARDDIRS" |
338 |
|
|
339 |
# The following state is not directly set by command-line switches |
# The following state is not directly set by command-line switches |
340 |
gm_s3="LN S64 KPP LINK PACKAGES MAKEDEPEND PDEPEND PDEFAULT INCLUDES FFLAGS FOPTIM " |
gm_s3="LN S64 KPP LINK PACKAGES MAKEDEPEND PDEPEND PDEFAULT INCLUDES FFLAGS FOPTIM " |
341 |
gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS" |
gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS" |
342 |
gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOSTNAME THISDATE MACHINE" |
gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOSTNAME THISDATE MACHINE" |
343 |
gm_s6="EXECUTABLE EXEHOOK EXEDIR" |
gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF" |
344 |
|
|
345 |
gm_state="COMMANDL $gm_s1 $gm_s2 $gm_s3 $gm_s4 $gm_s5 $gm_s6" |
gm_state="COMMANDL $gm_s1 $gm_s2 $gm_s3 $gm_s4 $gm_s5 $gm_s6" |
346 |
|
|
347 |
|
|
348 |
echo |
echo |
349 |
echo "=== Processing options files and arguments ===" |
echo "=== Processing options files and arguments ===" |
350 |
gm_local="./gm_local" |
gm_local="genmake_local" |
351 |
|
for i in . $MODS ; do |
352 |
|
if test -r $i/$gm_local ; then |
353 |
|
source $i/$gm_local |
354 |
|
break |
355 |
|
fi |
356 |
|
done |
357 |
echo -n " getting local config information: " |
echo -n " getting local config information: " |
358 |
if test -e $gm_local ; then |
if test -e $gm_local ; then |
359 |
echo "using $gm_local" |
echo "using $gm_local" |
445 |
-enable=* | --enable=*) |
-enable=* | --enable=*) |
446 |
ENABLE=$ac_optarg ;; |
ENABLE=$ac_optarg ;; |
447 |
|
|
448 |
|
-standarddirs | --standarddirs) |
449 |
|
ac_prev=STANDARDDIRS ;; |
450 |
|
-standarddirs=* | --standarddirs=*) |
451 |
|
STANDARDDIRS=$ac_optarg ;; |
452 |
|
|
453 |
-noopt | --noopt) |
-noopt | --noopt) |
454 |
ac_prev=NOOPT ;; |
ac_prev=NOOPT ;; |
455 |
-noopt=* | --noopt=*) |
-noopt=* | --noopt=*) |
466 |
FC=$ac_optarg ;; |
FC=$ac_optarg ;; |
467 |
|
|
468 |
-ieee | --ieee) |
-ieee | --ieee) |
469 |
IEEE=1 ;; |
IEEE=true ;; |
470 |
-noieee | --noieee) |
-noieee | --noieee) |
471 |
IEEE=0 ;; |
IEEE= ;; |
472 |
|
|
473 |
-mpi | --mpi) |
-mpi | --mpi) |
474 |
MPI=1 ;; |
MPI=true ;; |
475 |
-nompi | --nompi) |
-nompi | --nompi) |
476 |
MPI=0 ;; |
MPI= ;; |
477 |
|
|
478 |
-jam | --jam) |
-jam | --jam) |
479 |
JAM=1 ;; |
JAM=1 ;; |
497 |
|
|
498 |
done |
done |
499 |
|
|
500 |
|
if test -f ./.genmakerc ; then |
501 |
|
echo |
502 |
|
echo "WARNING: genmake2 has detected a copy of the old-style \"./.genmakerc\"" |
503 |
|
echo " file. This file format is no longer supported. Please see:" |
504 |
|
echo |
505 |
|
echo " http://mitgcm.org/devel_HOWTO/" |
506 |
|
echo |
507 |
|
echo " for directions on how to setup and use the new \"genmake2\" input" |
508 |
|
echo " files and send an email to MITgcm-support@mitgcm.org if you want help." |
509 |
|
echo |
510 |
|
fi |
511 |
|
|
512 |
if test "x${ROOTDIR}" = x ; then |
if test "x${ROOTDIR}" = x ; then |
513 |
if test "${PWD##/*/}" = "bin" -a -d ../model -a -d ../eesup -a -d ../pkg ; then |
if test "${PWD##/*/}" = "bin" -a -d ../model -a -d ../eesup -a -d ../pkg ; then |
514 |
ROOTDIR=".." |
ROOTDIR=".." |
555 |
exit 1 |
exit 1 |
556 |
fi |
fi |
557 |
if test "x$DUMPSTATE" != xf ; then |
if test "x$DUMPSTATE" != xf ; then |
558 |
cp -f $OPTFILE "gm_optfile" |
cp -f $OPTFILE "genmake_optfile" |
559 |
fi |
fi |
560 |
else |
else |
561 |
echo "Error: can't read OPTFILE=\"$OPTFILE\"" |
echo "Error: can't read OPTFILE=\"$OPTFILE\"" |
571 |
Error: no Fortran compiler: please specify using one of the following: |
Error: no Fortran compiler: please specify using one of the following: |
572 |
1) within the options file ("FC=...") as specified by "-of=OPTFILE" |
1) within the options file ("FC=...") as specified by "-of=OPTFILE" |
573 |
2) the "-fc=XXX" command-line option |
2) the "-fc=XXX" command-line option |
574 |
3) the "./gm_local" file |
3) the "./genmake_local" file |
575 |
EOF |
EOF |
576 |
exit 1 |
exit 1 |
577 |
fi |
fi |
589 |
Error: C pre-processor "$CPP" failed the test case: please specify using: |
Error: C pre-processor "$CPP" failed the test case: please specify using: |
590 |
|
|
591 |
1) within the options file ("CPP=...") as specified by "-of=OPTFILE" |
1) within the options file ("CPP=...") as specified by "-of=OPTFILE" |
592 |
2) the "./gm_local" file |
2) the "./genmake_local" file |
593 |
|
|
594 |
EOF |
EOF |
595 |
exit 1 |
exit 1 |
864 |
# echo |
# echo |
865 |
|
|
866 |
# Create a list of #define and #undef to enable/disable packages |
# Create a list of #define and #undef to enable/disable packages |
867 |
PACKAGES_DOT_H=PACKAGES.h |
PACKAGES_DOT_H=PACKAGES_CONFIG.h |
868 |
cat <<EOF >$PACKAGES_DOT_H".tmp" |
cat <<EOF >$PACKAGES_DOT_H".tmp" |
869 |
C=== GENMAKE v2 === |
C=== GENMAKE v2 === |
870 |
C The following defines have been set by GENMAKE, so please do not |
C The following defines have been set by GENMAKE, so please do not |
872 |
C add or remove packages by re-running genmake with different |
C add or remove packages by re-running genmake with different |
873 |
C "-enable" and/or "-disable" options. |
C "-enable" and/or "-disable" options. |
874 |
|
|
875 |
|
#ifndef PACKAGES_H |
876 |
|
#define PACKAGES_H |
877 |
|
|
878 |
C Packages disabled by genmake: |
C Packages disabled by genmake: |
879 |
EOF |
EOF |
880 |
# The following UGLY HACK sets multiple "#undef"s and it needs to go |
# The following UGLY HACK sets multiple "#undef"s and it needs to go |
934 |
#EH3 WARNING : This is an UGLY HACK that needs to be removed!!! |
#EH3 WARNING : This is an UGLY HACK that needs to be removed!!! |
935 |
|
|
936 |
done |
done |
937 |
|
cat <<EOF >>$PACKAGES_DOT_H".tmp" |
938 |
|
|
939 |
|
#endif /* PACKAGES_H */ |
940 |
|
EOF |
941 |
|
|
942 |
if test ! -f $PACKAGES_DOT_H ; then |
if test ! -f $PACKAGES_DOT_H ; then |
943 |
mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H |
mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H |
944 |
else |
else |
954 |
|
|
955 |
echo " Adding STANDARDDIRS" |
echo " Adding STANDARDDIRS" |
956 |
BUILDDIR=${BUILDDIR:-.} |
BUILDDIR=${BUILDDIR:-.} |
957 |
STANDARDDIRS=${STANDARDDIRS:-"eesupp model"} |
if test "x$STANDARDDIRS" = x ; then |
958 |
|
STANDARDDIRS="eesupp model" |
959 |
|
fi |
960 |
for d in $STANDARDDIRS ; do |
for d in $STANDARDDIRS ; do |
961 |
adr="$ROOTDIR/$d/src" |
adr="$ROOTDIR/$d/src" |
962 |
if test ! -d $adr ; then |
if test ! -d $adr ; then |
1186 |
Clean: |
Clean: |
1187 |
@make clean |
@make clean |
1188 |
@make cleanlinks |
@make cleanlinks |
1189 |
-rm -f Makefile.bak gm_state gm_optfile make.log PACKAGES.h* |
-rm -f Makefile.bak genmake_state genmake_optfile make.log |
1190 |
CLEAN: |
CLEAN: |
1191 |
@make Clean |
@make Clean |
1192 |
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
1256 |
|
|
1257 |
# Write the "state" for future records |
# Write the "state" for future records |
1258 |
if test "x$DUMPSTATE" != xf ; then |
if test "x$DUMPSTATE" != xf ; then |
1259 |
echo -n "" > gm_state |
echo -n "" > genmake_state |
1260 |
for i in $gm_state ; do |
for i in $gm_state ; do |
1261 |
t1="t2=\$$i" |
t1="t2=\$$i" |
1262 |
eval $t1 |
eval $t1 |
1263 |
echo "$i='$t2'" >> gm_state |
echo "$i='$t2'" >> genmake_state |
1264 |
done |
done |
1265 |
fi |
fi |