--- PadmeAmidala/Makefile 2007/05/04 10:05:37 1.6 +++ PadmeAmidala/Makefile 2014/10/20 12:12:58 1.25 @@ -1,6 +1,6 @@ # PadmeAmidala # SOFTWARE VERSION -VER= v1r03 +VER= v10r06 # An almost general purpouse Makefile for PAMELA repository # Let's start with some usefull definition for colorize the echo RED='\E[1;31;40m' @@ -25,20 +25,33 @@ MAKE=make # C CC=gcc -#CFLAGS=-Wall -O -fPIC -pthread -g -CFLAGS=-Wall -O -fPIC -pthread +#CFLAGS=-Wall -O -fPIC -pthread -g ${PAM_BIT} +CFLAGS=-Wall -O4 -fPIC -pthread ${PAM_BIT} # Enviroment: GCCVER=`gcc --version | head -1` UNAMEA=`uname -a` TODAY=`date` # F77 +ifeq ($(GCC4),) +export GCCVERS=$(shell echo `gcc -dumpversion | sed 's/\./\ /g'`) +export GCCVERMAJ=$(word 1,$(GCCVERS)) +export GCC4=$(shell echo `echo "${GCCVERMAJ} > 3" |bc -l`) +endif +ifeq ($(GCC4),1) +F77=gfortran +LG2C=-lgfortran +EXTRAOPT= +else F77=g77 -#F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -g -extend_source -static -fno-backslash -F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash +LG2C=-lg2c +EXTRAOPT=-Wno-globals -fvxt +endif +#F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -g -extend_source -static -fno-backslash ${PAM_BIT} +F77FLAGS= -Wall -funroll-loops -fPIC $(EXTRAOPT) -fno-automatic -fbounds-check -extend_source -static -fno-backslash ${PAM_BIT} # C++ CXX=g++ -#CXXFLAGS=-Wall -O -fPIC -pthread -g -CXXFLAGS=-Wall -O -fPIC -pthread +#CXXFLAGS=-Wall -O -fPIC -pthread -g ${PAM_BIT} +CXXFLAGS=-Wall -O4 -fPIC -pthread ${PAM_BIT} # ROOTCINT ROOTCINT=rootcint # Here the variables definig the local directories @@ -145,12 +158,12 @@ @(${EGREEN} "Compiling CPP file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET}) @cd ${DIRSRC} &>/dev/null && ${CXX} ${CXXFLAGS} -c `basename $(@F) _${VER}.so | sed s/lib//`.cpp -I${DIRTOP}/${DIRINC} -I${PAM_INC} -I${DIRTOP} -I${PAM_YODA}/include/yoda/ -I${NROOTINC}; @(${EGREEN} "Compiling CPP file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET}) - @cd ${DIRSRC} &>/dev/null && ${CXX} ${CXXFLAGS} -c `basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp -I${DIRTOP}/${DIRINC} -I${PAM_INC} -I${DIRTOP} -I${PAM_YODA}/include/yoda/ -I${NROOTINC}; + @cd ${DIRSRC} &>/dev/null && ${CXX} ${CXXFLAGS} -c `basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_INC} -I${PAM_YODA}/include/yoda/ -I${NROOTINC}; # # create .so # @(${EGREEN} "Creating shared library: "${WHITE} "`basename $@`"; ${RESET}) - @${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ -lg2c -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_INC} -I${PAM_YODA}/include/yoda/ ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`.o ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.o 1>/dev/null + @${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ $(LG2C) -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_INC} -I${PAM_YODA}/include/yoda/ ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`.o ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.o 1>/dev/null @ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) ${LIBCPPLIBS}: ${LIBSRCS} ${COBJS} ${FOBJS} @@ -168,7 +181,7 @@ ${CXXEXELIBS}: ${CPPOBJS} ${COBJS} ${CXXEXEOBJS} @(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET}) - @${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRTOP}/${DIRLIB}/$@.o ${DIRTOP}/${DIRLIB}/libRunGlue.so ${PAM_LIB}/libPamLevel2.so ${PAM_LIB}/libDarthVader.so ${CPPOBJS} ${PAM_YODA}/lib/libyoda.so -lThread `root-config --cflags --glibs` + @${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRTOP}/${DIRLIB}/$@.o ${DIRTOP}/${DIRLIB}/libRunGlue.so ${PAM_LIB}/libPamLevel2.so ${PAM_LIB}/libDarthVader.so ${CPPOBJS} ${PAM_YODA}/lib/libyoda.so -lThread `root-config --cflags --glibs` # A small target to check environmental variables %_env: @@ -241,7 +254,7 @@ @${test_and_cp} mkverpath: - @echo '#include ' > ${DIRTOP}/${DIRSRC}/PadmeAmidalaVerl2.cpp; echo ' char *AmidalaInfo(bool print){ if ( print ) printf("\nPAMELA PadmeAmidala version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); return("${VER}"); }' >> ${DIRTOP}/${DIRSRC}/PadmeAmidalaVerl2.cpp + @echo '#include ' > ${DIRTOP}/${DIRSRC}/PadmeAmidalaVerl2.cpp; echo ' const char *AmidalaInfo(bool print){ if ( print ) printf("\nPAMELA PadmeAmidala version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); return("${VER}"); }' >> ${DIRTOP}/${DIRSRC}/PadmeAmidalaVerl2.cpp @sleep 0.8