2616 |
-rm -rf *.o |
-rm -rf *.o |
2617 |
-rm -rf *.$FS *.flowdir |
-rm -rf *.$FS *.flowdir |
2618 |
-rm -rf *.f$FS90 *_mod.h *_mod.F90 *.FF90 *.mod-whirl ad_input* |
-rm -rf *.f$FS90 *_mod.h *_mod.F90 *.FF90 *.mod-whirl ad_input* |
2619 |
-rm -rf temp.sed reslice.dat |
-rm -rf temp.sed |
2620 |
Clean: |
Clean: |
2621 |
@make clean |
@make clean |
2622 |
@make cleanlinks |
@make cleanlinks |
2682 |
# The normal chain of rules is ( .F - .$FS - .o ) |
# The normal chain of rules is ( .F - .$FS - .o ) |
2683 |
|
|
2684 |
## This nullifies any default implicit rules concerning these two file types: |
## This nullifies any default implicit rules concerning these two file types: |
2685 |
%.o : %.F |
## %.o : %.F |
2686 |
|
|
2687 |
.F.$FS: |
.F.$FS: |
2688 |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
2740 |
echo " Add the source list for AD code generation" |
echo " Add the source list for AD code generation" |
2741 |
echo >> $MAKEFILE |
echo >> $MAKEFILE |
2742 |
printf "AD_FILES = " >> $MAKEFILE |
printf "AD_FILES = " >> $MAKEFILE |
2743 |
AD_FILES=`cat ad_files` |
AD_FILES=`cat adSrcFiles.tmp` |
2744 |
for i in $AD_FILES ; do |
for i in $AD_FILES ; do |
2745 |
echo " \\" >> $MAKEFILE |
echo " \\" >> $MAKEFILE |
2746 |
printf " $i" >> $MAKEFILE |
printf " $i" >> $MAKEFILE |
2747 |
done |
done |
2748 |
echo >> $MAKEFILE |
echo >> $MAKEFILE |
2749 |
rm -f ad_files |
rm -f adSrcFiles.tmp |
2750 |
|
|
2751 |
cat >>$MAKEFILE <<EOF |
cat >>$MAKEFILE <<EOF |
2752 |
|
|
2938 |
f95_test_mods.f90: \$(OPENAD_SUPPORT_F90_SRC_FILES:F90=$FS90) |
f95_test_mods.f90: \$(OPENAD_SUPPORT_F90_SRC_FILES:F90=$FS90) |
2939 |
cat \$^ > \$@ |
cat \$^ > \$@ |
2940 |
|
|
2941 |
f95_test.f90: all_mods.xb.x2w.w2f.pp.f$FS90 \$(NON_AD_F77_SRC_FILES:.F=_cb2m.f$FS90) ad_input_code.w2f.canon.xb.x2w.w2f.rs.pp.f$FS90 |
f95_test.f90: all_mods.xb.x2w.w2f.pp.f$FS90 \$(NON_AD_F77_SRC_FILES:.F=_cb2m.f$FS90) ad_input_code.w2f.pre.xb.x2w.w2f.td.pp.f$FS90 |
2942 |
cat \$^ > \$@ |
cat \$^ > \$@ |
2943 |
|
|
2944 |
f95_test.out: f95_test_mods.f90 f95_test.f90 |
f95_test.out: f95_test_mods.f90 f95_test.f90 |
2945 |
f95 -fixed -w=unused -maxcontin=132 -c f95_test_mods.f90 > \$@ 2>&1 |
f95 -fixed -w=unused -maxcontin=132 -c f95_test_mods.f90 > \$@ 2>&1 |
2946 |
f95 -fixed -w=unused -maxcontin=132 -c -fixed f95_test.f90 >> \$@ 2>&1 |
f95 -fixed -w=unused -maxcontin=132 -c -fixed f95_test.f90 >> \$@ 2>&1 |
2947 |
|
|
2948 |
AD_OBJ_FILES=\$(OPENAD_SUPPORT_F90_SRC_FILES:.F90=.o) \$(OPENAD_SUPPORT_C_SRC_FILES:.c=.o) all_mods.xb.x2w.w2f.pp.o ad_input_code.w2f.canon.xb.x2w.w2f.rs.pp.o \$(NON_AD_F77_SRC_FILES:.F=_cb2m.o) \$(C_SRC_FILES:.c=.o) \$(F90_SRC_FILES:.F90=.o) |
AD_OBJ_FILES=\$(OPENAD_SUPPORT_F90_SRC_FILES:.F90=.o) \$(OPENAD_SUPPORT_C_SRC_FILES:.c=.o) all_mods.xb.x2w.w2f.pp.o ad_input_code.w2f.pre.xb.x2w.w2f.td.pp.o \$(NON_AD_F77_SRC_FILES:.F=_cb2m.o) \$(C_SRC_FILES:.c=.o) \$(F90_SRC_FILES:.F90=.o) |
2949 |
|
|
2950 |
\$(EXE_AD): \$(ALL_LINKED_FILES) \$(addsuffix _mod.h, \$(CB2M_F90_SRC_NAMES)) \$(AD_OBJ_FILES) |
\$(EXE_AD): \$(ALL_LINKED_FILES) \$(addsuffix _mod.h, \$(CB2M_F90_SRC_NAMES)) \$(AD_OBJ_FILES) |
2951 |
@echo Creating \$@ ... |
@echo Creating \$@ ... |
2952 |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(AD_OBJ_FILES) \$(LIBS) |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(AD_OBJ_FILES) \$(LIBS) |
2953 |
|
|
2954 |
# makefile debug rule |
# makefile debug rule |
2955 |
openad: ad_input_code.w2f.canon.xb.x2w.w2f.rs.pp.f$FS90 |
openad: ad_input_code.w2f.pre.xb.x2w.w2f.td.pp.f$FS90 |
2956 |
.PHONY: openad |
.PHONY: openad |
2957 |
|
|
2958 |
# create the module files |
# create the module files |
2998 |
cat w2f__types.f90 \$(basename \$<).w2f.f > \$@ |
cat w2f__types.f90 \$(basename \$<).w2f.f > \$@ |
2999 |
|
|
3000 |
# canonicalizer |
# canonicalizer |
3001 |
ad_input_code_sf.w2f.canon.f$FS90: ad_input_code_sf.w2f.f$FS90 canon.v1.py |
ad_input_code_sf.w2f.pre.f$FS90: ad_input_code_sf.w2f.f$FS90 preProcess.py |
3002 |
python canon.v1.py --r8 \$< > \$@ |
./preProcess.py -H \$< -o \$@ |
3003 |
|
|
3004 |
# F -> WHIRL |
# F -> WHIRL |
3005 |
# note that the canonicalized version cuts off at col 72 |
# note that the canonicalized version cuts off at col 72 |
3007 |
# as we are in fixed mode and cut of exactly there. |
# as we are in fixed mode and cut of exactly there. |
3008 |
# Otherwise mfef90 patches in spaces to fill up to 72 (or 132) |
# Otherwise mfef90 patches in spaces to fill up to 72 (or 132) |
3009 |
# characters respectively. |
# characters respectively. |
3010 |
ad_input_code_sf.w2f.canon.B: ad_input_code_sf.w2f.canon.f$FS90 mfef90 |
ad_input_code_sf.w2f.pre.B: ad_input_code_sf.w2f.pre.f$FS90 mfef90 |
3011 |
./mfef90 -r8 -z -F \$< |
./mfef90 -r8 -z -F \$< |
3012 |
mv \$<.B \$@ |
mv \$<.B \$@ |
3013 |
|
|
3014 |
# WHIRL -> XAIF |
# WHIRL -> XAIF |
3015 |
ad_input_code_sf.w2f.canon.xaif : ad_input_code_sf.w2f.canon.B whirl2xaif |
ad_input_code_sf.w2f.pre.xaif : ad_input_code_sf.w2f.pre.B whirl2xaif |
3016 |
./whirl2xaif -s -n --debug 1 -o \$@ \$< |
./whirl2xaif -s -n --debug 1 -o \$@ \$< |
3017 |
|
|
3018 |
# XAIF -> XAIF' |
# XAIF -> XAIF' |
3019 |
ad_input_code_sf.w2f.canon.xb.xaif : ad_input_code_sf.w2f.canon.xaif xaif.xsd xaif_base.xsd xaif_inlinable_intrinsics.xsd xaif_derivative_propagator.xsd xaif_output.xsd openad_adm |
ad_input_code_sf.w2f.pre.xb.xaif : ad_input_code_sf.w2f.pre.xaif xaif.xsd xaif_base.xsd xaif_inlinable_intrinsics.xsd xaif_derivative_propagator.xsd xaif_output.xsd openad_adm |
3020 |
./openad_adm -f -t forward_step -i \$< -c \${XAIFSCHEMAROOT}/schema/examples/inlinable_intrinsics.xaif -o \$@ -I -r |
./openad_adm -f -t forward_step -i \$< -c \${XAIFSCHEMAROOT}/schema/examples/inlinable_intrinsics.xaif -o \$@ -I -r |
3021 |
|
|
3022 |
# XAIF' -> WHIRL' |
# XAIF' -> WHIRL' |
3023 |
ad_input_code_sf.w2f.canon.xb.x2w.B : ad_input_code_sf.w2f.canon.xb.xaif xaif2whirl |
ad_input_code_sf.w2f.pre.xb.x2w.B : ad_input_code_sf.w2f.pre.xb.xaif xaif2whirl |
3024 |
./xaif2whirl --debug 1 --structured ad_input_code_sf.w2f.canon.B \$< |
./xaif2whirl --debug 1 --structured ad_input_code_sf.w2f.pre.B \$< |
3025 |
|
|
3026 |
# WHIRL' -> F' |
# WHIRL' -> F' |
3027 |
ad_input_code_sf.w2f.canon.xb.x2w.w2f.f$FS90: ad_input_code_sf.w2f.canon.xb.x2w.B whirl2f whirl2f_be |
ad_input_code_sf.w2f.pre.xb.x2w.w2f.f$FS90: ad_input_code_sf.w2f.pre.xb.x2w.B whirl2f whirl2f_be |
3028 |
./whirl2f -FLIST:ftn_file=\$@ -openad \$< |
./whirl2f -FLIST:ftn_file=\$@ -openad \$< |
3029 |
|
|
|
# undo slice hiding |
|
3030 |
# insert template directives |
# insert template directives |
3031 |
ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.f$FS90: ad_input_code_sf.w2f.canon.xb.x2w.w2f.f$FS90 reslicer.py ../OAD_support/insertTemplateDir.bash |
ad_input_code_sf.w2f.pre.xb.x2w.w2f.td.f$FS90: ad_input_code_sf.w2f.pre.xb.x2w.w2f.f$FS90 ../OAD_support/insertTemplateDir.bash |
3032 |
python reslicer.py \$< > \$<.1 |
../OAD_support/insertTemplateDir.bash \$< \$@ |
|
../OAD_support/insertTemplateDir.bash \$<.1 \$@ |
|
|
rm \$<.1 |
|
3033 |
|
|
3034 |
# postprocess F' |
# postprocess F' |
3035 |
ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.pp.f$FS90: ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.f$FS90 multi-pp.pl ../OAD_support/ad_inline.f \$(wildcard ../OAD_support/ad_template.*.f) |
ad_input_code_sf.w2f.pre.xb.x2w.w2f.td.pp.f$FS90: ad_input_code_sf.w2f.pre.xb.x2w.w2f.td.f$FS90 multi-pp.pl ../OAD_support/ad_inline.f \$(wildcard ../OAD_support/ad_template.*.f) |
3036 |
perl multi-pp.pl -inline=../OAD_support/ad_inline.f \$< |
perl multi-pp.pl -inline=../OAD_support/ad_inline.f \$< |
3037 |
# the postprocessor still gets the name wrong |
# the postprocessor still gets the name wrong |
3038 |
cat \$<.pp | sed 's/RETURN//' > \$@ |
cat \$<.pp | sed 's/RETURN//' > \$@ |
3039 |
|
|
3040 |
# extract all transformed modules |
# extract all transformed modules |
3041 |
all_mods.xb.x2w.w2f.pp.f$FS90: ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.pp.f$FS90 |
all_mods.xb.x2w.w2f.pp.f$FS90: ad_input_code_sf.w2f.pre.xb.x2w.w2f.td.pp.f$FS90 |
3042 |
cat \$< | sed -n '/MODULE /,/END MODULE/p' > \$@ |
cat \$< | sed -n '/MODULE /,/END MODULE/p' > \$@ |
3043 |
|
|
3044 |
# remove the transformed globals module from the |
# remove the transformed globals module from the |
3045 |
# transformed ad_input_code file |
# transformed ad_input_code file |
3046 |
# and remove for now the duplicate variables |
# and remove for now the duplicate variables |
3047 |
# and fix 2 data statements |
# and fix 2 data statements |
3048 |
ad_input_code.w2f.canon.xb.x2w.w2f.rs.pp.f$FS90: ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.pp.f$FS90 |
ad_input_code.w2f.pre.xb.x2w.w2f.td.pp.f$FS90: ad_input_code_sf.w2f.pre.xb.x2w.w2f.td.pp.f$FS90 |
3049 |
cat \$< | sed '/MODULE /,/END MODULE/d' | sed '/^ INTEGER(w2f__i4) DOLOOP_UB/d' > \$@ |
cat \$< | sed '/MODULE /,/END MODULE/d' | sed '/^ INTEGER(w2f__i4) DOLOOP_UB/d' > \$@ |
3050 |
|
|
3051 |
# setup some links |
# setup some links |
3065 |
%.pl: |
%.pl: |
3066 |
\$(LN) \${OPENADFORTTK}/bin/\$@ . |
\$(LN) \${OPENADFORTTK}/bin/\$@ . |
3067 |
|
|
3068 |
%.py: |
preProcess.py: |
3069 |
\$(LN) \${OPENADROOT}/OpenADFortTk/tools/canonicalize/\$@ . |
\$(LN) \${OPENADFORTTK_BASE}/tools/SourceProcessing/\$@ . |
3070 |
|
|
3071 |
whirl2f whirl2f_be: |
whirl2f whirl2f_be: |
3072 |
\$(LN) \${OPEN64ROOT}/whirl2f/\$@ . |
\$(LN) \${OPEN64ROOT}/whirl2f/\$@ . |