Changeset 1403 for trunk/LMDZ.COMMON/makelmdz
- Timestamp:
- Mar 31, 2015, 3:49:07 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.COMMON/makelmdz
r1391 r1403 79 79 80 80 CPP_KEY="" 81 INCLUDE='-I$(LIBF)/grid -I$(LIBF)/ bibio-I$(LIBF)/filtrez -I. '81 INCLUDE='-I$(LIBF)/grid -I$(LIBF)/misc -I$(LIBF)/filtrez -I. ' 82 82 LIB="" 83 83 adjnt="" … … 86 86 PARA_LD="" 87 87 EXT_SRC="" 88 #src_dirs: directories containing source files 89 src_dirs="grid misc" 88 90 ccompiler="" 89 91 OPTIMC="" … … 116 118 [-chimie INCA/false] : (Earth) with INCA chemistry model or without (default: false) 117 119 [-cosp cosp/false] : (Earth) add the cosp model (default: false) 120 [-sisvat true/false] : (Earth) compile with/without sisvat package (default: false) 121 [-rrtm true/false] : (Earth) compile with/without rrtm package (default: false) 118 122 [-parallel none/mpi/omp/mpi_omp] : parallelism (default: none) : mpi, openmp or mixted mpi_openmp 119 123 [-g GRI] : grid configuration in dyn3d/GRI_xy.h (default: reg, inclues a zoom) … … 292 296 for inc in $archfileline ; do INCLUDE="$INCLUDE `echo $inc | grep '\-I'`" ; done 293 297 298 phys_root=$physique 299 if [[ "${physique:0:3}" == "lmd" ]] ; then phys_root=lmd ; fi 300 if [[ "${physique:0:3}" == "mar" ]] ; then phys_root=mar ; fi 301 if [[ "${physique:0:4}" == "mars" ]] ; then phys_root=mars ; fi 302 if [[ "${physique:0:3}" == "std" ]] ; then phys_root=std ; fi 303 if [[ "${physique:0:5}" == "venus" ]] ; then phys_root=venus ; fi 304 if [[ "${physique:0:5}" == "titan" ]] ; then phys_root=titan ; fi 305 if [[ "${physique:0:3}" == "dev" ]] ; then phys_root=dev ; fi 306 294 307 if [[ "$physique" != "nophys" ]] 295 308 then 309 #We'll use some physics 310 src_dirs="$src_dirs phy$physique" 311 LIBPHY='$(LIBO)/libphy'"$physique"'.a' 312 lib_phy='-lphy'"$physique" 296 313 CPP_KEY="$CPP_KEY CPP_PHYS" 297 fi 298 299 if [[ "$physique" == "lmd" ]] 300 then 301 #Default planet type is Earth 314 if [[ "${phys_root}" == "lmd" ]] 315 then 316 #For lmd physics, default planet type is Earth 302 317 CPP_KEY="$CPP_KEY CPP_EARTH" 318 fi 303 319 fi 304 320 … … 309 325 LIB="$LIB -l${LIBPREFIX}chim$physique" 310 326 opt_dep="$opt_dep chim$physique" 327 src_dirs="$src_dirs chim$physique" 311 328 # get C compiler name and optim from arch.fcm file 312 329 archfileline=$( grep -i '^%C_COMPILER' arch.fcm ) … … 322 339 if [[ -d ${LIBFGCM}/aerono${physique} ]] 323 340 then 341 src_dirs="$src_dirs aerono$physique" 324 342 INCLUDE="$INCLUDE -I${LIBFGCM}/aerono${physique}" 325 343 LIB="$LIB -l${LIBPREFIX}aerono$physique" … … 442 460 CPP_KEY="$CPP_KEY CPP_COSP" 443 461 COSP_PATH="$LIBFGCM/cosp" 462 src_dirs="$src_dirs cosp" 444 463 # LIB="${LIB} -l${LIBPREFIX}cosp" 445 464 opt_dep="$opt_dep cosp" … … 451 470 then 452 471 CPP_KEY="$CPP_KEY CPP_SISVAT" 472 src_dirs="$src_dirs phy${physique}/sisvat" 453 473 fi 454 474 … … 456 476 then 457 477 CPP_KEY="$CPP_KEY CPP_RRTM" 478 src_dirs="$src_dirs phy${physique}/rrtm" 458 479 fi 459 480 … … 507 528 cd $LIBFGCM/grid/dimension 508 529 ./makdim $dim 530 if (($? != 0)) 531 then 532 exit 1 533 fi 534 509 535 cat $LIBFGCM/grid/dimensions.h 510 536 cd $LMDGCM … … 534 560 ######################################################################## 535 561 536 dimension=`echo $dim | wc -w` 537 echo dimension $dimension 538 539 if (( $dimension == 3 )) ; then 562 if (( $dimc == 3 )) ; then 563 src_dirs="$src_dirs $filtre dyn3d_common dyn3d${FLAG_PARA}" 564 if [[ $physique != "nophys" ]] ; then 565 src_dirs="$src_dirs dynlonlat_phylonlat dynlonlat_phylonlat/phy${phys_root}" 566 libdyn_phy="-ldynlonlat_phylonlat" 567 LIBDYN_PHYS='$(LIBO)/libdynlonlat_phylonlat.a' 568 INCLUDE="$INCLUDE "'-I$(LIBF)/dynlonlat_phylonlat' 569 INCLUDE="$INCLUDE "'-I$(LIBF)/dynlonlat_phylonlat/'"${phys_root}" 570 fi 540 571 cd $LIBFGCM/grid 541 572 \rm fxyprim.h … … 543 574 filtre="FILTRE=$filtre" 544 575 INCLUDE="$INCLUDE "'-I$(LIBF)/dyn3d${FLAG_PARA} -I$(LIBF)/dyn3d_common ' 545 elif (( $dimension == 2 )) ; then 576 elif (( $dimc == 2 )) ; then 577 src_dirs="$src_dirs dyn2d" 546 578 filtre="FILTRE= L_FILTRE= " 547 579 INCLUDE="$INCLUDE "'-I$(LIBF)/dyn2d' 548 elif (( $dim ension== 1 )) ; then580 elif (( $dimc == 1 )) ; then 549 581 echo pas de dynamique 582 src_dirs="$src_dirs phy${physique}/dyn1d" 550 583 CPP_KEY="$CPP_KEY CPP_1D" 551 filtre="L_DYN= DYN= FILTRE= L_FILTRE= DIRMAIN=phy$physique " 552 INCLUDE="$INCLUDE "'-I$(LIBF)/dyn3d -I$(LIBF)/dyn3d_common ' # Pas tres propre 584 filtre="L_DYN= DYN= FILTRE= L_FILTRE= " 585 #INCLUDE="$INCLUDE "'-I$(LIBF)/dyn3d -I$(LIBF)/dyn3d_common ' # Pas tres propre 586 INCLUDE="$INCLUDE "' -I$(LIBF)/phy'"$physique"'/dyn1d' 553 587 else 554 588 echo Dimension dimc=$dimc pas prevu ; exit … … 588 622 ######################################################################## 589 623 cd $LMDGCM 590 find libf -name '*.[Fh]' -print | sort > tmp77 591 find libf -name '*.[Fh]' -exec egrep -i " *use *ioipsl" {} \; -print | sort > tmp90 592 find libf -name '*.F90' -print | sort >> tmp90 624 625 626 if [[ -r .makelmdz ]] 627 then 628 old_lmdz_configuration=$(cat .makelmdz ) 629 else 630 old_lmdz_configuration="" 631 fi 632 lmdz_configuration="$src_dirs" 633 if [[ "$lmdz_configuration" != "$old_lmdz_configuration" ]] 634 then 635 configuration_change="true" 636 else 637 configuration_change="false" 638 fi 639 640 mkdir -p make_dir 641 suf_make=`echo $src_dirs | sed -e 's/\//_/g' -e 's/ /_/g'` 642 echo suf_make $suf_make 643 644 \rm tmp77 tmp90 645 for dir in $src_dirs ; do 646 find libf/$dir -name '*.[Fh]' -print | sort >> tmp77 647 find libf/$dir -name '*.F90' -print | sort >> tmp90 593 648 ######### CAS PARTICULIER CHIMIE TITAN 594 649 if [[ "$physique" == "titan" ]] … … 597 652 fi 598 653 ######### 599 600 if [[ ! ( -r makefile ) || ! ( -r liste_des_sources_f90 ) || ! ( -r liste_des_sources_f77 ) || ` diff tmp77 liste_des_sources_f77 | wc -w ` -ne 0 || ` diff tmp90 liste_des_sources_f90 | wc -w ` -ne 0 ]] 654 done 655 656 liste77=make_dir/liste_des_sources_f77_$suf_make 657 liste90=make_dir/liste_des_sources_f90_$suf_make 658 if [[ "$physique" == "titan" ]] ; then 659 listeC=make_dir/liste_des_sources_C_$suf_make 660 fi 661 makefile=make_dir/makefile_$suf_make 662 663 if [[ $configuration_change == "true" || ! ( -r makefile ) || ! ( -r $liste_90 ) || ! ( -r $liste_77 ) || ` diff tmp77 $liste_77 | wc -w ` -ne 0 || ` diff tmp90 $liste_90 | wc -w ` -ne 0 ]] 601 664 then 602 665 echo "les fichiers suivants ont ete crees ou detruits" 603 666 echo "ou les fichiers suivants sont passes ou ne sont plus en Fortran 90" 604 diff liste_des_sources_f77tmp77605 diff liste_des_sources_f90 tmp90606 \cp -f tmp77 liste_des_sources_f77607 \cp -f tmp90 liste_des_sources_f90667 diff $liste77 tmp77 668 diff $liste90 tmp90 669 \cp -f tmp77 $liste77 670 \cp -f tmp90 $liste90 608 671 ######### CAS PARTICULIER CHIMIE TITAN 609 672 if [[ "$physique" == "titan" ]] 610 673 then 611 diff liste_des_sources_C tmpC612 \cp -f tmpC liste_des_sources_C674 diff $listeC tmpC 675 \cp -f tmpC $listeC 613 676 fi 614 677 ######### 615 echo "on recree le makefile" 616 ./create_make_gcm > tmp 617 \mv -f tmp makefile 618 echo "Nouveau makefile cree" 678 echo "Recreating the makefile" 679 echo "src_dirs: $src_dirs" 680 ./create_make_gcm $src_dirs > tmp 681 \mv -f tmp $makefile 682 echo "New makefile created" 619 683 ######### CAS PARTICULIER CHIMIE TITAN 620 684 else if [[ "$physique" == "titan" ]] 621 685 then 622 if [[ ! ( -r liste_des_sources_C ) || ` diff tmpC liste_des_sources_C | wc -w ` -ne 0 ]]686 if [[ ! ( -r $listeC ) || ` diff tmpC $listeC | wc -w ` -ne 0 ]] 623 687 then 624 diff liste_des_sources_C tmpC625 \cp -f tmpC liste_des_sources_C688 diff $listeC tmpC 689 \cp -f tmpC $listeC 626 690 echo "on recree le makefile" 627 ./create_make_gcm > tmp628 \mv -f tmp makefile691 ./create_make_gcm $src_dirs > tmp 692 \mv -f tmp $makefile 629 693 echo "Nouveau makefile cree" 630 694 fi … … 633 697 fi 634 698 699 ln -sf $makefile makefile 700 701 #Create a .makelmdz file containing main compilation option for later comparisons 702 echo "$lmdz_configuration" > .makelmdz 703 635 704 ################################################################# 636 705 # Preparation de l'execution de la commande make … … 641 710 then 642 711 source_code=${code}.F 643 code_dir=dyn${dimc}d${FLAG_PARA}712 dirmain=dyn${dimc}d${FLAG_PARA} 644 713 else 645 714 if [[ -r $LMDGCM/libf/dyn${dimc}d${FLAG_PARA}/${code}.F90 ]] 646 715 then 647 716 source_code=${code}.F90 648 code_dir=dyn${dimc}d${FLAG_PARA}717 dirmain=dyn${dimc}d${FLAG_PARA} 649 718 else 650 719 if [[ -r $LMDGCM/libf/phy${physique}/${code}.F ]] 651 720 then 652 721 source_code=${code}.F 653 code_dir=phy${physique}722 dirmain=phy${physique} 654 723 else 655 # last possibility:656 724 if [[ -r $LMDGCM/libf/phy${physique}/${code}.F90 ]] 657 725 then 658 726 source_code=${code}.F90 659 code_dir=phy${physique}727 dirmain=phy${physique} 660 728 else 661 echo "Error: cannot find ${code}.F[90]" 662 echo " neither in dyn${dimc}d${FLAG_PARA} nor in phy${physique}" 663 exit 729 if [[ -r $LMDGCM/libf/dynlonlat_phylonlat/phy$phys_root/${code}.F ]] 730 then 731 source_code=${code}.F 732 dirmain="dynlonlat_phylonlat/phy${phys_root}" 733 else 734 if [[ -r $LMDGCM/libf/phy$physique/dyn1d/${code}.F ]] 735 then 736 source_code=${code}.F 737 dirmain=phy$physique/dyn1d 738 else 739 echo "Error: cannot find ${code}.F[90]" 740 echo " neither in dyn${dimc}d${FLAG_PARA} nor in phy${physique}" 741 exit 742 fi 743 fi 664 744 fi 665 745 fi … … 684 764 then 685 765 INCLUDE="$INCLUDE"' -I$(LIBF)/phy'"$physique" 686 phys="PHYS=$physique" 687 else 688 # trick to avoid having a physics-related library in the makefile 689 phys="L_PHY= LIBPHY=" 690 fi 691 if (( $dimension == 1 )) 692 then 693 INCLUDE="$INCLUDE"' -I$(LIBF)/dyn3d -I'${LIBOGCM}/${nomlib} 694 else 695 INCLUDE="$INCLUDE"' -I$(LIBF)/dyn'${dimc}'d'$FLAG_PARA' -I'${LIBOGCM}/${nomlib} 696 fi 766 # phys="PHYS=$physique" 767 #else 768 # # trick to avoid having a physics-related library in the makefile 769 # phys="L_PHY= LIBPHY=" 770 fi 771 INCLUDE="$INCLUDE"' -I'${LIBOGCM}/${nomlib} 772 #if (( $dimension == 1 )) 773 #then 774 # INCLUDE="$INCLUDE"' -I$(LIBF)/dyn3d -I'${LIBOGCM}/${nomlib} 775 #else 776 #INCLUDE="$INCLUDE"' -I$(LIBF)/dyn'${dimc}'d'$FLAG_PARA' -I'${LIBOGCM}/${nomlib} 777 #fi 697 778 698 779 # ranlib utility (check it exists or else default to ls) … … 727 808 $filtre \ 728 809 LIBO=${LIBOGCM}/${nomlib} \ 729 $phys \ 810 "PHYS=$physique" \ 811 LIBPHY=${LIBPHY} \ 812 LIBDYN_PHYS=${LIBDYN_PHYS} \ 730 813 DIM=$dimc \ 731 814 FLAG_PARA=$FLAG_PARA \ 815 L_PHY="$lib_phy" \ 816 L_DYN_PHY="$libdyn_phy" \ 732 817 L_ADJNT=$adjnt \ 733 818 L_COSP="$lcosp" \ … … 744 829 MOD_SUFFIX="mod" \ 745 830 AR=$arcommand \ 746 DIRMAIN=$ code_dir\831 DIRMAIN=$dirmain \ 747 832 SOURCE=$source_code \ 748 833 PROG=$code … … 758 843 $filtre \ 759 844 LIBO=${LIBOGCM}/${nomlib} \ 760 $phys \ 845 "PHYS=$physique" \ 846 LIBPHY=${LIBPHY} \ 847 LIBDYN_PHYS=${LIBDYN_PHYS} \ 761 848 DIM=$dimc \ 762 849 FLAG_PARA=$FLAG_PARA \ 850 L_PHY="$lib_phy" \ 851 L_DYN_PHY="$libdyn_phy" \ 763 852 L_ADJNT="$adjnt" \ 764 853 L_COSP="$lcosp" \ … … 775 864 MOD_SUFFIX="mod" \ 776 865 AR=$arcommand \ 777 DIRMAIN=$ code_dir\866 DIRMAIN=$dirmain \ 778 867 SOURCE=$source_code \ 779 868 PROG=$code
Note: See TracChangeset
for help on using the changeset viewer.