Skip to content

Commit 5aef677

Browse files
authored
Merge pull request #48 from JeffersonLab/split-work
Split work
2 parents 2da44af + e8bc2d9 commit 5aef677

File tree

43 files changed

+8962
-123
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+8962
-123
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
.~lock.*
1+
.~lock.*
2+
*~

split_sim-recon/Makefile

Lines changed: 64 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,83 @@
11
EXAMPLE_SPLIT_DIR = $(HD_UTILITIES_HOME)/split_sim-recon/example
2-
SIM_REPO_DIR = gluex_sim
32
PWD=`pwd`
3+
SIM_REPO_DIR = $(PWD)/halld_sim
4+
RECON_REPO_DIR = $(PWD)/halld_recon
5+
SETUP_GLUEX = source $(BUILD_SCRIPTS)/gluex_env_jlab.sh ; unset HALLD_HOME
6+
DIRECTORIES_TO_BE_MOVED = src/programs/Simulation \
7+
src/programs/AmplitudeAnalysis src/plugins/Simulation \
8+
src/libraries/AMPTOOLS_AMPS src/libraries/AMPTOOLS_DATAIO \
9+
src/libraries/AMPTOOLS_MCGEN
410

5-
all: .scons_done
11+
all: .sim_scons_done
12+
13+
no_build: .recon_push_done .sim_push_done
614

715
.sim-recon_clone_done:
8-
git clone ssh://git@github.com/jeffersonlab/sim-recon
16+
git clone --bare ssh://git@github.com/jeffersonlab/sim-recon
917
date >$@
1018

19+
.recon_bare_push_done: .sim-recon_clone_done
20+
cd sim-recon.git ; \
21+
git push --mirror git@github.com:jeffersonlab/halld_recon.git
22+
date > $@
23+
24+
.recon_clone_done: .recon_bare_push_done
25+
rm -rf $(RECON_REPO_DIR)
26+
git clone ssh://git@github.com/jeffersonlab/halld_recon
27+
date > $@
28+
29+
.recon_modify_done: .recon_clone_done
30+
cp -r $(EXAMPLE_SPLIT_DIR)/halld_recon/src halld_recon
31+
cd $(RECON_REPO_DIR) ; git rm -rq $(DIRECTORIES_TO_BE_MOVED)
32+
date > $@
33+
34+
.recon_commit_done: .recon_modify_done
35+
cd $(RECON_REPO_DIR) ; git add .
36+
cd $(RECON_REPO_DIR) ; \
37+
git commit -q -m "halld_sim modified from sim-recon original"
38+
date > $@
39+
40+
.recon_push_done: .recon_commit_done
41+
cd $(RECON_REPO_DIR) ; git push
42+
date > $@
43+
44+
.recon_scons_done: .recon_push_done
45+
$(SETUP_GLUEX) ; \
46+
echo $(HALLD_HOME) ; \
47+
cd $(RECON_REPO_DIR)/src ; \
48+
scons install -j3
49+
date > $@
50+
1151
.sim_clone_done: .sim-recon_clone_done
1252
git clone file://$(PWD)/sim-recon $(SIM_REPO_DIR)
1353
date > $@
1454

15-
version_split.xml:
16-
$(BUILD_SCRIPTS)/customize_version.pl -i /group/halld/www/halldweb/html/dist/version_jlab.xml -o version_split.xml -s $(PWD)/sim-recon -4 $(PWD)/hdgeant4 -a $(PWD)/gluex_root_analysis
55+
.sim_filter_done: .sim_clone_done
56+
pushd $(SIM_REPO_DIR) ; git filter-branch --index-filter 'git rm --cached -qr --ignore-unmatch -- . && git reset -q $(GIT_COMMIT) -- $(DIRECTORIES_TO_BE_MOVED)' --prune-empty -- --all
57+
date > $@
1758

18-
.scons_sim-recon_done: version_split.xml .sim-recon_clone_done
19-
. $(BUILD_SCRIPTS)/gluex_env_jlab.sh version_split.xml ; \
20-
cd sim-recon/src ; \
21-
scons install $(SIM_RECON_SCONS_OPTIONS)
59+
.sim_copy_done: .sim_filter_done
60+
cp -rv $(EXAMPLE_SPLIT_DIR)/halld_sim/src $(SIM_REPO_DIR)
61+
date > $@
2262

