Skip to content
Snippets Groups Projects
Commit 2faa99e9 authored by nicolas's avatar nicolas
Browse files

* Modify compilation scheme of NPLib

   Now, one should first execute the configure
   script and then run make

 * There is the possibility to pass as arguments
   of the configure script detector names, e.g:
   ./configure must2 cats
   
 * Moreover, there is the possibility to compile
   specific detectors, e.g: make must2
parent 00a775c9
No related branches found
No related tags found
No related merge requests found
# include Makefile options for different platforms
include $(NPTOOL)/NPLib/Makefile.arch include $(NPTOOL)/NPLib/Makefile.arch
#include /usr/local/root-5.32.01/etc/Makefile.arch #include /usr/local/root-5.32.01/etc/Makefile.arch
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
SHARELIB = SharedLib SHARELIB = SharedLib
...@@ -6,7 +8,7 @@ FILLINC = FillIncludeDir ...@@ -6,7 +8,7 @@ FILLINC = FillIncludeDir
FILLLIB = FillLibraryDir FILLLIB = FillLibraryDir
LIBLIST = liblistfile LIBLIST = liblistfile
all: $(FILLINC) $(SHARELIB) $(FILLLIB) $(LIBLIST) all: $(SHARELIB) $(FILLLIB) $(LIBLIST)
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
############### fillinclib ############## ############### fillinclib ##############
FillIncludeDir: FillIncludeDir:
...@@ -29,14 +31,25 @@ SharedLib: ...@@ -29,14 +31,25 @@ SharedLib:
############# Clean and More ########## ############# Clean and More ##########
clean: clean:
$(NPTOOL)/NPLib/scripts/makefile.sh clean $(NPTOOL)/NPLib/scripts/makefile.sh clean detector
cleancore:
$(NPTOOL)/NPLib/scripts/makefile.sh clean core
distclean: distclean:
@echo " + Deleting libraries in lib directory....."
rm -f ./lib/* rm -f ./lib/*
@echo " + Deleting header files in include directory....."
rm -f ./include/* rm -f ./include/*
@echo " + Deleting liblist file....."
rm -f liblist rm -f liblist
rm -f ./scripts/NPToolLogon_C* rm -f ./scripts/NPToolLogon_C*
./scripts/makefile.sh distclean ./scripts/makefile.sh distclean detector
./scripts/makefile.sh distclean core
# include makefile created by the configure script
# where the wanted detector are defined
include $(NPTOOL)/NPLib/Makefile.detector
.SUFFIXES: .$(SrcSuf) .SUFFIXES: .$(SrcSuf)
......
# *****************************************************************************
# * Copyright (C) 2009 this file is part of the NPTool Project *
# * *
# * For the licensing terms see $NPTOOL/Licence/NPTool_Licence *
# * For the list of contributors see $NPTOOL/Licence/Contributors *
# *****************************************************************************/
# *****************************************************************************
# * Original Author: N. de Sereville contact address: deserevi@ipno.in2p3.fr *
# * *
# * Creation Date : January 2013 *
# * Last update : *
# *---------------------------------------------------------------------------*
# * Decription: This script is in charge of preparing the installation of the *
# * NPLib. It does several things: *
# * + copy all header files to the include directory *
# * + compile the core libraries (all libraries which are not *
# * related to a specific detector) *
# * + generate the Makefile.detector makefile which is included *
# * in the main Makefile. The Makefile.detector has one entry *
# * per declared detector. *
# * *
# * This scripts accepts as arguments detector names. The name *
# * should be a lower case version of the directory name associated *
# * to the detector. *
# * If no argument is given, then all detectors are considered. *
# * *
# *---------------------------------------------------------------------------*
# * Comment: *
# * *
# * *
# *****************************************************************************
#! /bin/bash
# arguments list
args="$@"
############################################################
# First of all, define .core_libs and .detector_libs files #
############################################################
corelibs="initialconditions interactioncoordinates ioroot physics tools vdetector"
# core libraries list
core_file=".core_libs"
# if file exists delete it
if [ -e $core_file ] ; then
rm $core_file
fi ;
# detector libraries list
detector_file=".detector_libs"
# if file exists delete it
if [ -e $detector_file ] ; then
rm $detector_file
fi ;
# fill files
core_string=""
detector_string=""
for file in */Makefile
do
# remove "Makefile" string from file name
name=${file%\/*}
# file name in lower case
lname=$(echo "$name" | tr '[A-Z]' '[a-z]')
# only build core libraries
if echo "$corelibs" | grep -q "$lname" ; then
core_string="$core_string""$lname "
else
if [ $# = 0 ] ; then
detector_string="$detector_string""$lname "
else
# only add Makefile.detector target if it is in the
# arguments list
if echo "$args" | grep -q "$lname" ; then
detector_string="$detector_string""$lname "
fi ;
fi ;
fi ;
done
echo "$core_string" >> $core_file
echo "$detector_string" >> $detector_file
###########################################################################
# Create detector entry in Makefile file for detectors given in arguments #
###########################################################################
# output file
outfile="Makefile.detector"
echo " + Creating $outfile file....."
# if output file exists delete it
if [ -e $outfile ] ; then
rm $outfile
fi ;
# create output file
echo "# WARNING:" >> $outfile
echo "# This file is automatically generated by the configure script." >> $outfile
echo "# If you modify this file by hand, changes won't persist the next time you run ./configure." >> $outfile
echo "#" >> $outfile
# loop recursively on sub-directories containing a Makefile file
for file in */Makefile
do
# remove "Makefile" string from file name
name=${file%\/*}
# file name in lower case
lname=$(echo "$name" | tr '[A-Z]' '[a-z]')
# if no arguments are given, add all detectors in Makefile.detector
# by default
if [ $# = 0 ] ; then
# build target
echo "$lname": >> $outfile
# build commands
./scripts/makefile_detector.sh $name $outfile
else
# only add Makefile.detector target if it is in the
# arguments list
if echo "$args" | grep -q "$lname" ; then
# build target
echo "$lname": >> $outfile
# build commands
./scripts/makefile_detector.sh $name $outfile
fi ;
fi ;
done
########################
# Build core libraries #
########################
# (I) fill include directory with associated headers
#echo " + Copying header files to the include directory....."
./scripts/fillincdir.sh
# (II) compile core libraries
echo " + Building core libraries....."
# loop recursively on sub-directories containing a Makefile file
for file in */Makefile
do
# remove "Makefile" string from file name
name=${file%\/*}
# file name in lower case
lname=$(echo "$name" | tr '[A-Z]' '[a-z]')
# only build core libraries
if echo "$corelibs" | grep -q "$lname" ; then
# print informations
echo "\tEntering $name directory..."
# add "-C ./" pattern at the beginning of the name
cmd="-C ./$name"
# execute make command with target specified on command line
make --silent $cmd
fi ;
done
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#! /bin/bash #! /bin/bash
echo " + Creating liblist file....."
# output file # output file
outfile="liblist" outfile="liblist"
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#! /bin/bash #! /bin/bash
echo " + Copying header files to the include directory....."
# previously, clean include directory # previously, clean include directory
cd include/ cd include/
rm -f * rm -f *
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#! /bin/bash #! /bin/bash
echo " + Copying libraries to the lib directory....."
# previously, clean lib/ directory # previously, clean lib/ directory
cd lib/ cd lib/
rm -f * rm -f *
......
...@@ -26,15 +26,33 @@ ...@@ -26,15 +26,33 @@
#! /bin/bash #! /bin/bash
if [ $# = 0 ] ; then
echo " + Building detector libraries....."
else
echo " + Cleaning $2 libraries....."
fi ;
# read .detector_libs or .core_libs file created by the configure script
file=".""$2_libs"
if [ $# = 0 ] ; then
file=".detector_libs"
fi ;
read -r detectorlibs < "$file"
# loop recursively on Makefile files in sub-directories # loop recursively on Makefile files in sub-directories
for file in */Makefile for file in */Makefile
do do
# remove "Makefile" string from file name # remove "Makefile" string from file name
name=${file%\/*} name=${file%\/*}
# print informations # file name in lower case
echo "Entering $name directory..." lname=$(echo "$name" | tr '[A-Z]' '[a-z]')
# add "-C ./" pattern at the beginning of the name # only build defined detector libraries
cmd="-C ./$name" if echo "$detectorlibs" | grep -q "$lname" ; then
# execute make command with target specified on command line # print informations
make --silent $1 $cmd echo "\tEntering $name directory..."
# add "-C ./" pattern at the beginning of the name
cmd="-C ./$name"
# execute make command with target specified on command line
make --silent $1 $cmd
fi ;
done done
# *****************************************************************************
# * Copyright (C) 2009 this file is part of the NPTool Project *
# * *
# * For the licensing terms see $NPTOOL/Licence/NPTool_Licence *
# * For the list of contributors see $NPTOOL/Licence/Contributors *
# *****************************************************************************/
# *****************************************************************************
# * Original Author: N. de Sereville contact address: deserevi@ipno.in2p3.fr *
# * *
# * Creation Date : January 2013 *
# * Last update : *
# *---------------------------------------------------------------------------*
# * Decription: This script writes the commands that should be called when *
# * compiling individual detectors *
# * and call it with the argument passed to the script. *
# * Two arguments should be given: *
# * + first one is the directory name *
# * + second one is the file name where the messages are redirected *
# * *
# *---------------------------------------------------------------------------*
# * Comment: *
# * This script is called by the configure script in $NPTOOL/NPLib *
# * *
# *****************************************************************************
#! /bin/bash
# build message
echo "\t@echo \"Entering $1 directory...\"" >> $2
# execute make command with target specified on command line
echo "\tmake --silent -C ./$1" >> $2
# copy header files
echo "\tcd $1; cp -f *.h ../include" >> $2
# remove *Dict header files
echo "\tcd include; rm *Dict.h" >> $2
# copy library files
echo "\tcd $1; cp -f *.so ../lib" >> $2
# deal with mac osx dylib files
#echo "ifeq (\$(findstring macosx, \$(ARCH)), macosx)" >> $2
#echo "\t@echo \"to be done\""
#echo "endif" >> $2
# newline
echo "" >> $2
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment