#============================================================================
#
# Code_Saturne version 1.3
# ------------------------
#
#
# This file is part of the Code_Saturne Kernel, element of the
# Code_Saturne CFD tool.
#
# Copyright (C) 1998-2007 EDF S.A., France
#
# contact: saturne-support@edf.fr
#
# The Code_Saturne Kernel is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
#
# The Code_Saturne Kernel is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with the Code_Saturne Kernel; if not, write to the
# Free Software Foundation, Inc.,
# 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA
#
#============================================================================
#
# Makefile pour Code_Saturne
############################
#
# Macros environnement
# ====================
SHELL =/bin/sh
VERSION ="1.3.f"
TERM =xterm
# Macros de configuration du projet
# =================================
# Répertoires de base du projet
DIR_CS = $(CS_HOME)
BIN_CS = $(DIR_CS)/bin
INC_CS = $(DIR_CS)/include
SRC_CS = $(DIR_CS)/src
USR_CS = $(DIR_CS)/users
ARCH_CS = $(DIR_CS)/arch/$(NOM_ARCH)
ARCHBIN_CS = $(ARCH_CS)/bin
ARCHLIB_CS = $(ARCH_CS)/lib
BLD_CS = $(DIR_CS)/build
# Nom de base de la librairie et nom de l'exécutable Code_Saturne
NOM_LIB_CS_PRE = "saturne"
NOM_EXE = "cs13.exe"
# Purify
PURIFY = purify
# Macros spécifiques au système d'exploitation
# ============================================
include $(BIN_CS)/macros_$(NOM_ARCH).mk
# Macros utilisateur
#===================
# Définition du mode choisi (EF, PUR, DBG ...)
MYOPT = $(OPT)
# Définition des variables pour la compilation
MYCCOMPFLAGS = $(OPTC)
MYFTNCOMPFLAGS = $(OPTF)
# Definition des variables pour l'édition de liens
MYLDEDLFLAGS = $(OPTLD)
MYLIBS = $(OPTLIBS)
# Macros définissant les librairies (BASE, LAGR, ...)
#=============================================================================
# Definition de la librairie a generer
# (determine par defaut a partir du repertoire de travail)
MYMODULE = $(MOD)
# Definition des librairies a utiliser pour l'édition de liens
MYLIBRAIRIES = $(LIB)
# Macros définissant les librairies à linker
#===========================================
LIBRAIRIEOPT = $(LIBOPT)
LIBRAIRIELO = $(LIBLO)
LIBRAIRIEDBG = $(LIBDBG)
LIBRAIRIEPUR =
LIBRAIRIEEF = $(LIBEF)
LIBRAIRIE = $(LIBBASIC)
# Macros pour présentation
#-------------------------
BO = `tput bold`
SO = `tput smso`
NO = `tput rmso; tput sgr0`
# Définition des objets à créer
#==============================
.c.o:
@echo $<
@\rm -f $*_pure*.o
$(CCOMP) $(INC_CS_I) $(ALLCCOMPFLAGS) -c $<
#%.o : %.F95
# @echo $<
# @\rm -f $*_pure*.o
# $(FTNCOMP) $(ALLFCOMPFLAGS) -c $<
.F.o:
@echo $<
@\rm -f $*_pure*.o
$(FTNCOMP) $(ALLFCOMPFLAGS) -c $<
# Définitions des cibles
#=======================
default:
@dirtrav=`pwd` ;\
if [ `echo "$${dirtrav}" | grep "$(BLD_CS)"` ] ; \
then make lib ;\
else make link ;\
fi
saturne:
@make link
lib:
@make privtitre
@make privconfig
@make privcompil
@make privlib
@make privfin
lib_install:
@make privtitre
@make privconfig
@make privcompil
@make privlib
@make privlibinst
@make privfin
link:
@make privtitre
@make privcompil
@make privlink
@make privfin
compversion:
@make privtitre
@make privcompil
@make privlink
@make privfin
comp:
@make privtitre
@make privcomp
@make privfin
foresys:
@make privtitre
@make privforesys
privcomp:
@make privconfig
@make privcompil
#
# privcompil reconnait le repertoire dans lequel on travaille (MOD et OPT)
# fait un lien sur les fichiers sources adequat (si build)
# genere les listes de dependance
# positionne les OBJECTS et les options de compil
#
privcompil:
@dirtrav=`pwd` ;\
dirprec=`dirname $${dirtrav}` ;\
if [ "$${dirprec}" = "$(BLD_CS)/$(NOM_ARCH)" ] ;\
then opttrav="" ;\
modtrav=`basename $${dirtrav}` ;\
else dirprec1=`dirname $${dirprec}` ;\
if [ "$${dirprec1}" = "$(BLD_CS)/$(NOM_ARCH)" ] ;\
then opttrav=`basename $${dirtrav}` ;\
modtrav=`basename $${dirprec}` ;\
else opttrav="$(MYOPT)" ;\
modtrav="" ;\
fi ;\
fi ;\
if [ "$${modtrav}" = "BASE" ] ;\
then inc_cs_all="$(INC_CS)/base $(INC_CS)/cfbl $(INC_CS)/cogz $(INC_CS)/cplv $(INC_CS)/elec $(INC_CS)/lagr $(INC_CS)/pprt $(INC_CS)/rayt $(INC_CS)/mati" ;\
src_cs_all="$(USR_CS)/base $(SRC_CS)/base_1 $(SRC_CS)/base_2 $(USR_CS)/pprt $(SRC_CS)/pprt" ;\
elif [ "$${modtrav}" = "CFBL" ] ;\
then inc_cs_all="$(INC_CS)/base $(INC_CS)/pprt $(INC_CS)/cfbl" ;\
src_cs_all="$(USR_CS)/cfbl $(SRC_CS)/cfbl" ;\
elif [ "$${modtrav}" = "COGZ" ] ;\
then inc_cs_all="$(INC_CS)/base $(INC_CS)/pprt $(INC_CS)/rayt $(INC_CS)/cogz $(INC_CS)/cplv" ;\
src_cs_all="$(USR_CS)/cogz $(SRC_CS)/cogz" ;\
elif [ "$${modtrav}" = "CPLV" ] ;\
then inc_cs_all="$(INC_CS)/base $(INC_CS)/lagr $(INC_CS)/pprt $(INC_CS)/rayt $(INC_CS)/cogz $(INC_CS)/cplv";\
src_cs_all="$(USR_CS)/cplv $(SRC_CS)/cplv" ;\
elif [ "$${modtrav}" = "ELEC" ] ;\
then inc_cs_all="$(INC_CS)/base $(INC_CS)/elec $(INC_CS)/pprt $(INC_CS)/rayt" ;\
src_cs_all="$(USR_CS)/elec $(SRC_CS)/elec" ;\
elif [ "$${modtrav}" = "LAGR" ] ;\
then inc_cs_all="$(INC_CS)/base $(INC_CS)/lagr $(INC_CS)/pprt $(INC_CS)/rayt $(INC_CS)/cogz $(INC_CS)/cplv" ;\
src_cs_all="$(USR_CS)/lagr $(SRC_CS)/lagr" ;\
elif [ "$${modtrav}" = "RAYT" ] ;\
then inc_cs_all="$(INC_CS)/base $(INC_CS)/cfbl $(INC_CS)/lagr $(INC_CS)/pprt $(INC_CS)/rayt $(INC_CS)/cogz $(INC_CS)/cplv" ;\
src_cs_all="$(USR_CS)/rayt $(SRC_CS)/rayt" ;\
elif [ "$${modtrav}" = "MATI" ] ;\
then inc_cs_all="$(INC_CS)/base $(INC_CS)/cfbl $(INC_CS)/lagr $(INC_CS)/pprt $(INC_CS)/rayt $(INC_CS)/cogz $(INC_CS)/cplv $(INC_CS)/mati" ;\
src_cs_all="$(SRC_CS)/mati" ;\
elif [ "$${modtrav}" = "" ] ;\
then inc_cs_all="$(INC_CS)/base $(INC_CS)/cfbl $(INC_CS)/cogz $(INC_CS)/cplv $(INC_CS)/elec $(INC_CS)/lagr $(INC_CS)/pprt $(INC_CS)/rayt $(INC_CS)/mati" ;\
src_cs_all="" ;\
fi ;\
make privcopie INC_CS="$${inc_cs_all}" SRC_CS="$${src_cs_all}" ;\
make privdepend ;\
echo "*** Compilation" ;\
cflags="$(VARDEF)" ;\
fflags="" ;\
dir_inc_cs="$(BFT_INC) $(FVM_INC)" ;\
if [ ${MPI} -eq 1 ] ;\
then dir_inc_cs="$${dir_inc_cs} $(MPI_INC)" ;\
cflags="$${cflags} -D_CS_HAVE_MPI " ;\
fi ; \
if [ ${MPE} -eq 1 ] ;\
then dir_inc_cs="$${dir_inc_cs} $(MPE_INC)" ;\
cflags="$${cflags} -D_CS_HAVE_MPE ";\
if [ ${MPE_COMM} -eq 1 ] ; \
then cflags="$${cflags} -D_CS_COMM_PROFILING ";\
fi ; \
fi ; \
if [ ${SOCKET} -eq 1 ] ;\
then dir_inc_cs="$${dir_inc_cs} $(SOCKET_INC)" ;\
cflags="$${cflags} -D_CS_HAVE_SOCKET " ;\
fi ; \
if [ ${BLAS} -eq 1 ] ;\
then dir_inc_cs="$${dir_inc_cs} $(BLAS_INC)" ;\
cflags="$${cflags} -D_CS_HAVE_BLAS " ;\
fflags="$${fflags} -D_CS_HAVE_BLAS " ;\
fi ; \
if [ ${XML} -eq 1 ] ;\
then dir_inc_cs="$${dir_inc_cs} $(XML_INC)" ;\
cflags="$${cflags} -D_CS_HAVE_XML " ;\
fflags="$${fflags} -D_CS_HAVE_XML " ;\
fi ; \
if [ "$(MYOPT)" = "LO" ] ;\
then make privdependobj OBJECTS="`cat .liste_mkfiles.o`" \
INC_CS_I="$${dir_inc_cs}" \
ALLCCOMPFLAGS=" $${cflags} $(MYCCOMPFLAGS) \
-DDEBUG $(CCOMPFLAGSLO)" \
ALLFCOMPFLAGS=" $${fflags} $(MYFTNCOMPFLAGS) \
$(FTNCOMPFLAGSLO)" ;\
elif [ "$(MYOPT)" = "DBG" ] ;\
then make privdependobj OBJECTS="`cat .liste_mkfiles.o`" \
INC_CS_I="$${dir_inc_cs}" \
ALLCCOMPFLAGS=" $${cflags} $(MYCCOMPFLAGS) \
-DDEBUG $(CCOMPFLAGSDBG)" \
ALLFCOMPFLAGS=" $${fflags} $(MYFTNCOMPFLAGS) \
$(FTNCOMPFLAGSDBG)" ;\
elif [ "$(MYOPT)" = "EF" ] ;\
then make privdependobj OBJECTS="`cat .liste_mkfiles.o`" \
INC_CS_I="$${dir_inc_cs}" \
ALLCCOMPFLAGS=" $${cflags} $(MYCCOMPFLAGS) \
-DDEBUG $(CCOMPFLAGSDBG)" \
ALLFCOMPFLAGS=" $${fflags} $(MYFTNCOMPFLAGS) \
$(FTNCOMPFLAGSDBG)" ;\
elif [ "$(MYOPT)" = "PUR" ] ;\
then make privdependobj OBJECTS="`cat .liste_mkfiles.o`" \
INC_CS_I="$${dir_inc_cs}" \
ALLCCOMPFLAGS=" $${cflags} $(MYCCOMPFLAGS) \
-DNDEBUG $(CCOMPFLAGSDBG)" \
ALLFCOMPFLAGS=" $${fflags} $(MYFTNCOMPFLAGS) \
$(FTNCOMPFLAGSDBG)" ;\
elif [ "$(MYOPT)" = "PROF" ] ;\
then \
if [ -n "$(LISTE_OPT_PART1)" ] ;\
then make privdependoptpart LISTE_OPT_PART="$(LISTE_OPT_PART1)" ;\
make privdependobj OBJECTS="`cat .liste_mkoptpart.o`" \
INC_CS_I="$${dir_inc_cs}" \
ALLCCOMPFLAGS=" $${cflags} $(MYCCOMPFLAGS) \
-DNDEBUG $(CCOMPFLAGSOPTPART1) $(CCOMPFLAGSPROF)" \
ALLFCOMPFLAGS=" $${fflags} $(MYFTNCOMPFLAGS) \
$(FTNCOMPFLAGSOPTPART1) $(FTNCOMPFLAGSPROF)" ;\
fi ;\
if [ -n "$(LISTE_OPT_PART2)" ] ;\
then make privdependoptpart LISTE_OPT_PART="$(LISTE_OPT_PART2)" ;\
make privdependobj OBJECTS="`cat .liste_mkoptpart.o`" \
INC_CS_I="$${dir_inc_cs}" \
ALLCCOMPFLAGS=" $${cflags} $(MYCCOMPFLAGS) \
-DNDEBUG $(CCOMPFLAGSOPTPART2) $(CCOMPFLAGSPROF)" \
ALLFCOMPFLAGS=" $${fflags} $(MYFTNCOMPFLAGS) \
$(FTNCOMPFLAGSOPTPART2) $(FTNCOMPFLAGSPROF)" ;\
fi ;\
if [ -n "$(LISTE_OPT_PART3)" ] ;\
then make privdependoptpart LISTE_OPT_PART="$(LISTE_OPT_PART3)" ;\
make privdependobj OBJECTS="`cat .liste_mkoptpart.o`" \
INC_CS_I="$${dir_inc_cs}" \
ALLCCOMPFLAGS=" $${cflags} $(MYCCOMPFLAGS) \
-DNDEBUG $(CCOMPFLAGSOPTPART3) $(CCOMPFLAGSPROF)" \
ALLFCOMPFLAGS=" $${fflags} $(MYFTNCOMPFLAGS) \
$(FTNCOMPFLAGSOPTPART3) $(FTNCOMPFLAGSPROF)" ;\
fi ;\
make privdependobj OBJECTS="`cat .liste_mkfiles.o`" \
INC_CS_I="$${dir_inc_cs}" \
ALLCCOMPFLAGS=" $${cflags} $(MYCCOMPFLAGS) \
-DNDEBUG $(CCOMPFLAGS) $(CCOMPFLAGSPROF)" \
ALLFCOMPFLAGS=" $${fflags} $(MYFTNCOMPFLAGS) \
$(FTNCOMPFLAGS) $(FTNCOMPFLAGSPROF)" ;\
elif [ "$(MYOPT)" = "VERS" ] ;\
then make privdependobj OBJECTS="`cat .liste_mkfiles.o`" \
INC_CS_I="$${dir_inc_cs}" \
ALLCCOMPFLAGS=" $${cflags} \
-DNDEBUG $(CCOMPFLAGSVERS)" \
ALLFCOMPFLAGS=" $${fflags} \
$(FTNCOMPFLAGSVERS)" ;\
elif [ "$(MYOPT)" = "" ] ;\
then if [ -n "$(LISTE_OPT_PART1)" ] ;\
then make privdependoptpart LISTE_OPT_PART="$(LISTE_OPT_PART1)" ;\
make privdependobj OBJECTS="`cat .liste_mkoptpart.o`" \
INC_CS_I="$${dir_inc_cs}" \
ALLCCOMPFLAGS=" $${cflags} $(MYCCOMPFLAGS) \
-DNDEBUG $(CCOMPFLAGSOPTPART1)" \
ALLFCOMPFLAGS=" $${fflags} $(MYFTNCOMPFLAGS) \
$(FTNCOMPFLAGSOPTPART1)" ;\
fi ;\
if [ -n "$(LISTE_OPT_PART2)" ] ;\
then make privdependoptpart LISTE_OPT_PART="$(LISTE_OPT_PART2)" ;\
make privdependobj OBJECTS="`cat .liste_mkoptpart.o`" \
INC_CS_I="$${dir_inc_cs}" \
ALLCCOMPFLAGS=" $${cflags} $(MYCCOMPFLAGS) \
-DNDEBUG $(CCOMPFLAGSOPTPART2)" \
ALLFCOMPFLAGS=" $${fflags} $(MYFTNCOMPFLAGS) \
$(FTNCOMPFLAGSOPTPART2)" ;\
fi ;\
if [ -n "$(LISTE_OPT_PART3)" ] ;\
then make privdependoptpart LISTE_OPT_PART="$(LISTE_OPT_PART3)" ;\
make privdependobj OBJECTS="`cat .liste_mkoptpart.o`" \
INC_CS_I="$${dir_inc_cs}" \
ALLCCOMPFLAGS=" $${cflags} $(MYCCOMPFLAGS) \
-DNDEBUG $(CCOMPFLAGSOPTPART3)" \
ALLFCOMPFLAGS=" $${fflags} $(MYFTNCOMPFLAGS) \
$(FTNCOMPFLAGSOPTPART3)" ;\
fi ;\
make privdependobj OBJECTS="`cat .liste_mkfiles.o`" \
INC_CS_I="$${dir_inc_cs}" \
ALLCCOMPFLAGS=" $${cflags} $(MYCCOMPFLAGS) \
-DNDEBUG $(CCOMPFLAGS)" \
ALLFCOMPFLAGS=" $${fflags} $(MYFTNCOMPFLAGS) \
$(FTNCOMPFLAGS)" ;\
fi
@echo "*** Compilation terminée" ; echo
#
# privforesys reconnait le repertoire dans lequel on travaille (MOD et OPT)
# fait un lien sur tous les fichiers sources (si build)
# pour utilisation de FORESYS (par exemple)
# On a adapte le debut de privcompil
#
privforesys:
@dirtrav=`pwd` ;\
dirprec=`dirname $${dirtrav}` ;\
if [ "$${dirprec}" = "$(BLD_CS)/$(NOM_ARCH)" ] ;\
then opttrav="" ;\
modtrav=`basename $${dirtrav}` ;\
else dirprec1=`dirname $${dirprec}` ;\
if [ "$${dirprec1}" = "$(BLD_CS)/$(NOM_ARCH)" ] ;\
then opttrav=`basename $${dirtrav}` ;\
modtrav=`basename $${dirprec}` ;\
else opttrav="$(MYOPT)" ;\
modtrav="" ;\
fi ;\
fi ;\
if [ "$${modtrav}" = "FORESYS" ] ;\
then inc_cs_all="$(INC_CS)/base $(INC_CS)/cogz $(INC_CS)/cplv $(INC_CS)/elec $(INC_CS)/lagr $(INC_CS)/pprt $(INC_CS)/rayt $(INC_CS)/cfbl $(INC_CS)/mati" ;\
src_cs_all="$(USR_CS)/base $(SRC_CS)/base_1 $(SRC_CS)/base_2 $(SRC_CS)/pprt\
$(USR_CS)/cogz $(SRC_CS)/cogz\
$(USR_CS)/cplv $(SRC_CS)/cplv\
$(USR_CS)/elec $(SRC_CS)/elec\
$(USR_CS)/lagr $(SRC_CS)/lagr\
$(USR_CS)/rayt $(SRC_CS)/rayt\
$(SRC_CS)/mati\
$(USR_CS)/cfbl $(SRC_CS)/cfbl";\
for dir in $${src_cs_all} $${inc_cs_all} ;\
do for fich in $${dir}/*.[F,h] ;\
do if [ -f "$${fich}" ] ;\
then fichloc=`basename $${fich}` ;\
cp $${fich} $${fichloc} ;\
fi ;\
done ;\
done ;\
for dir in $${src_cs_all} $${inc_cs_all} ;\
do for fich in $${dir}/*.[F,h] ;\
do if [ -f "$${fich}" ] ;\
then fichloc=`basename $${fich}` ;\
preproc="non" ;\
grep '#' $${fichloc} 1> /dev/null 2>&1 && preproc="oui" ;\
if [ "$${preproc}" = "oui" ] ;\
then cc -P $(VARDEF) $(FTNCOMPFLAGSDEF) $${fichloc} ;\
ext=`echo $${fichloc}|awk -F. '{print $$2}'` ;\
fic=`echo $${fichloc}|awk -F. '{print $$1}'` ;\
mv $${fic}.i $${fic}.$${ext} ;\
fi ;\
fi ;\
done ;\
done ;\
fi
#
# privdepend genere les listes de dependance
#
privdepend:
@mkfiles="" ;\
liste="" ;\
for file in *.c *.F* ;\
do if [ "$${file}" != "*.c" -a "$${file}" != "*.F*" ] ;\
then mkfiles="$${mkfiles} `basename $${file}`" ;\
fi ;\
done ;\
echo "$${mkfiles}" | sed -e "s/\.c/.o/g" \
-e "s/\.F95/.o/g" \
-e "s/\.F/.o/g" \
-e "s/ \*\.o//g"> .liste_mkfiles.o
#
# privdependoptpart genere les listes de dependance
privdependoptpart:
@mkfiles="" ;\
if [ -n "$(LISTE_OPT_PART)" ] ;\
then \
for file in $(LISTE_OPT_PART) ;\
do \
if test -n "$${file}" ;\
then if test -r "$${file}" ;\
then mkfiles="$${mkfiles} `basename $${file}`" ;\
fi ;\
fi ;\
done ;\
fi ;\
if [ -f .liste_mkoptpart.o ] ;\
then \rm -f .liste_mkoptpart.o ;\
fi ;\
echo "$${mkfiles}" | sed -e "s/\.c/.o/g" \
-e "s/\.F95/.o/g" \
-e "s/\.F/.o/g" > .liste_mkoptpart.o
privdependobj: $(OBJECTS)
privtitre:
@echo
@echo "*** Compilation/lien Code_Saturne version $(VERSION)"
@echo "*** Système $(NOM_ARCH)"
@echo
#
# privcopie fait les liens sur les sources si on est dans build
# et uniquement sur les includes qui n'existent pas sinon
# on enleve le "touch -r $${fich} $${fichloc} ;\"
# dans le cas utilisateur
#
privcopie:
@dirtrav=`pwd` ;\
dirprec=`dirname $${dirtrav}` ;\
dirprec1=`dirname $${dirprec}` ;\
if [ "$${dirprec}" != "$(BLD_CS)/$(NOM_ARCH)" \
-a "$${dirprec1}" != "$(BLD_CS)/$(NOM_ARCH)" ] ;\
then for dir in $(INC_CS) ;\
do if [ -d $${dir} ] ;\
then \
ifich="0" ;\
for fich in $${dir}/*.* ;\
do \
if [ -f $${fich} ] ;\
then ifich="1" ;\
fi ;\
done ;\
if [ $${ifich} -eq "1" ] ;\
then \
for fich in $${dir}/*.? ;\
do \
if [ ! -d $${fich} ] ;\
then fichloc=`basename $${fich}` ;\
if [ ! -h $${fichloc} ] ;\
then \
if [ ! -f $${fichloc} ] ;\
then \
ln -s $${fich} . ;\
fi ;\
fi ;\
fi ;\
done ;\
fi ;\
fi ;\
done ;\
else for dir in $(INC_CS) $(SRC_CS) ;\
do \
if [ -d $${dir} ] ;\
then \
ifich="0" ;\
for fich in $${dir}/*.* ;\
do \
if [ -f $${fich} ] ;\
then ifich="1" ;\
fi ;\
done ;\
if [ $${ifich} -eq "1" ] ;\
then \
for fich in $${dir}/*.? ;\
do \
if [ ! -d $${fich} ] ;\
then fichloc=`basename $${fich}` ;\
if test ! -h $${fichloc} ;\
then ln -s $${fich} . ;\
fi ;\
touch -r $${fich} $${fichloc} ;\
fi ;\
done ;\
fi ;\
fi ;\
done ;\
fi
privmodexe:
@echo "*** Exécutable :" ; echo
@ls -l $(NOM_EXE)
@make privfin
# comme dans privmodlink je duplique librairiesloc au lien pour
# etre sur que l'editeur de liens trouve tous les modules
privmodpurify:
@for fichobj in *.c ;\
do \
nom=`basename $${fichobj} .c` ;\
nom=`ls -1 $${nom}*.o | grep -v _pure_` ;\
objinstr="$${objinstr} $${nom}" ;\
done ;\
for fichobj in *.F ;\
do \
nom=`basename $${fichobj} .F` ;\
nom=`ls -1 $${nom}*.o | grep -v _pure_` ;\
objinstr="$${objinstr} $${nom}" ;\
done ;\
for fichobj in *.F95 ;\
do \
nom=`basename $${fichobj} .F95` ;\
nom=`ls -1 $${nom}*.o | grep -v _pure_` ;\
objinstr="$${objinstr} $${nom}" ;\
meslibrairies="$(MYLIBRAIRIES)" ;\
if [ "$${meslibrairies}" = "" ] ;\
then librairiesloc="$(ARCHLIB_CS)/lib$(NOM_LIB_CS_PRE)BASE$(MYOPT).a \
$(ARCHLIB_CS)/lib$(NOM_LIB_CS_PRE)CFBL$(MYOPT).a \
$(ARCHLIB_CS)/lib$(NOM_LIB_CS_PRE)COGZ$(MYOPT).a \
$(ARCHLIB_CS)/lib$(NOM_LIB_CS_PRE)CPLV$(MYOPT).a \
$(ARCHLIB_CS)/lib$(NOM_LIB_CS_PRE)ELEC$(MYOPT).a \
$(ARCHLIB_CS)/lib$(NOM_LIB_CS_PRE)LAGR$(MYOPT).a \
$(ARCHLIB_CS)/lib$(NOM_LIB_CS_PRE)MATI$(MYOPT).a \
$(ARCHLIB_CS)/lib$(NOM_LIB_CS_PRE)RAYT$(MYOPT).a" ;\
else librairiesloc="" ;\
for libloc in $${meslibrairies} ;\
do librairiesloc="$${librairiesloc} $(ARCHLIB_CS)/$${libloc}" ;\
done ;\
fi ;\
$(PURIFY) $(LDEDL) -o $(NOM_EXE) $(ALLLDEDLFLAGS) $${objinstr} \
$${librairiesloc} $${librairiesloc} $(LIBRAIRIE) $(MYLIBS)
@echo "*** Edition de liens terminée" ; echo
@make privmodexe
#
# privlib genere la librairie
# le nom est issu du repertoire de travail (on aurait pu utiliser MYOPT
# et MYMODULE, mais MYMODULE n'est pas toujours renseigne)
#
privlib:
@echo "*** Création de la librairie"
@dirtrav=`pwd` ;\
dirprec=`dirname $${dirtrav}` ;\
if [ "$${dirprec}" = "$(BLD_CS)/$(NOM_ARCH)" ] ;\
then opttrav="" ;\
modtrav=`basename $${dirtrav}` ;\
else dirprec1=`dirname $${dirprec}` ;\
if [ "$${dirprec1}" = "$(BLD_CS)/$(NOM_ARCH)" ] ;\
then opttrav=`basename $${dirtrav}` ;\
modtrav=`basename $${dirprec}` ;\
else opttrav="$(MYOPT)" ;\
modtrav="" ;\
fi ;\
fi ;\
\rm -f "lib$(NOM_LIB_CS_PRE)$${modtrav}$${opttrav}.a" ;\
ar -cr "lib$(NOM_LIB_CS_PRE)$${modtrav}$${opttrav}.a" *.o
@echo "*** Création de la librairie terminée" ; echo
#
# privlibinst positionne la librairie
# le nom est issu du repertoire de travail (on aurait pu utiliser MYOPT
# et MYMODULE, mais MYMODULE n'est pas toujours renseigne)
#
privlibinst:
@echo "*** Installation de la librairie"
@if [ ! -d "$(DIR_CS)/arch" ] ; \
then mkdir "$(DIR_CS)/arch" ; \
fi ;\
if [ ! -d "$(ARCH_CS)" ] ; \
then mkdir "$(ARCH_CS)" ; \
fi ;\
if [ ! -d "$(ARCHBIN_CS)" ] ; \
then mkdir "$(ARCHBIN_CS)" ; \
fi ;\
if [ ! -d "$(ARCHLIB_CS)" ] ; \
then mkdir "$(ARCHLIB_CS)" ; \
fi
@dirtrav=`pwd` ;\
dirprec=`dirname $${dirtrav}` ;\
if [ "$${dirprec}" = "$(BLD_CS)/$(NOM_ARCH)" ] ;\
then opttrav="" ;\
modtrav=`basename $${dirtrav}` ;\
else dirprec1=`dirname $${dirprec}` ;\
if [ "$${dirprec1}" = "$(BLD_CS)/$(NOM_ARCH)" ] ;\
then opttrav=`basename $${dirtrav}` ;\
modtrav=`basename $${dirprec}` ;\
else opttrav="$(MYOPT)" ;\
modtrav="" ;\
fi ;\
fi ;\
mv "lib$(NOM_LIB_CS_PRE)$${modtrav}$${opttrav}.a" "$(ARCHLIB_CS)"
@echo "*** Installation de la librairie terminée" ; echo
privcmdlink:
$(LDEDL) -o $(NOM_EXE) $(ALLLDEDLFLAGS) $(LISTE_OBJ) \
$(LIBRAIRIES) $(MYLIBS)
privmodlink:
@liste_obj="" ;\
for file in *.o ;\
do if test "$${file}" != "*.o" ;\
then liste_obj="$${liste_obj} $${file}" ;\
fi ;\
done ;\
meslibrairies="$(MYLIBRAIRIES)" ;\
if [ "$${meslibrairies}" = "" ] ;\
then librairiesloc="$(ARCHLIB_CS)/lib$(NOM_LIB_CS_PRE)BASE$(MYOPT).a \
$(ARCHLIB_CS)/lib$(NOM_LIB_CS_PRE)CFBL$(MYOPT).a \
$(ARCHLIB_CS)/lib$(NOM_LIB_CS_PRE)COGZ$(MYOPT).a \
$(ARCHLIB_CS)/lib$(NOM_LIB_CS_PRE)CPLV$(MYOPT).a \
$(ARCHLIB_CS)/lib$(NOM_LIB_CS_PRE)ELEC$(MYOPT).a \
$(ARCHLIB_CS)/lib$(NOM_LIB_CS_PRE)LAGR$(MYOPT).a \
$(ARCHLIB_CS)/lib$(NOM_LIB_CS_PRE)MATI$(MYOPT).a \
$(ARCHLIB_CS)/lib$(NOM_LIB_CS_PRE)RAYT$(MYOPT).a" ;\
elif [ "$${meslibrairies}" = "VERS" ] ;\
then librairiesloc="" ;\
else librairiesloc="" ;\
for libloc in $${meslibrairies} ;\
do librairiesloc="$${librairiesloc} $(ARCHLIB_CS)/$${libloc}" ;\
done ;\
fi ;\
fvm_config="$(FVM_HOME)/bin/fvm-config" ;\
librairiessup="" ;\
librairiessup="$${librairiessup} `$${fvm_config} --ldflags hdf5`" ;\
librairiessup="$${librairiessup} `$${fvm_config} --libs hdf5`" ;\
librairiessup="$${librairiessup} `$${fvm_config} --ldflags cgns`" ;\
librairiessup="$${librairiessup} `$${fvm_config} --libs cgns`" ;\
librairiessup="$${librairiessup} `$${fvm_config} --ldflags med`" ;\
librairiessup="$${librairiessup} `$${fvm_config} --libs med`" ;\
if [ "$(LDEDLRPATH)" != "" ] ;\
then libpath="" ;\
for str in $(LIBRAIRIE) $${librairiessup} ;\
do libdir="" ;\
if [ "`echo $${str} | cut -c1-2`" = "-L" ] ;\
then libdir=`echo $${str} | cut -c3-` ;\
elif [ "`echo $${str} | cut -c1-6`" = "-Wl,-L" ] ;\
then libdir=`echo $${str} | cut -c7-` ;\
fi ;\
if [ "$${libdir}" != "" ] ;\
then islib=`find $${libdir} -name "*.so" |wc -w` ;\
if [ $$islib -gt 0 ] ;\
then \
if [ "$${libpath}" = "" ] ;\
then libpath="$(LDEDLRPATH)$${libdir}" ;\
else libpath="$${libpath}:$${libdir}" ;\
fi ;\
fi ;\
fi ;\
done ;\
librairiessup="$${librairiessup} $${libpath}" ;\
echo libpath=$${libpath} ;\
fi ;\
make privcmdlink \
ALLLDEDLFLAGS="$(ALLLDEDLFLAGS)" LISTE_OBJ="$${liste_obj}" \
LIBRAIRIES="$${librairiesloc} $${librairiesloc} $(LIBRAIRIE) $${librairiessup}"
@echo "*** Edition de liens terminée" ; echo
@make privmodexe NOM_EXE=" $(NOM_EXE) "
privlink:
@echo "*** Edition de liens"
@librairie=" $(LIBRAIRIE) " ;\
if [ "$(MYOPT)" = "LO" ] ;\
then librairie="$${librairie} $(LIBRAIRIELO) " ;\
elif [ "$(MYOPT)" = "DBG" ] ;\
then librairie="$${librairie} $(LIBRAIRIEDBG) " ;\
elif [ "$(MYOPT)" = "EF" ] ;\
then librairie="$${librairie} $(LIBRAIRIEEF) " ;\
elif [ "$(MYOPT)" = "PUR" ] ;\
then librairie="$${librairie} $(LIBRAIRIEPUR) " ;\
elif [ "$(MYOPT)" = "PROF" ] ;\
then librairie="$${librairie} $(LIBRAIRIEOPT) " ;\
elif [ "$(MYOPT)" = "VERS" ] ;\
then librairie="$${librairie} " ;\
elif [ "$(MYOPT)" = "" ] ;\
then librairie="$${librairie} $(LIBRAIRIEOPT) " ;\
fi ; \
if [ ${MPI} -eq 1 ] ;\
then librairie="$${librairie} ${MPI_LIB} " ;\
if [ ${MPE} -eq 1 ] ;\
then librairie="$${librairie} ${MPE_LIB} " ;\
fi ; \
fi ; \
if [ ${SOCKET} -eq 1 ] ;\
then librairie="$${librairie} ${SOCKET_LIB} " ;\
fi ; \
if [ ${BLAS} -eq 1 ] ;\
then librairie="$${librairie} ${BLAS_LDFLAGS} " ;\
fi ; \
if [ ${XML} -eq 1 ] ;\
then librairie="$${librairie} ${XML_LIB} " ;\
fi ; \
if [ "$(MYOPT)" = "LO" ] ;\
then make privmodlink \
ALLLDEDLFLAGS="$(MYLDEDLFLAGS) $(LDEDLFLAGSLO)" \
LIBRAIRIE="$${librairie}" \
MYLIBRAIRIES="$(MYLIBRAIRIES)" ;\
elif [ "$(MYOPT)" = "DBG" ] ;\
then make privmodlink \
ALLLDEDLFLAGS="$(MYLDEDLFLAGS) $(LDEDLFLAGSDBG)" \
LIBRAIRIE="$${librairie}" \
MYLIBRAIRIES="$(MYLIBRAIRIES)" ;\
elif [ "$(MYOPT)" = "EF" ] ;\
then make privmodlink \
ALLLDEDLFLAGS="$(MYLDEDLFLAGS) $(LDEDLFLAGSDBG)" \
LIBRAIRIE="$${librairie}" \
MYLIBRAIRIES="$(MYLIBRAIRIES)" ;\
elif [ "$(MYOPT)" = "PUR" ] ;\
then make privmodpurify \
ALLLDEDLFLAGS="$(MYLDEDLFLAGS) $(LDEDLFLAGSDBG)" \
LIBRAIRIE="$${librairie}" \
MYLIBRAIRIES="$(MYLIBRAIRIES)" ;\
elif [ "$(MYOPT)" = "PROF" ] ;\
then make privmodlink \
ALLLDEDLFLAGS="$(MYLDEDLFLAGS) $(LDEDLFLAGS) $(LDEDLFLAGSPROF)" \
LIBRAIRIE="$${librairie}" \
MYLIBRAIRIES="$(MYLIBRAIRIES)" ;\
elif [ "$(MYOPT)" = "VERS" ] ;\
then make privmodlink \
ALLLDEDLFLAGS="$(MYLDEDLFLAGS) $(LDEDLFLAGSVERS)" \
LIBRAIRIE="$${librairie}" \
MYLIBRAIRIES="VERS" ;\
elif [ "$(MYOPT)" = "" ] ;\
then make privmodlink \
ALLLDEDLFLAGS="$(MYLDEDLFLAGS) $(LDEDLFLAGS)" \
LIBRAIRIE="$${librairie}" \
MYLIBRAIRIES="$(MYLIBRAIRIES)" ;\
fi
all $(NOM_EXE):
@make privtitre
@make privcomp
@make privlink
@make privfin
#
# privconfig fait des cd's pour que la determination par grep
# n'ait pas a souffrir des diverses possibilites ~toto, $HOME, ../..
# du coup, il faut que $(BLD_CS) soit accessible ...
# s'il ne l'est pas c'est qu'on est utilisateur ou qu'on a fait une erreur
# le awk sert a voir si la chaine dirbuild est dans la chaine dirtrav
privconfig:
@dirtrav=`pwd` ;\
if [ -d $(BLD_CS) -a -x $(BLD_CS) ] ;\
then dirbuild=$(BLD_CS) ;\
findirtrav=`echo "$${dirtrav}" | awk -F"$${dirbuild}" '{print $$2}'` ;\
if [ "$${findirtrav}" != "" ] ;\
then echo "*** \"make\" dans un répertoire de génération de la librairie" ;\
make privconflib ;\
else echo "*** \"make\" dans un répertoire utilisateur" ;\
fi ;\
elif [ -d $(BLD_CS) -a ! -x $(BLD_CS) ] ;\
then echo "*** \"make\" dans un répertoire utilisateur" ;\
elif [ ! -d $(BLD_CS) ] ;\
then echo "*** \"make\" dans un répertoire utilisateur" ;\
echo " ($(BO)$(BLD_CS)$(NO) n'existe pas)";\
tput init ;\
fi
#
# privconflib verifie que les options OPT et MOD sont coherentes avec
# le repertoire de travail
#
privconflib:
@dirtrav=`pwd` ;\
if [ "$(MYMODULE)" = "" ] ;\
then module=`basename $${dirtrav}` ;\
if [ "$${dirtrav}" = "$(BLD_CS)/$(NOM_ARCH)/$${module}" ] ;\
then opttrav="" ;\
modtrav=`basename $${dirtrav}` ;\
dirprec=`dirname $${dirtrav}` ;\
else opttrav=`basename $${dirtrav}` ;\
dirprec=`dirname $${dirtrav}` ;\
module=`basename $${dirprec}` ;\
if [ "$${dirprec}" = "$(BLD_CS)/$(NOM_ARCH)/$${module}" ] ;\
then modtrav=`basename $${dirprec}` ;\
dirprec=`dirname $${dirprec}` ;\
else echo ;\
echo "$(SO)ERREUR DE CONFIGURATION$(NO)" ;\
echo ;\
echo "$(BO)Il faut être dans le répertoire ou dans un sous repertoire de :$(NO)" ;\
echo "$(BO)$(BLD_CS)/$(NOM_ARCH)/$${module}$(NO)" ;\
echo ;\
tput init ;\
exit 1 ;\
fi ;\
fi ;\
else module="$(MYMODULE)" ;\
if [ "$${dirtrav}" = "$(BLD_CS)/$(NOM_ARCH)/$${module}" ] ;\
then opttrav="" ;\
modtrav=`basename $${dirtrav}` ;\
dirprec=`dirname $${dirtrav}` ;\
else opttrav=`basename $${dirtrav}` ;\
dirprec=`dirname $${dirtrav}` ;\
if [ "$${dirprec}" = "$(BLD_CS)/$(NOM_ARCH)/$${module}" ] ;\
then modtrav=`basename $${dirprec}` ;\
dirprec=`dirname $${dirprec}` ;\
else echo ;\
echo "$(SO)ERREUR DE CONFIGURATION$(NO)" ;\
echo ;\
echo "$(BO)Il faut être dans le répertoire ou dans un sous repertoire de :$(NO)" ;\
echo "$(BO)$(BLD_CS)/$(NOM_ARCH)/$${module}$(NO)" ;\
echo ;\
tput init ;\
exit 1 ;\
fi ;\
fi ;\
fi ;\
dirprec=`dirname $${dirprec}` ;\
dirlib=`dirname $${dirprec}` ;\
if test ! "$$dirlib" = "$(DIR_CS)" ;\
then echo ;\
echo "$(SO)ERREUR DE CONFIGURATION$(NO)" ;\
echo ;\
echo "$(BO) Il faut être dans le repertoire général $(DIR_CS)$(NO)" ;\
echo ;\
tput init ;\
exit 1 ;\
fi ;\
if [ ! "$${modtrav}" = "$${module}" ] ;\
then echo ;\
echo "$(SO)ERREUR DE CONFIGURATION$(NO)" ;\
echo ;\
echo "$(BO)Il faut être dans le répertoire $${module}$(NO)" ;\
if [ ! "$(MYMODULE)" = "" ] ;\
then echo "$(BO) pour utiliser l'option MOD=$(MYMODULE)$(NO)" ;\
fi ;\
echo ;\
tput init ;\
exit 1 ;\
fi ;\
if [ ! "$${opttrav}" = "$(MYOPT)" ] ;\
then echo ;\
echo "$(SO)ERREUR DE CONFIGURATION$(NO)" ;\
echo ;\
if [ "$(MYOPT)" = "" ] ;\
then echo "$(BO)Dans le répertoire $${opttrav}$(NO)" ;\
echo "$(BO) il faut utiliser l'option de make : OPT=$${opttrav}$(NO)" ;\
else echo "$(BO)Il faut être dans le répertoire $(MYOPT)$(NO)" ;\
echo "$(BO) pour utiliser l'option OPT=$(MYOPT)$(NO)" ;\
fi ;\
echo ;\
tput init ;\
exit 1 ;\
fi ;\
if [ "$${modtrav}" = "BASE" ] ;\
then INC_CS="toto" ;\
fi
privfin:
@echo
clean purge rmobj:
@make privconfig
@\rm -f *.o *.inl core \
.liste_mkfiles.* .liste_mkoptpart.o so_locations
@for file in *.c *.F* *.h *.hf *.i ;\
do \
if test -h $${file} ;\
then \rm -f $${file} ;\
fi ;\
done
rmexe:
@make privconfig
@\rm -f $(NOM_EXE) *.out
rmlib:
@make privconfig
@\rm -f "$(NOM_LIB_CS_PRE)$(MYOPT).a"
new:
@make privconfig
@make clean
@make rmexe
@make privfin
help info aide:
@make privtitre
@echo
@echo "Usage : $(BO)make$(NO) (dans $(BO)build/$(NOM_ARCH)/$(NO)$(SO)<MOD>$(NO)$(BO)/$(NO))"
@echo " ou : $(BO)make$(NO) $(SO)<target>$(NO) (dans $(BO)build/$(NOM_ARCH)/$(NO)$(SO)<MOD>$(NO)$(BO)/$(NO))"
@echo " ou : $(BO)make$(NO) $(BO)MOD=$(NO)$(SO)<MOD>$(NO) (dans $(BO)build/$(NOM_ARCH)/$(NO)$(SO)<MOD>$(NO))"
@echo " ou : $(BO)make$(NO) $(BO)OPT=$(NO)$(SO)<OPT>$(NO) (dans $(BO)build/$(NOM_ARCH)/$(NO)$(SO)<MOD>$(NO)$(BO)/$(NO)$(SO)<OPT>$(NO)$(BO)/$(NO))"
@echo " ou : $(BO)make$(NO) avec une combinaison quelconque des trois"
@echo
@echo " ou : $(BO)make$(NO) $(SO)<target>$(NO) $(BO)OPT=$(NO)$(SO)<OPT>$(NO) (dans un repertoire utilisateur"
@echo " pour l'edition des liens de Code_Saturne)"
@echo " ou : $(BO)make$(NO) $(SO)<target>$(NO) $(BO)LIB=$(NO)$(SO)<LIB>$(NO) (dans un repertoire utilisateur"
@echo " pour l'edition des liens de Code_Saturne)"
@echo
@echo " avec :"
@echo " $(SO)<target>$(NO) : $(BO)saturne$(NO) : compilation et édition de liens de Code_Saturne"
@echo " $(BO)all$(NO) : idem"
@echo " $(BO)lib$(NO) : création de la librairie"
@echo " $(BO)lib_install$(NO) : création et installation de la librairie"
@echo " $(BO)comp$(NO) : compilation seule"
@echo " $(BO)link$(NO) : édition de liens de Code_Saturne"
@echo " $(BO)saturne$(NO) : idem"
@echo " $(BO)clean$(NO) : destruction des fichiers objets"
@echo " $(BO)purge$(NO) : idem"
@echo " $(BO)rmlib$(NO) : destruction de la librairie"
@echo " $(BO)rmobj$(NO) : idem"
@echo " $(BO)rmexe$(NO) : destruction de l'executable"
@echo " $(BO)new$(NO) : clean + rmlib + rmexe"
@echo " $(BO)help$(NO) : ce message"
@echo " $(BO)info$(NO) : idem"
@echo " $(BO)aide$(NO) : idem"
@echo
@echo " $(SO)<MOD>$(NO) : $(BO)BASE$(NO) : option pour noyau de base"
@echo " $(BO)CFBL$(NO) : option pour compessible"
@echo " $(BO)COGZ$(NO) : option pour combustion gaz"
@echo " $(BO)CPLV$(NO) : option pour charbon pulverise"
@echo " $(BO)ELEC$(NO) : option pour electrique"
@echo " $(BO)LAGR$(NO) : option pour Lagrangien"
@echo " $(BO)RAYT$(NO) : option pour rayonnement"
@echo " $(BO)MATI$(NO) : option pour Matisse"
@echo
@echo " $(SO)<OPT>$(NO) : $(BO)LO$(NO) : option pour optimisation reduite"
@echo " $(BO)DBG$(NO) : option pour debug"
@echo " $(BO)EF$(NO) : option pour debug avec ElectricFence"
@echo " $(BO)VERS$(NO) : option pour version des compilateurs"
@echo " $(BO)PROF$(NO) : option pour profiling"
@echo " $(BO)PUR$(NO) : option pour link avec Purify"
@echo
@echo " $(SO)<LIB>$(NO) : $(BO)libsaturneBASE.a libsaturneLAGRDBG.a libperso.a etc.$(NO)"
@echo " : liste complete des librairies de sources"
@echo " Pour un executable coherent, il faut utiliser la bibliotheque"
@echo " de base (BASE) et une bibliotheque pour chaque module existant."
@echo
@echo " et les options utilisateur supplementaires :"
@echo " $(SO)<OPTC>$(NO) : options pour le compilateur C"
@echo " $(SO)<OPTF>$(NO) : options pour le compilateur Fortran"
@echo " $(SO)<OPTLD>$(NO) : options pour l'edition de liens"
@echo " $(SO)<OPTLIBS>$(NO) : options pour l'ajout de librairies supplementaires"
@echo
syntax highlighted by Code2HTML, v. 0.9.1