23-
.filter_done: .sim_clone_done
24-
pushd $(SIM_REPO_DIR) ; git filter-branch --index-filter 'git rm --cached -qr --ignore-unmatch -- . && git reset -q $(GIT_COMMIT) -- src/programs/Simulation src/plugins/Simulation src/libraries/AMPTOOLS_AMPS src/libraries/AMPTOOLS_DATAIO src/libraries/AMPTOOLS_MCGEN' --prune-empty -- --all
63+
.sim_commit_done: .sim_copy_done
64+
cd $(SIM_REPO_DIR) ; git add .
65+
cd $(SIM_REPO_DIR) ; \
66+
git commit -m "commit files added from examples directory"
2567
date > $@
2668

27-
.copy_done: .filter_done
28-
cp -v $(EXAMPLE_SPLIT_DIR)/src/SConstruct $(SIM_REPO_DIR)/src
29-
cp -rv $(EXAMPLE_SPLIT_DIR)/src/SBMS $(SIM_REPO_DIR)/src
30-
cp $(EXAMPLE_SPLIT_DIR)/src/libraries/SConscript $(SIM_REPO_DIR)/src/libraries
31-
cp $(EXAMPLE_SPLIT_DIR)/src/programs/SConscript $(SIM_REPO_DIR)/src/programs
32-
cp $(EXAMPLE_SPLIT_DIR)/src/plugins/SConscript $(SIM_REPO_DIR)/src/plugins
69+
.sim_push_done: .sim_commit_done
70+
cd $(SIM_REPO_DIR) ; \
71+
git push --mirror git@github.com:jeffersonlab/halld_sim.git
3372
date > $@
3473

35-
.scons_done: .scons_sim-recon_done .copy_done
36-
. $(BUILD_SCRIPTS)/gluex_env_jlab.sh version_split.xml ; \
37-
cd $(SIM_REPO_DIR)/src ; \
38-
scons install
74+
.sim_scons_done: .sim_push_done .recon_scons_done
75+
$(SETUP_GLUEX) ; \
76+
export HALLD_RECON_HOME=$(RECON_REPO_DIR) ; \
77+
export HALLD_SIM_HOME=$(SIM_REPO_DIR) ; \
78+
cd $(SIM_REPO_DIR)/src ; \
79+
scons install -j3
80+
date > $@
3981

4082
clean:
41-
rm -rfv gluex_sim .*_done
83+
rm -rf halld_sim halld_recon sim-recon.git .*_done

split_sim-recon/example/convert.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
target=$1
3+
replacement=$2
4+
file=$3
5+
echo target = $target
6+
echo replacement = $replacement
7+
echo file = $file
8+
mv -v $file ${file}.tmp
9+
sed s/$target/$replacement/g ${file}.tmp > $file
10+
rm -v ${file}.tmp

