8 |
# modified by aja 01/00 |
# modified by aja 01/00 |
9 |
# rewritten in bash by eh3 08/03 |
# rewritten in bash by eh3 08/03 |
10 |
|
|
11 |
|
# Search for particular CPP #cmds associated with packages |
12 |
|
# usage: test_for_package_in_cpp_options CPP_file package_name |
13 |
|
test_for_package_in_cpp_options() { |
14 |
|
cpp_options=$1 |
15 |
|
pkg=$2 |
16 |
|
grep -i "#define.*ALLOW_$pkg" $cpp_options > /dev/null 2>&1 |
17 |
|
RETVAL=$? |
18 |
|
if test "x${RETVAL}" = x0 ; then |
19 |
|
echo "Error: In $cpp_options there is an illegal line: #define ALLOW_$pkg" |
20 |
|
exit 99 |
21 |
|
fi |
22 |
|
grep -i "#undef.*ALLOW_$pkg" $cpp_options > /dev/null 2>&1 |
23 |
|
RETVAL=$? |
24 |
|
if test "x${RETVAL}" = x0 ; then |
25 |
|
echo "Error: In $cpp_options there is an illegal line: #undef ALLOW_$pkg" |
26 |
|
exit 99 |
27 |
|
fi |
28 |
|
grep -i "#define.*DISABLE_$pkg" $cpp_options > /dev/null 2>&1 |
29 |
|
RETVAL=$? |
30 |
|
if test "x${RETVAL}" = x0 ; then |
31 |
|
echo "Error: In $cpp_options there is an illegal line: #define DISABLE_$pkg" |
32 |
|
exit 99 |
33 |
|
fi |
34 |
|
grep -i "#undef.*DISABLE_$pkg" $cpp_options > /dev/null 2>&1 |
35 |
|
RETVAL=$? |
36 |
|
if test "x${RETVAL}" = x0 ; then |
37 |
|
echo "Error: In $cpp_options there is an illegal line: #undef DISABLE_$pkg" |
38 |
|
exit 99 |
39 |
|
fi |
40 |
|
} |
41 |
|
|
42 |
|
# Read the $ROOTDIR/pkg/pkg_groups file and expand any references to |
43 |
|
# the package list. |
44 |
|
expand_pkg_groups() { |
45 |
|
new_packages= |
46 |
|
PKG_GROUPS=$ROOTDIR"/pkg/pkg_groups" |
47 |
|
if test -r $PKG_GROUPS ; then |
48 |
|
cat $PKG_GROUPS | sed -e 's/#.*$//g' | sed -e 's/:/ : /g' > ./p1.tmp |
49 |
|
cat ./p1.tmp | awk '(NF>2 && $2==":"){ print $0 }' > ./p2.tmp |
50 |
|
matched=0 |
51 |
|
for i in $PACKAGES ; do |
52 |
|
line=`grep $i ./p2.tmp` |
53 |
|
RETVAL=$? |
54 |
|
if test "x$RETVAL" = x0 ; then |
55 |
|
matched=1 |
56 |
|
replace=`echo $line | awk '{ $1=""; $2=""; print $0 }'` |
57 |
|
echo " replacing \"$i\" with: $replace" |
58 |
|
new_packages="$new_packages $replace" |
59 |
|
else |
60 |
|
new_packages="$new_packages $i" |
61 |
|
fi |
62 |
|
done |
63 |
|
PACKAGES=$new_packages |
64 |
|
rm -f ./p[1,2].tmp |
65 |
|
else |
66 |
|
echo "Warning: can't read package groups definition file: $PKG_GROUPS" |
67 |
|
fi |
68 |
|
} |
69 |
|
|
70 |
# Guess possible config options for this host |
# Guess possible config options for this host |
71 |
find_possible_configs() { |
find_possible_configs() { |
72 |
|
|
73 |
p_PLATFORM=`uname`"-"`uname -m` |
tmp1=`uname`"_"`uname -m` |
74 |
echo "The platform appears to be:" |
tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` |
75 |
echo " "$p_PLATFORM |
PLATFORM=`echo $tmp2 | sed -e 's/i[3-6]86/ia32/'` |
76 |
|
OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")` |
77 |
p_LN= |
echo " The platform appears to be: $PLATFORM" |
78 |
|
# if test "x$OFLIST" = x ; then |
79 |
|
# echo " No pre-defined options files were found matching this platform" |
80 |
|
# echo " but examples for other platforms can be found in:" |
81 |
|
# echo " $ROOTDIR/tools/build_options" |
82 |
|
# else |
83 |
|
# echo " Options files (located in $ROOTDIR/tools/build_options) that" |
84 |
|
# echo " may work with this machine are:" |
85 |
|
# for i in $OFLIST ; do |
86 |
|
# echo " $i" |
87 |
|
# done |
88 |
|
# fi |
89 |
|
|
90 |
echo "test" > test |
echo "test" > test |
91 |
ln -s ./test link |
ln -s ./test link |
92 |
RETVAL=$? |
RETVAL=$? |
93 |
if test "x${RETVAL}" = x0 ; then |
if test "x${RETVAL}" = x0 ; then |
94 |
p_LN="ln -s" |
LN="ln -s" |
95 |
|
else |
96 |
|
echo "Error: \"ln -s\" does not appear to work on this system!" |
97 |
|
echo " For help, please contact <MITgcm-support@mitgcm.org>." |
98 |
|
exit 1 |
99 |
fi |
fi |
100 |
rm -f test link |
rm -f test link |
101 |
|
|
102 |
p_CPP=`which cpp` |
if test "x$CPP" = x ; then |
103 |
|
CPP="cpp -traditional -P" |
|
RETVAL=$? |
|
|
if test "x${RETVAL}" = x0 ; then |
|
|
p_LN="ln -s" |
|
104 |
fi |
fi |
|
rm -f test link |
|
105 |
|
|
106 |
# look for possible fortran compilers |
# look for possible fortran compilers |
107 |
|
tmp="$MITGCM_FC $FC g77 f77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95" |
108 |
p_FC= |
p_FC= |
109 |
for c in f77 g77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95 ; do |
for c in $tmp ; do |
110 |
which $c > /dev/null 2>&1 |
rm -f ./hello.f ./hello |
111 |
|
cat >> hello.f <<EOF |
112 |
|
program hello |
113 |
|
do i=1,3 |
114 |
|
print *, 'hello world : ', i |
115 |
|
enddo |
116 |
|
end |
117 |
|
EOF |
118 |
|
$c -o hello hello.f > /dev/null 2>&1 |
119 |
RETVAL=$? |
RETVAL=$? |
120 |
if test "x${RETVAL}" = x0 ; then |
if test "x${RETVAL}" = x0 ; then |
121 |
p_FC="$p_FC $c" |
p_FC="$p_FC $c" |
122 |
fi |
fi |
123 |
done |
done |
|
echo "Possible FORTRAN compilers appear to be: " |
|
124 |
if test "x${p_FC}" = x ; then |
if test "x${p_FC}" = x ; then |
125 |
echo " None found!!!" |
cat 1>&2 <<EOF |
126 |
|
|
127 |
|
Error: No Fortran compilers were found in your path. Please specify one using: |
128 |
|
|
129 |
|
1) an "optfile" on (eg. "-optfile=path/to/OPTFILE"), |
130 |
|
2) a command-line option (eg. "-fc NAME"), or |
131 |
|
3) the MITGCM_FC environment variable. |
132 |
|
|
133 |
|
EOF |
134 |
|
exit 1 |
135 |
else |
else |
136 |
echo " "$p_FC |
echo " The possible FORTRAN compilers found in your path are:" |
137 |
|
echo " "$p_FC |
138 |
|
if test "x$FC" = x ; then |
139 |
|
FC=`echo $p_FC | awk '{print $1}'` |
140 |
|
fi |
141 |
fi |
fi |
142 |
|
|
143 |
# look for possible MPI libraries |
for i in $p_FC ; do |
144 |
mpi_libs= |
p_OF=$ROOTDIR"/tools/build_options/"$PLATFORM"_"$i |
145 |
mpi_fort=`which mpif77 2>/dev/null` |
if test -r $p_OF ; then |
146 |
RETVAL=$? |
OPTFILE=$p_OF |
147 |
if test "x${RETVAL}" = x0 ; then |
echo " The options file: $p_OF" |
148 |
cat >>test.f <<EOF |
echo " appears to match so we'll use it." |
149 |
PROGRAM HELLO |
break |
|
DO 10, I=1,10 |
|
|
PRINT *,'Hello World' |
|
|
10 CONTINUE |
|
|
STOP |
|
|
END |
|
|
EOF |
|
|
eval "$mpi_fort -showme test.f > out" |
|
|
RETVAL=$? |
|
|
if test "x${RETVAL}" = x0 ; then |
|
|
a=`cat out` |
|
|
for i in $a ; do |
|
|
case $i in |
|
|
-*) |
|
|
mpi_libs="$mpi_libs $i" ;; |
|
|
esac |
|
|
done |
|
|
echo "The MPI libs appear to be:" |
|
|
echo " "$mpi_libs |
|
150 |
fi |
fi |
151 |
rm -f test.f out |
done |
152 |
|
if test "x$OPTFILE" = x ; then |
153 |
|
cat 1>&2 <<EOF |
154 |
|
|
155 |
|
Error: No options file was found in: $ROOTDIR/tools/build_options/ |
156 |
|
that matches this platform ("$PLATFORM") and the compilers found in |
157 |
|
your path. Please specify an "optfile" using: |
158 |
|
|
159 |
|
1) the command line (eg. "-optfile=path/to/OPTFILE"), or |
160 |
|
2) the MITGCM_OF environment variable. |
161 |
|
|
162 |
|
If you need help, please contact the developers at <MITgcm-support@mitgcm.org>. |
163 |
|
|
164 |
|
EOF |
165 |
|
exit 1 |
166 |
fi |
fi |
167 |
|
|
168 |
|
# # look for possible MPI libraries |
169 |
|
# mpi_libs= |
170 |
|
# mpi_fort=`which mpif77 2>/dev/null` |
171 |
|
# RETVAL=$? |
172 |
|
# if test "x${RETVAL}" = x0 ; then |
173 |
|
# cat >>test.f <<EOF |
174 |
|
# PROGRAM HELLO |
175 |
|
# DO 10, I=1,10 |
176 |
|
# PRINT *,'Hello World' |
177 |
|
# 10 CONTINUE |
178 |
|
# STOP |
179 |
|
# END |
180 |
|
# EOF |
181 |
|
# eval "$mpi_fort -showme test.f > out" |
182 |
|
# RETVAL=$? |
183 |
|
# if test "x${RETVAL}" = x0 ; then |
184 |
|
# a=`cat out` |
185 |
|
# for i in $a ; do |
186 |
|
# case $i in |
187 |
|
# -*) |
188 |
|
# mpi_libs="$mpi_libs $i" ;; |
189 |
|
# esac |
190 |
|
# done |
191 |
|
# echo "The MPI libs appear to be:" |
192 |
|
# echo " "$mpi_libs |
193 |
|
# fi |
194 |
|
# rm -f test.f out |
195 |
|
# fi |
196 |
|
|
197 |
} |
} |
198 |
|
|
288 |
KPP= |
KPP= |
289 |
FC= |
FC= |
290 |
LINK= |
LINK= |
291 |
|
DEFINES="-DWORDLENGTH=4" |
292 |
PACKAGES= |
PACKAGES= |
293 |
ENABLE= |
ENABLE= |
294 |
DISABLE= |
DISABLE= |
295 |
MAKEFILE= |
MAKEFILE= |
296 |
MAKEDEPEND= |
MAKEDEPEND= |
297 |
PDEPEND= |
PDEPEND= |
298 |
DUMPSTATE=f |
DUMPSTATE=t |
299 |
PDEFAULT= |
PDEFAULT= |
300 |
OPTFILE= |
OPTFILE= |
301 |
INCLUDES="-I." |
INCLUDES="-I." |
478 |
|
|
479 |
done |
done |
480 |
|
|
481 |
|
if test "x${ROOTDIR}" = x ; then |
482 |
|
if test "${PWD##/*/}" = "bin" -a -d ../model -a -d ../eesup -a -d ../pkg ; then |
483 |
|
ROOTDIR=".." |
484 |
|
else |
485 |
|
for d in . .. ../.. ../../.. ../../../.. ../../../../.. ; do |
486 |
|
if [ -d "$d/model" -a -d "$d/eesupp" -a -d "$d/pkg" ]; then |
487 |
|
ROOTDIR=$d |
488 |
|
echo -n "Warning: ROOTDIR was not specified but there appears to be" |
489 |
|
echo " a copy of MITgcm at \"$ROOTDIR\" so we'll try it." |
490 |
|
break |
491 |
|
fi |
492 |
|
done |
493 |
|
fi |
494 |
|
fi |
495 |
|
if test "x${ROOTDIR}" = x ; then |
496 |
|
echo "Error: Cannot determine ROOTDIR for MITgcm code." |
497 |
|
echo " Please specify a ROOTDIR using either an options " |
498 |
|
echo " file or a command-line option." |
499 |
|
exit 1 |
500 |
|
fi |
501 |
|
if test ! -d ${ROOTDIR} ; then |
502 |
|
echo "Error: the specified ROOTDIR (\"$ROOTDIR\") does not exist!" |
503 |
|
exit 1 |
504 |
|
fi |
505 |
|
|
506 |
echo " getting OPTFILE information: " |
echo " getting OPTFILE information: " |
507 |
if test "x${OPTFILE}" = x ; then |
if test "x${OPTFILE}" = x ; then |
508 |
echo "Warning: no OPTFILE specified so we'll look for possible settings" |
if test "x$MITGCM_OF" = x ; then |
509 |
printf "\n=== Searching for possible settings for OPTFILE ===\n" |
echo "Warning: no OPTFILE specified so we'll look for possible settings" |
510 |
find_possible_configs |
printf "\n=== Searching for possible settings for OPTFILE ===\n" |
511 |
else |
find_possible_configs |
|
if test "x$OPTFILE" = xNONE ; then |
|
|
echo " OPTFILE=NONE so we'll try to use default settings" |
|
512 |
else |
else |
513 |
if test -f "$OPTFILE" -a -r "$OPTFILE" ; then |
OPTFILE=$MITGCM_OF |
514 |
echo " using OPTFILE=\"$OPTFILE\"" |
fi |
515 |
source "$OPTFILE" |
fi |
516 |
RETVAL=$? |
if test "x$OPTFILE" != xNONE ; then |
517 |
if test "x$RETVAL" != x0 ; then |
if test -f "$OPTFILE" -a -r "$OPTFILE" ; then |
518 |
echo -n "Error: failed to source OPTFILE \"$OPTFILE\"" |
echo " using OPTFILE=\"$OPTFILE\"" |
519 |
echo "--please check that variable syntax is bash-compatible" |
source "$OPTFILE" |
520 |
exit 1 |
RETVAL=$? |
521 |
fi |
if test "x$RETVAL" != x0 ; then |
522 |
if test "x$DUMPSTATE" != xf ; then |
echo -n "Error: failed to source OPTFILE \"$OPTFILE\"" |
523 |
cp -f $OPTFILE "gm_optfile" |
echo "--please check that variable syntax is bash-compatible" |
|
fi |
|
|
else |
|
|
echo "Error: can't read OPTFILE=\"$OPTFILE\"" |
|
524 |
exit 1 |
exit 1 |
525 |
fi |
fi |
526 |
|
if test "x$DUMPSTATE" != xf ; then |
527 |
|
cp -f $OPTFILE "gm_optfile" |
528 |
|
fi |
529 |
|
else |
530 |
|
echo "Error: can't read OPTFILE=\"$OPTFILE\"" |
531 |
|
exit 1 |
532 |
fi |
fi |
533 |
fi |
fi |
534 |
|
|
548 |
LINK=$FC |
LINK=$FC |
549 |
fi |
fi |
550 |
if test "x$CPP" = x ; then |
if test "x$CPP" = x ; then |
551 |
|
CPP="cpp" |
552 |
|
fi |
553 |
|
echo "#define A a" | cpp > test_cpp 2>&1 |
554 |
|
RETVAL=$? |
555 |
|
if test "x$RETVAL" != x0 ; then |
556 |
cat <<EOF 1>&2 |
cat <<EOF 1>&2 |
557 |
|
|
558 |
Error: no C pre-processor: please specify using one of the following: |
Error: C pre-processor "$CPP" failed the test case: please specify using: |
559 |
|
|
560 |
1) within the options file ("CPP=...") as specified by "-of=OPTFILE" |
1) within the options file ("CPP=...") as specified by "-of=OPTFILE" |
561 |
2) the "./gm_local" file |
2) the "./gm_local" file |
|
EOF |
|
|
exit 1 |
|
|
fi |
|
|
if test "x$S64" = x ; then |
|
|
cat <<EOF 1>&2 |
|
562 |
|
|
|
Error: no C pre-processor: please specify using one of the following: |
|
|
1) within the options file ("S64=...") as specified by "-of=OPTFILE" |
|
|
2) the "./gm_local" file |
|
563 |
EOF |
EOF |
564 |
exit 1 |
exit 1 |
565 |
|
else |
566 |
|
rm -f test_cpp |
567 |
|
fi |
568 |
|
if test "x$MAKEDEPEND" = x ; then |
569 |
|
MAKEDEPEND=makedepend |
570 |
fi |
fi |
|
|
|
571 |
|
|
572 |
printf "\n=== Setting defaults ===\n" |
printf "\n=== Setting defaults ===\n" |
573 |
echo -n " Adding MODS directories: " |
echo -n " Adding MODS directories: " |
591 |
PLATFORM=$p_PLATFORM |
PLATFORM=$p_PLATFORM |
592 |
fi |
fi |
593 |
|
|
|
if test "x${ROOTDIR}" = x ; then |
|
|
if test "${PWD##/*/}" = "bin" -a -d ../model -a -d ../eesup -a -d ../pkg ; then |
|
|
ROOTDIR=".." |
|
|
else |
|
|
for d in . .. ../.. ../../.. ../../../.. ../../../../.. ; do |
|
|
if [ -d "$d/model" -a -d "$d/eesupp" -a -d "$d/pkg" ]; then |
|
|
ROOTDIR=$d |
|
|
echo -n "Warning: ROOTDIR was not specified but there appears to be" |
|
|
echo " a copy of MITgcm at \"$ROOTDIR\" so we'll try it." |
|
|
break |
|
|
fi |
|
|
done |
|
|
fi |
|
|
fi |
|
|
if test "x${ROOTDIR}" = x ; then |
|
|
echo "Error: Cannot determine ROOTDIR for MITgcm code." |
|
|
echo " Please specify a ROOTDIR using either an options " |
|
|
echo " file or a command-line option." |
|
|
exit 1 |
|
|
fi |
|
|
if test ! -d ${ROOTDIR} ; then |
|
|
echo "Error: the specified ROOTDIR (\"$ROOTDIR\") does not exist!" |
|
|
exit 1 |
|
|
fi |
|
|
|
|
594 |
if test "x${EXEDIR}" = x ; then |
if test "x${EXEDIR}" = x ; then |
595 |
if test "${PWD##/*/}" = "bin" -a -d ../exe -a $ROOTDIR = .. ; then |
if test "${PWD##/*/}" = "bin" -a -d ../exe -a $ROOTDIR = .. ; then |
596 |
EXEDIR=../exe |
EXEDIR=../exe |
610 |
echo "Error: the specified $TOOLSDIR (\"$TOOLSDIR\") does not exist!" |
echo "Error: the specified $TOOLSDIR (\"$TOOLSDIR\") does not exist!" |
611 |
exit 1 |
exit 1 |
612 |
fi |
fi |
613 |
|
if test "x$S64" = x ; then |
614 |
|
S64='$(TOOLSDIR)/set64bitConst.sh' |
615 |
|
fi |
616 |
|
|
617 |
EXECUTABLE=${EXECUTABLE:-mitgcmuv} |
EXECUTABLE=${EXECUTABLE:-mitgcmuv} |
618 |
|
|
661 |
source ./.pd_tmp |
source ./.pd_tmp |
662 |
rm -f ./.pd_tmp |
rm -f ./.pd_tmp |
663 |
|
|
664 |
|
# Search for default packages. Note that a "$ROOTDIR/pkg/pkg_groups" |
665 |
|
# file should eventually be added so that, for convenience, one can |
666 |
|
# specify groups of packages using names like "ocean" and "atmosphere". |
667 |
echo -n " checking default package list: " |
echo -n " checking default package list: " |
668 |
if test "x${PDEFAULT}" = x ; then |
if test "x${PDEFAULT}" = x ; then |
669 |
|
for i in "." $MODS ; do |
670 |
|
if test -r $i"/packages.conf" ; then |
671 |
|
PDEFAULT=$i"/packages.conf" |
672 |
|
break |
673 |
|
fi |
674 |
|
done |
675 |
|
fi |
676 |
|
if test "x${PDEFAULT}" = x ; then |
677 |
PDEFAULT="$ROOTDIR/pkg/pkg_default" |
PDEFAULT="$ROOTDIR/pkg/pkg_default" |
678 |
fi |
fi |
679 |
if test "x${PDEFAULT}" = xNONE ; then |
if test "x${PDEFAULT}" = xNONE ; then |
695 |
for i in $def ; do |
for i in $def ; do |
696 |
PACKAGES="$PACKAGES $i" |
PACKAGES="$PACKAGES $i" |
697 |
done |
done |
698 |
echo " packages are: $PACKAGES" |
echo " before group expansion packages are: $PACKAGES" |
699 |
|
expand_pkg_groups |
700 |
|
echo " after group expansion packages are: $PACKAGES" |
701 |
fi |
fi |
702 |
fi |
fi |
703 |
|
|
716 |
done |
done |
717 |
PACKAGES="$pack" |
PACKAGES="$pack" |
718 |
echo " applying ENABLE settings" |
echo " applying ENABLE settings" |
719 |
rm -f ./.tmp_pack |
echo "" > ./.tmp_pack |
720 |
PACKAGES="$PACKAGES $ENABLE" |
PACKAGES="$PACKAGES $ENABLE" |
721 |
for i in $PACKAGES ; do |
for i in $PACKAGES ; do |
722 |
if test ! -d "$ROOTDIR/pkg/$i" ; then |
if test ! -d "$ROOTDIR/pkg/$i" ; then |
832 |
# done |
# done |
833 |
# echo |
# echo |
834 |
|
|
835 |
echo " Searching for CPP_OPTIONS.h (macros and flags for configuring the model):" |
# Create a list of #define and #undef to enable/disable packages |
836 |
CPP_OPTIONS= |
PACKAGES_DOT_H=PACKAGES.h |
837 |
spaths="$MODS ./ $SOURCEDIRS" |
cat <<EOF >$PACKAGES_DOT_H".tmp" |
|
for i in $spaths ; do |
|
|
try="$i/CPP_OPTIONS.h" |
|
|
# echo -n " trying $try : " |
|
|
if test -f $try -a -r $try ; then |
|
|
echo " found CPP_OPTIONS=\"$try\"" |
|
|
CPP_OPTIONS="$try" |
|
|
if test "x$i" != "x." ; then |
|
|
cp -f $CPP_OPTIONS . |
|
|
fi |
|
|
break |
|
|
fi |
|
|
done |
|
|
if test "x$CPP_OPTIONS" = x ; then |
|
|
echo "Error: can't find \"CPP_OPTIONS.h\" in the path list: $spaths" |
|
|
exit 1 |
|
|
fi |
|
|
if test -e CPP_OPTIONS.h ; then |
|
|
if test ! -e CPP_OPTIONS.h.bak ; then |
|
|
cp -f CPP_OPTIONS.h CPP_OPTIONS.h.bak |
|
|
fi |
|
|
cat CPP_OPTIONS.h \ |
|
|
| awk 'BEGIN{p=1;} ($1=="C===" && $2=="GENMAKE"){p=0;} {if (p==1) print $0}' \ |
|
|
> CPP_OPTIONS.h.tmp |
|
|
fi |
|
|
cat <<EOF >>CPP_OPTIONS.h.tmp |
|
838 |
C=== GENMAKE v2 === |
C=== GENMAKE v2 === |
839 |
C The following defines have been set by GENMAKE, so please edit |
C The following defines have been set by GENMAKE, so please do not |
840 |
C them only if you know what you're doing. In general, you should |
C edit anything below these comments. In general, you should |
841 |
C add or remove packages by re-running genmake with different |
C add or remove packages by re-running genmake with different |
842 |
C "-enable" and/or "-disable" options. |
C "-enable" and/or "-disable" options. |
843 |
|
|
860 |
done |
done |
861 |
if test "x$has_pack" = xf ; then |
if test "x$has_pack" = xf ; then |
862 |
undef=`echo "ALLOW_$n" | awk '{print toupper($0)}'` |
undef=`echo "ALLOW_$n" | awk '{print toupper($0)}'` |
863 |
echo "#undef $undef" >> CPP_OPTIONS.h.tmp |
echo "#undef $undef" >> $PACKAGES_DOT_H".tmp" |
864 |
|
# DEFINES="$DEFINES -U$undef" |
865 |
|
|
866 |
#EH3 WARNING : This is an UGLY HACK that needs to be removed!!! |
#EH3 WARNING : This is an UGLY HACK that needs to be removed!!! |
867 |
case $n in |
case $n in |
871 |
mom_vecinv) |
mom_vecinv) |
872 |
DEFINES="$DEFINES -DDISABLE_MOM_VECINV" |
DEFINES="$DEFINES -DDISABLE_MOM_VECINV" |
873 |
;; |
;; |
|
generic_advdiff) |
|
|
DEFINES="$DEFINES -DDISABLE_GENERIC_ADVDIFF" |
|
|
;; |
|
874 |
debug) |
debug) |
875 |
DEFINES="$DEFINES -DDISABLE_DEBUGMODE" |
DEFINES="$DEFINES -DDISABLE_DEBUGMODE" |
876 |
;; |
;; |
880 |
fi |
fi |
881 |
fi |
fi |
882 |
done |
done |
883 |
cat <<EOF >>CPP_OPTIONS.h.tmp |
cat <<EOF >>$PACKAGES_DOT_H".tmp" |
884 |
|
|
885 |
C Packages enabled by genmake: |
C Packages enabled by genmake: |
886 |
EOF |
EOF |
887 |
for i in $PACKAGES ; do |
for i in $PACKAGES ; do |
888 |
def=`echo "ALLOW_$i" | awk '{print toupper($0)}'` |
def=`echo "ALLOW_$i" | awk '{print toupper($0)}'` |
889 |
echo "#define $def" >> CPP_OPTIONS.h.tmp |
echo "#define $def" >> $PACKAGES_DOT_H".tmp" |
890 |
|
#eh3 DEFINES="$DEFINES -D$def" |
891 |
|
|
892 |
#EH3 WARNING : This is an UGLY HACK that needs to be removed!!! |
#EH3 WARNING : This is an UGLY HACK that needs to be removed!!! |
893 |
case $i in |
case $i in |
894 |
aim_v23) |
aim_v23) |
895 |
echo "#define ALLOW_AIM" >> CPP_OPTIONS.h.tmp |
echo "#define ALLOW_AIM" >> $PACKAGES_DOT_H".tmp" |
896 |
|
DEFINES="$DEFINES -DALLOW_AIM" |
897 |
|
echo "Warning: ALLOW_AIM is set to enable aim_v23. This is REALLY ugly Jean-Michel :-)" |
898 |
;; |
;; |
899 |
esac |
esac |
900 |
#EH3 WARNING : This is an UGLY HACK that needs to be removed!!! |
#EH3 WARNING : This is an UGLY HACK that needs to be removed!!! |
901 |
|
|
902 |
done |
done |
903 |
mv -f CPP_OPTIONS.h.tmp CPP_OPTIONS.h |
if test ! -f $PACKAGES_DOT_H ; then |
904 |
|
mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H |
905 |
|
else |
906 |
|
cmp $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H |
907 |
|
RETVAL=$? |
908 |
|
if test "x$RETVAL" = x0 ; then |
909 |
|
rm -f $PACKAGES_DOT_H".tmp" |
910 |
|
else |
911 |
|
mv -f $PACKAGES_DOT_H $PACKAGES_DOT_H".bak" |
912 |
|
mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H |
913 |
|
fi |
914 |
|
fi |
915 |
|
|
916 |
echo " Adding STANDARDDIRS" |
echo " Adding STANDARDDIRS" |
917 |
BUILDDIR=${BUILDDIR:-.} |
BUILDDIR=${BUILDDIR:-.} |
935 |
fi |
fi |
936 |
done |
done |
937 |
|
|
938 |
|
echo " Searching for CPP_OPTIONS.h in order to warn about the presence" |
939 |
|
echo " of \"#define ALLOW_PKGNAME\"-type statements:" |
940 |
|
CPP_OPTIONS= |
941 |
|
spaths=". $INCLUDEDIRS" |
942 |
|
for i in $spaths ; do |
943 |
|
try="$i/CPP_OPTIONS.h" |
944 |
|
# echo -n " trying $try : " |
945 |
|
if test -f $try -a -r $try ; then |
946 |
|
echo " found CPP_OPTIONS=\"$try\"" |
947 |
|
CPP_OPTIONS="$try" |
948 |
|
break |
949 |
|
fi |
950 |
|
done |
951 |
|
if test "x$CPP_OPTIONS" = x ; then |
952 |
|
echo "Error: can't find \"CPP_OPTIONS.h\" in the path list: $spaths" |
953 |
|
exit 1 |
954 |
|
fi |
955 |
|
# New safety test: make sure packages are not mentioned in CPP_OPTIONS.h |
956 |
|
names=`ls -1 "$ROOTDIR/pkg"` |
957 |
|
for n in $names ; do |
958 |
|
test_for_package_in_cpp_options $CPP_OPTIONS $n |
959 |
|
done |
960 |
|
|
961 |
|
|
962 |
echo |
echo |
963 |
echo "=== Creating the Makefile ===" |
echo "=== Creating the Makefile ===" |
964 |
echo " setting INCLUDES" |
echo " setting INCLUDES" |
965 |
for i in $INCLUDEDIRS ; do |
for i in $INCLUDEDIRS ; do |
966 |
if test -d $i ; then |
if ! test -d $i ; then |
967 |
INCLUDES="$INCLUDES -I$i" |
# INCLUDES="$INCLUDES -I$i" |
968 |
else |
# else |
969 |
echo "Warning: can't find INCLUDEDIRS=\"$i\"" |
echo "Warning: can't find INCLUDEDIRS=\"$i\"" |
970 |
fi |
fi |
971 |
done |
done |
1145 |
Clean: |
Clean: |
1146 |
@make clean |
@make clean |
1147 |
@make cleanlinks |
@make cleanlinks |
1148 |
-rm -f Makefile.bak |
-rm -f Makefile.bak gm_state gm_optfile make.log |
1149 |
CLEAN: |
CLEAN: |
1150 |
@make Clean |
@make Clean |
1151 |
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
1152 |
-find \$(EXEDIR) -name "*.data" -exec rm {} \; |
-find \$(EXEDIR) -name "*.data" -exec rm {} \; |
1153 |
-find \$(EXEDIR) -name "fort.*" -exec rm {} \; |
-find \$(EXEDIR) -name "fort.*" -exec rm {} \; |
1154 |
-rm -f \$(EXECUTABLE) |
-rm -f \$(EXECUTABLE) output.txt |
1155 |
|
|
1156 |
makefile: |
makefile: |
1157 |
${0} $@ |
${0} $@ |