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 |
|
|
43 |
# Guess possible config options for this host |
# Guess possible config options for this host |
44 |
find_possible_configs() { |
find_possible_configs() { |
45 |
|
|
46 |
p_PLATFORM=`uname`"-"`uname -m` |
tmp1=`uname`"_"`uname -m` |
47 |
echo "The platform appears to be:" |
tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` |
48 |
echo " "$p_PLATFORM |
PLATFORM=`echo $tmp2 | sed -e 's/i[3-6]86/ia32/'` |
49 |
|
OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")` |
50 |
p_LN= |
echo " The platform appears to be: $PLATFORM" |
51 |
|
# if test "x$OFLIST" = x ; then |
52 |
|
# echo " No pre-defined options files were found matching this platform" |
53 |
|
# echo " but examples for other platforms can be found in:" |
54 |
|
# echo " $ROOTDIR/tools/build_options" |
55 |
|
# else |
56 |
|
# echo " Options files (located in $ROOTDIR/tools/build_options) that" |
57 |
|
# echo " may work with this machine are:" |
58 |
|
# for i in $OFLIST ; do |
59 |
|
# echo " $i" |
60 |
|
# done |
61 |
|
# fi |
62 |
|
|
63 |
echo "test" > test |
echo "test" > test |
64 |
ln -s ./test link |
ln -s ./test link |
65 |
RETVAL=$? |
RETVAL=$? |
66 |
if test "x${RETVAL}" = x0 ; then |
if test "x${RETVAL}" = x0 ; then |
67 |
p_LN="ln -s" |
LN="ln -s" |
68 |
|
else |
69 |
|
echo "Error: \"ln -s\" does not appear to work on this system!" |
70 |
|
echo " For help, please contact <MITgcm-support@mitgcm.org>." |
71 |
|
exit 1 |
72 |
fi |
fi |
73 |
rm -f test link |
rm -f test link |
74 |
|
|
75 |
p_CPP=`which cpp` |
if test "x$CPP" = x ; then |
76 |
|
CPP="cpp -traditional -P" |
|
RETVAL=$? |
|
|
if test "x${RETVAL}" = x0 ; then |
|
|
p_LN="ln -s" |
|
77 |
fi |
fi |
|
rm -f test link |
|
78 |
|
|
79 |
# look for possible fortran compilers |
# look for possible fortran compilers |
80 |
|
tmp="$MITGCM_FC $FC g77 f77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95" |
81 |
p_FC= |
p_FC= |
82 |
for c in f77 g77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95 ; do |
for c in $tmp ; do |
83 |
which $c > /dev/null 2>&1 |
rm -f ./hello.f ./hello |
84 |
|
cat >> hello.f <<EOF |
85 |
|
program hello |
86 |
|
do i=1,3 |
87 |
|
print *, 'hello world : ', i |
88 |
|
enddo |
89 |
|
end |
90 |
|
EOF |
91 |
|
$c -o hello hello.f > /dev/null 2>&1 |
92 |
RETVAL=$? |
RETVAL=$? |
93 |
if test "x${RETVAL}" = x0 ; then |
if test "x${RETVAL}" = x0 ; then |
94 |
p_FC="$p_FC $c" |
p_FC="$p_FC $c" |
95 |
fi |
fi |
96 |
done |
done |
|
echo "Possible FORTRAN compilers appear to be: " |
|
97 |
if test "x${p_FC}" = x ; then |
if test "x${p_FC}" = x ; then |
98 |
echo " None found!!!" |
cat 1>&2 <<EOF |
99 |
|
|
100 |
|
Error: No Fortran compilers were found in your path. Please specify one using: |
101 |
|
|
102 |
|
1) an "optfile" on (eg. "-optfile=path/to/OPTFILE"), |
103 |
|
2) a command-line option (eg. "-fc NAME"), or |
104 |
|
3) the MITGCM_FC environment variable. |
105 |
|
|
106 |
|
EOF |
107 |
|
exit 1 |
108 |
else |
else |
109 |
echo " "$p_FC |
echo " The possible FORTRAN compilers found in your path are:" |
110 |
|
echo " "$p_FC |
111 |
|
if test "x$FC" = x ; then |
112 |
|
FC=`echo $p_FC | awk '{print $1}'` |
113 |
|
fi |
114 |
fi |
fi |
115 |
|
|
116 |
# look for possible MPI libraries |
for i in $p_FC ; do |
117 |
mpi_libs= |
p_OF=$ROOTDIR"/tools/build_options/"$PLATFORM"_"$i |
118 |
mpi_fort=`which mpif77 2>/dev/null` |
if test -r $p_OF ; then |
119 |
RETVAL=$? |
OPTFILE=$p_OF |
120 |
if test "x${RETVAL}" = x0 ; then |
echo " The options file: $p_OF" |
121 |
cat >>test.f <<EOF |
echo " appears to match so we'll use it." |
122 |
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 |
|
123 |
fi |
fi |
124 |
rm -f test.f out |
done |
125 |
|
if test "x$OPTFILE" = x ; then |
126 |
|
cat 1>&2 <<EOF |
127 |
|
|
128 |
|
Error: No options file was found in: $ROOTDIR/tools/build_options/ |
129 |
|
that matches this platform ("$PLATFORM") and the compilers found in |
130 |
|
your path. Please specify an "optfile" using: |
131 |
|
|
132 |
|
1) the command line (eg. "-optfile=path/to/OPTFILE"), or |
133 |
|
2) the MITGCM_OF environment variable. |
134 |
|
|
135 |
|
If you need help, please contact the developers at <MITgcm-support@mitgcm.org>. |
136 |
|
|
137 |
|
EOF |
138 |
|
exit 1 |
139 |
fi |
fi |
140 |
|
|
141 |
|
# # look for possible MPI libraries |
142 |
|
# mpi_libs= |
143 |
|
# mpi_fort=`which mpif77 2>/dev/null` |
144 |
|
# RETVAL=$? |
145 |
|
# if test "x${RETVAL}" = x0 ; then |
146 |
|
# cat >>test.f <<EOF |
147 |
|
# PROGRAM HELLO |
148 |
|
# DO 10, I=1,10 |
149 |
|
# PRINT *,'Hello World' |
150 |
|
# 10 CONTINUE |
151 |
|
# STOP |
152 |
|
# END |
153 |
|
# EOF |
154 |
|
# eval "$mpi_fort -showme test.f > out" |
155 |
|
# RETVAL=$? |
156 |
|
# if test "x${RETVAL}" = x0 ; then |
157 |
|
# a=`cat out` |
158 |
|
# for i in $a ; do |
159 |
|
# case $i in |
160 |
|
# -*) |
161 |
|
# mpi_libs="$mpi_libs $i" ;; |
162 |
|
# esac |
163 |
|
# done |
164 |
|
# echo "The MPI libs appear to be:" |
165 |
|
# echo " "$mpi_libs |
166 |
|
# fi |
167 |
|
# rm -f test.f out |
168 |
|
# fi |
169 |
|
|
170 |
} |
} |
171 |
|
|
261 |
KPP= |
KPP= |
262 |
FC= |
FC= |
263 |
LINK= |
LINK= |
264 |
|
DEFINES="-DWORDLENGTH=4" |
265 |
PACKAGES= |
PACKAGES= |
266 |
ENABLE= |
ENABLE= |
267 |
DISABLE= |
DISABLE= |
268 |
MAKEFILE= |
MAKEFILE= |
269 |
MAKEDEPEND= |
MAKEDEPEND= |
270 |
PDEPEND= |
PDEPEND= |
271 |
DUMPSTATE=f |
DUMPSTATE=t |
272 |
PDEFAULT= |
PDEFAULT= |
273 |
OPTFILE= |
OPTFILE= |
274 |
INCLUDES="-I." |
INCLUDES="-I." |
451 |
|
|
452 |
done |
done |
453 |
|
|
454 |
|
if test "x${ROOTDIR}" = x ; then |
455 |
|
if test "${PWD##/*/}" = "bin" -a -d ../model -a -d ../eesup -a -d ../pkg ; then |
456 |
|
ROOTDIR=".." |
457 |
|
else |
458 |
|
for d in . .. ../.. ../../.. ../../../.. ../../../../.. ; do |
459 |
|
if [ -d "$d/model" -a -d "$d/eesupp" -a -d "$d/pkg" ]; then |
460 |
|
ROOTDIR=$d |
461 |
|
echo -n "Warning: ROOTDIR was not specified but there appears to be" |
462 |
|
echo " a copy of MITgcm at \"$ROOTDIR\" so we'll try it." |
463 |
|
break |
464 |
|
fi |
465 |
|
done |
466 |
|
fi |
467 |
|
fi |
468 |
|
if test "x${ROOTDIR}" = x ; then |
469 |
|
echo "Error: Cannot determine ROOTDIR for MITgcm code." |
470 |
|
echo " Please specify a ROOTDIR using either an options " |
471 |
|
echo " file or a command-line option." |
472 |
|
exit 1 |
473 |
|
fi |
474 |
|
if test ! -d ${ROOTDIR} ; then |
475 |
|
echo "Error: the specified ROOTDIR (\"$ROOTDIR\") does not exist!" |
476 |
|
exit 1 |
477 |
|
fi |
478 |
|
|
479 |
echo " getting OPTFILE information: " |
echo " getting OPTFILE information: " |
480 |
if test "x${OPTFILE}" = x ; then |
if test "x${OPTFILE}" = x ; then |
481 |
echo "Warning: no OPTFILE specified so we'll look for possible settings" |
if test "x$MITGCM_OF" = x ; then |
482 |
printf "\n=== Searching for possible settings for OPTFILE ===\n" |
echo "Warning: no OPTFILE specified so we'll look for possible settings" |
483 |
find_possible_configs |
printf "\n=== Searching for possible settings for OPTFILE ===\n" |
484 |
else |
find_possible_configs |
|
if test "x$OPTFILE" = xNONE ; then |
|
|
echo " OPTFILE=NONE so we'll try to use default settings" |
|
485 |
else |
else |
486 |
if test -f "$OPTFILE" -a -r "$OPTFILE" ; then |
OPTFILE=$MITGCM_OF |
487 |
echo " using OPTFILE=\"$OPTFILE\"" |
fi |
488 |
source "$OPTFILE" |
fi |
489 |
RETVAL=$? |
if test "x$OPTFILE" != xNONE ; then |
490 |
if test "x$RETVAL" != x0 ; then |
if test -f "$OPTFILE" -a -r "$OPTFILE" ; then |
491 |
echo -n "Error: failed to source OPTFILE \"$OPTFILE\"" |
echo " using OPTFILE=\"$OPTFILE\"" |
492 |
echo "--please check that variable syntax is bash-compatible" |
source "$OPTFILE" |
493 |
exit 1 |
RETVAL=$? |
494 |
fi |
if test "x$RETVAL" != x0 ; then |
495 |
if test "x$DUMPSTATE" != xf ; then |
echo -n "Error: failed to source OPTFILE \"$OPTFILE\"" |
496 |
cp -f $OPTFILE "gm_optfile" |
echo "--please check that variable syntax is bash-compatible" |
|
fi |
|
|
else |
|
|
echo "Error: can't read OPTFILE=\"$OPTFILE\"" |
|
497 |
exit 1 |
exit 1 |
498 |
fi |
fi |
499 |
|
if test "x$DUMPSTATE" != xf ; then |
500 |
|
cp -f $OPTFILE "gm_optfile" |
501 |
|
fi |
502 |
|
else |
503 |
|
echo "Error: can't read OPTFILE=\"$OPTFILE\"" |
504 |
|
exit 1 |
505 |
fi |
fi |
506 |
fi |
fi |
507 |
|
|
521 |
LINK=$FC |
LINK=$FC |
522 |
fi |
fi |
523 |
if test "x$CPP" = x ; then |
if test "x$CPP" = x ; then |
524 |
|
CPP="cpp" |
525 |
|
fi |
526 |
|
echo "#define A a" | cpp > test_cpp 2>&1 |
527 |
|
RETVAL=$? |
528 |
|
if test "x$RETVAL" != x0 ; then |
529 |
cat <<EOF 1>&2 |
cat <<EOF 1>&2 |
530 |
|
|
531 |
Error: no C pre-processor: please specify using one of the following: |
Error: C pre-processor "$CPP" failed the test case: please specify using: |
532 |
|
|
533 |
1) within the options file ("CPP=...") as specified by "-of=OPTFILE" |
1) within the options file ("CPP=...") as specified by "-of=OPTFILE" |
534 |
2) the "./gm_local" file |
2) the "./gm_local" file |
|
EOF |
|
|
exit 1 |
|
|
fi |
|
|
if test "x$S64" = x ; then |
|
|
cat <<EOF 1>&2 |
|
535 |
|
|
|
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 |
|
536 |
EOF |
EOF |
537 |
exit 1 |
exit 1 |
538 |
|
else |
539 |
|
rm -f test_cpp |
540 |
|
fi |
541 |
|
if test "x$MAKEDEPEND" = x ; then |
542 |
|
MAKEDEPEND=makedepend |
543 |
fi |
fi |
|
|
|
544 |
|
|
545 |
printf "\n=== Setting defaults ===\n" |
printf "\n=== Setting defaults ===\n" |
546 |
echo -n " Adding MODS directories: " |
echo -n " Adding MODS directories: " |
564 |
PLATFORM=$p_PLATFORM |
PLATFORM=$p_PLATFORM |
565 |
fi |
fi |
566 |
|
|
|
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 |
|
|
|
|
567 |
if test "x${EXEDIR}" = x ; then |
if test "x${EXEDIR}" = x ; then |
568 |
if test "${PWD##/*/}" = "bin" -a -d ../exe -a $ROOTDIR = .. ; then |
if test "${PWD##/*/}" = "bin" -a -d ../exe -a $ROOTDIR = .. ; then |
569 |
EXEDIR=../exe |
EXEDIR=../exe |
583 |
echo "Error: the specified $TOOLSDIR (\"$TOOLSDIR\") does not exist!" |
echo "Error: the specified $TOOLSDIR (\"$TOOLSDIR\") does not exist!" |
584 |
exit 1 |
exit 1 |
585 |
fi |
fi |
586 |
|
if test "x$S64" = x ; then |
587 |
|
S64='$(TOOLSDIR)/set64bitConst.sh' |
588 |
|
fi |
589 |
|
|
590 |
EXECUTABLE=${EXECUTABLE:-mitgcmuv} |
EXECUTABLE=${EXECUTABLE:-mitgcmuv} |
591 |
|
|
676 |
done |
done |
677 |
PACKAGES="$pack" |
PACKAGES="$pack" |
678 |
echo " applying ENABLE settings" |
echo " applying ENABLE settings" |
679 |
rm -f ./.tmp_pack |
echo "" > ./.tmp_pack |
680 |
PACKAGES="$PACKAGES $ENABLE" |
PACKAGES="$PACKAGES $ENABLE" |
681 |
for i in $PACKAGES ; do |
for i in $PACKAGES ; do |
682 |
if test ! -d "$ROOTDIR/pkg/$i" ; then |
if test ! -d "$ROOTDIR/pkg/$i" ; then |
792 |
# done |
# done |
793 |
# echo |
# echo |
794 |
|
|
795 |
echo " Searching for CPP_OPTIONS.h (macros and flags for configuring the model):" |
# Create a list of #define and #undef to enable/disable packages |
796 |
CPP_OPTIONS= |
PACKAGES_DOT_H=PACKAGES.h |
797 |
spaths="$MODS ./ $SOURCEDIRS" |
if test -e $PACKAGES_DOT_H ; then |
798 |
for i in $spaths ; do |
cat $PACKAGES_DOT_H \ |
|
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 \ |
|
799 |
| awk 'BEGIN{p=1;} ($1=="C===" && $2=="GENMAKE"){p=0;} {if (p==1) print $0}' \ |
| awk 'BEGIN{p=1;} ($1=="C===" && $2=="GENMAKE"){p=0;} {if (p==1) print $0}' \ |
800 |
> CPP_OPTIONS.h.tmp |
> $PACKAGES_DOT_H".tmp" |
801 |
fi |
fi |
802 |
cat <<EOF >>CPP_OPTIONS.h.tmp |
cat <<EOF >>$PACKAGES_DOT_H".tmp" |
803 |
C=== GENMAKE v2 === |
C=== GENMAKE v2 === |
804 |
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 |
805 |
C them only if you know what you're doing. In general, you should |
C edit anything below these comments. In general, you should |
806 |
C add or remove packages by re-running genmake with different |
C add or remove packages by re-running genmake with different |
807 |
C "-enable" and/or "-disable" options. |
C "-enable" and/or "-disable" options. |
808 |
|
|
825 |
done |
done |
826 |
if test "x$has_pack" = xf ; then |
if test "x$has_pack" = xf ; then |
827 |
undef=`echo "ALLOW_$n" | awk '{print toupper($0)}'` |
undef=`echo "ALLOW_$n" | awk '{print toupper($0)}'` |
828 |
echo "#undef $undef" >> CPP_OPTIONS.h.tmp |
echo "#undef $undef" >> $PACKAGES_DOT_H".tmp" |
829 |
|
# DEFINES="$DEFINES -U$undef" |
830 |
|
|
831 |
#EH3 WARNING : This is an UGLY HACK that needs to be removed!!! |
#EH3 WARNING : This is an UGLY HACK that needs to be removed!!! |
832 |
case $n in |
case $n in |
836 |
mom_vecinv) |
mom_vecinv) |
837 |
DEFINES="$DEFINES -DDISABLE_MOM_VECINV" |
DEFINES="$DEFINES -DDISABLE_MOM_VECINV" |
838 |
;; |
;; |
|
generic_advdiff) |
|
|
DEFINES="$DEFINES -DDISABLE_GENERIC_ADVDIFF" |
|
|
;; |
|
839 |
debug) |
debug) |
840 |
DEFINES="$DEFINES -DDISABLE_DEBUGMODE" |
DEFINES="$DEFINES -DDISABLE_DEBUGMODE" |
841 |
;; |
;; |
845 |
fi |
fi |
846 |
fi |
fi |
847 |
done |
done |
848 |
cat <<EOF >>CPP_OPTIONS.h.tmp |
cat <<EOF >>$PACKAGES_DOT_H".tmp" |
849 |
|
|
850 |
C Packages enabled by genmake: |
C Packages enabled by genmake: |
851 |
EOF |
EOF |
852 |
for i in $PACKAGES ; do |
for i in $PACKAGES ; do |
853 |
def=`echo "ALLOW_$i" | awk '{print toupper($0)}'` |
def=`echo "ALLOW_$i" | awk '{print toupper($0)}'` |
854 |
echo "#define $def" >> CPP_OPTIONS.h.tmp |
echo "#define $def" >> $PACKAGES_DOT_H".tmp" |
855 |
|
#eh3 DEFINES="$DEFINES -D$def" |
856 |
|
|
857 |
#EH3 WARNING : This is an UGLY HACK that needs to be removed!!! |
#EH3 WARNING : This is an UGLY HACK that needs to be removed!!! |
858 |
case $i in |
case $i in |
859 |
aim_v23) |
aim_v23) |
860 |
echo "#define ALLOW_AIM" >> CPP_OPTIONS.h.tmp |
echo "#define ALLOW_AIM" >> $PACKAGES_DOT_H".tmp" |
861 |
|
DEFINES="$DEFINES -DALLOW_AIM" |
862 |
|
echo "Warning: ALLOW_AIM is set to enable aim_v23. This is REALLY ugly Jean-Michel :-)" |
863 |
;; |
;; |
864 |
esac |
esac |
865 |
#EH3 WARNING : This is an UGLY HACK that needs to be removed!!! |
#EH3 WARNING : This is an UGLY HACK that needs to be removed!!! |
866 |
|
|
867 |
done |
done |
868 |
mv -f CPP_OPTIONS.h.tmp CPP_OPTIONS.h |
cmp $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H |
869 |
|
RETVAL=$? |
870 |
|
if test "x$RETVAL" = x0 ; then |
871 |
|
mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H".bak" |
872 |
|
mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H |
873 |
|
fi |
874 |
|
|
875 |
echo " Adding STANDARDDIRS" |
echo " Adding STANDARDDIRS" |
876 |
BUILDDIR=${BUILDDIR:-.} |
BUILDDIR=${BUILDDIR:-.} |
894 |
fi |
fi |
895 |
done |
done |
896 |
|
|
897 |
|
echo " Searching for CPP_OPTIONS.h in order to warn about the presence" |
898 |
|
echo " of \"#define ALLOW_PKGNAME\"-type statements:" |
899 |
|
CPP_OPTIONS= |
900 |
|
spaths=". $INCLUDEDIRS" |
901 |
|
for i in $spaths ; do |
902 |
|
try="$i/CPP_OPTIONS.h" |
903 |
|
# echo -n " trying $try : " |
904 |
|
if test -f $try -a -r $try ; then |
905 |
|
echo " found CPP_OPTIONS=\"$try\"" |
906 |
|
CPP_OPTIONS="$try" |
907 |
|
break |
908 |
|
fi |
909 |
|
done |
910 |
|
if test "x$CPP_OPTIONS" = x ; then |
911 |
|
echo "Error: can't find \"CPP_OPTIONS.h\" in the path list: $spaths" |
912 |
|
exit 1 |
913 |
|
fi |
914 |
|
# New safety test: make sure packages are not mentioned in CPP_OPTIONS.h |
915 |
|
names=`ls -1 "$ROOTDIR/pkg"` |
916 |
|
for n in $names ; do |
917 |
|
test_for_package_in_cpp_options $CPP_OPTIONS $n |
918 |
|
done |
919 |
|
|
920 |
|
|
921 |
echo |
echo |
922 |
echo "=== Creating the Makefile ===" |
echo "=== Creating the Makefile ===" |
923 |
echo " setting INCLUDES" |
echo " setting INCLUDES" |
924 |
for i in $INCLUDEDIRS ; do |
for i in $INCLUDEDIRS ; do |
925 |
if test -d $i ; then |
if ! test -d $i ; then |
926 |
INCLUDES="$INCLUDES -I$i" |
# INCLUDES="$INCLUDES -I$i" |
927 |
else |
# else |
928 |
echo "Warning: can't find INCLUDEDIRS=\"$i\"" |
echo "Warning: can't find INCLUDEDIRS=\"$i\"" |
929 |
fi |
fi |
930 |
done |
done |
1104 |
Clean: |
Clean: |
1105 |
@make clean |
@make clean |
1106 |
@make cleanlinks |
@make cleanlinks |
1107 |
-rm -f Makefile.bak |
-rm -f Makefile.bak gm_state gm_optfile make.log PACKAGES.h* |
1108 |
CLEAN: |
CLEAN: |
1109 |
@make Clean |
@make Clean |
1110 |
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
1111 |
-find \$(EXEDIR) -name "*.data" -exec rm {} \; |
-find \$(EXEDIR) -name "*.data" -exec rm {} \; |
1112 |
-find \$(EXEDIR) -name "fort.*" -exec rm {} \; |
-find \$(EXEDIR) -name "fort.*" -exec rm {} \; |
1113 |
-rm -f \$(EXECUTABLE) |
-rm -f \$(EXECUTABLE) output.txt |
1114 |
|
|
1115 |
makefile: |
makefile: |
1116 |
${0} $@ |
${0} $@ |