split_sim-recon/example/fnr.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
target=$1
3+
replacement=$2
4+
rm -f commands.tmp
5+
find . -type f -exec grep -l $target {} \; \
6+
| awk '{print "convert.sh $target $replacement "$1}' \
7+
> commands.tmp
8+
. commands.tmp
9+
rm commands.tmp
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
2+
#
3+
# Jan. 31, 2014 David Lawrence
4+
#
5+
# This SConstruct file can be copied into a directory containing
6+
# the source for a plugin and used to compile it. It will use and
7+
# install into the directory specified by the HALLD_MY environment
8+
# variable if defined. Otherwise, it will install in the HALLD_RECON_HOME
9+
# directory.
10+
#
11+
# This file should not need modification. It will be copied in by
12+
# the mkplugin or mkfactory_plugin scripts or you can just copy it
13+
# by hand.
14+
#
15+
# To use this, just type "scons install" to build and install.
16+
# Just type "scons" if you want to build, but not install it.
17+
#
18+
# > scons install
19+
#
20+
# Note that unlike the rest of the SBMS system, this does not
21+
# use a separate build directory and builds everything in the
22+
# source directory. This is due to technical details and will hopefully
23+
# be fixed in the future. For now it means, that you must be
24+
# diligent of building for multiple platforms using the same source.
25+
#
26+
27+
import os
28+
import sys
29+
import subprocess
30+
import glob
31+
32+
# Get HALLD_RECON_HOME environment variable, verifying it is set
33+
halld_home = os.getenv('HALLD_RECON_HOME')
34+
if(halld_home == None):
35+
print 'HALLD_RECON_HOME environment variable not set!'
36+
exit(-1)
37+
38+
# Get HALLD_MY if it exists. Otherwise use HALLD_RECON_HOME
39+
halld_my = os.getenv('HALLD_MY', halld_home)
40+
41+
# Add SBMS directory to PYTHONPATH
42+
sbmsdir = "%s/src/SBMS" % halld_home
43+
sys.path.append(sbmsdir)
44+
45+
import sbms
46+
47+
# Get command-line options
48+
SHOWBUILD = ARGUMENTS.get('SHOWBUILD', 0)
49+
50+
# Get platform-specific name
51+
osname = os.getenv('BMS_OSNAME', 'build')
52+
53+
# Get architecture name
54+
arch = subprocess.Popen(["uname"], stdout=subprocess.PIPE).communicate()[0].strip()
55+
56+
# Setup initial environment
57+
installdir = "%s/%s" %(halld_my, osname)
58+
include = "%s/include" % (installdir)
59+
bin = "%s/bin" % (installdir)
60+
lib = "%s/lib" % (installdir)
61+
plugins = "%s/plugins" % (installdir)
62+
env = Environment( ENV = os.environ, # Bring in full environment, including PATH
63+
CPPPATH = [include],
64+
LIBPATH = ["%s/%s/lib" %(halld_home, osname)], # n.b. add HALLD_RECON_HOME here and prepend HALLD_MY below
65+
variant_dir = ".%s" % (osname))
66+
67+
# Only add HALLD_MY library search path if it already exists
68+
# since we'll get a warning otherwise
69+
if (os.path.exists(lib)): env.PrependUnique(lib)
70+
71+
# These are SBMS-specific variables (i.e. not default scons ones)
72+
env.Replace(INSTALLDIR = installdir,
73+
OSNAME = osname,
74+
INCDIR = include,
75+
BINDIR = bin,
76+
LIBDIR = lib,
77+
PLUGINSDIR = plugins,
78+
ALL_SOURCES = [], # used so we can add generated sources
79+
SHOWBUILD = SHOWBUILD,
80+
COMMAND_LINE_TARGETS = COMMAND_LINE_TARGETS)
81+
82+
# Use terse output unless otherwise specified
83+
if SHOWBUILD==0:
84+
env.Replace( CCCOMSTR = "Compiling [$SOURCE]",
85+
CXXCOMSTR = "Compiling [$SOURCE]",
86+
FORTRANPPCOMSTR = "Compiling [$SOURCE]",
87+
FORTRANCOMSTR = "Compiling [$SOURCE]",
88+
SHCCCOMSTR = "Compiling [$SOURCE]",
89+
SHCXXCOMSTR = "Compiling [$SOURCE]",
90+
LINKCOMSTR = "Linking [$TARGET]",
91+
SHLINKCOMSTR = "Linking [$TARGET]",
92+
INSTALLSTR = "Installing [$TARGET]",
93+
ARCOMSTR = "Archiving [$TARGET]",
94+
RANLIBCOMSTR = "Ranlib [$TARGET]")
95+
96+
97+
# Get compiler from environment variables (if set)
98+
env.Replace( CXX = os.getenv('CXX', 'g++'),
99+
CC = os.getenv('CC' , 'gcc'),
100+
FC = os.getenv('FC' , 'gfortran') )
101+
102+
# Add local directory, directories from HALLD_MY and HALLD_RECON_HOME to include search path
103+
#env.PrependUnique(CPPPATH = ['#'])
104+
env.PrependUnique(CPPPATH = ['%s/src' % halld_my, '%s/src/libraries' % halld_my, '%s/src/libraries/include' % halld_my])
105+
env.PrependUnique(CPPPATH = ['%s/src' % halld_home, '%s/src/libraries' % halld_home, '%s/src/libraries/include' % halld_home])
106+
107+
env.PrependUnique(CPPPATH = ['%s/%s/include' % (halld_my,osname)])
108+
env.PrependUnique(CPPPATH = ['%s/%s/include' % (halld_home,osname)])
109+
110+
# Turn on debug symbols and warnings
111+
env.PrependUnique( CFLAGS = ['-g', '-fPIC', '-Wall'])
112+
env.PrependUnique( CXXFLAGS = ['-g', '-fPIC', '-Wall'])
113+
env.PrependUnique(FORTRANFLAGS = ['-g', '-fPIC', '-Wall'])
114+
115+
env.PrependUnique( CXXFLAGS = ['-std=c++11'])
116+
117+
# Apply any platform/architecture specific settings
118+
sbms.ApplyPlatformSpecificSettings(env, arch)
119+
sbms.ApplyPlatformSpecificSettings(env, osname)
120+
121+
# Make plugin from source in this directory
122+
sbms.AddDANA(env)
123+
sbms.AddROOT(env)
124+
sbms.plugin(env)
125+
126+
# Make install target
127+
env.Alias('install', installdir)
128+
129+

0 commit comments

Comments
 (0)