slicPandora
diff -u -r1.11 -r1.12
--- Makefile 9 Mar 2010 20:22:12 -0000 1.11
+++ Makefile 11 Mar 2010 22:19:13 -0000 1.12
@@ -1,21 +1,33 @@
-# $Id: Makefile,v 1.11 2010/03/09 20:22:12 jeremy Exp $
+# $Id: Makefile,v 1.12 2010/03/11 22:19:13 jeremy Exp $
+#
+# Makefile for the slicPandora project. It requires that
+# the variables PANDORAPFA and LCIO are set in the user's
+# environment. These should point to the PandoraPFANew root
+# svn checkout and the LCIO cvs checkout, respectively. The
+# user will also need to setup the LD_LIBRARY_PATH in the
+# environment. (See ./example_setup_script.sh for how to
+# do this.)
+#
+
+# Print an error message and exit if PANDORAPFA is not defined.
ifndef PANDORAPFA
$(error Set PANDORAPFA env var to location of Pandora PFA New.)
endif
+# Print an error message and exit if LCIO is not defined.
ifndef LCIO
$(error Set LCIO env var to location of standalone LCIO project.)
endif
-# tools
+# build tools
CXX=g++
AR=ar
# binary name
BINNAME=slicPandora
-# sources
+# C++ source files
SRCDIR=$(PWD)/src
SRCS=$(wildcard $(SRCDIR)/*.cpp)
TESTSRCS=$(wildcard $(PWD)/tests/*.cpp)
@@ -23,22 +35,21 @@
# objects
OBJS=$(addsuffix .o, $(basename $(SRCS)))
-# includes
+# include files
INCDIR=$(PWD)/include
INCLUDES=-I$(INCDIR) -I$(PANDORAPFA)/include -I$(LCIO)/src/cpp/include/
-# libs
+# program libraries necessary for the build
LIBS=-L$(PANDORAPFA)/lib -lPandoraPFANew -L$(LCIO)/lib -llcio -lsio
+
+# program libraries necessary for runtime (includes build libs)
RUNLIBS=$(LIBS) -L$(PWD)/lib -l$(BINNAME)
# tests
TESTBINS=$(subst tests,bin,$(basename $(TESTSRCS)))
-TESTOBJ=$(addsuffix .o, $(basename $(TESTSRCS)))
-TESTSCRIPT=$(PWD)/scripts/run_test.sh
-TESTRUN=$(addsuffix _run,$(TESTBINS))
TESTS=$(basename $(notdir $(TESTSRCS)))
-# flags
+# compiler flags
CXXFLAGS=-Wall -g $(INCLUDES)
# Create library and tests.
@@ -47,60 +58,42 @@
# Default target.
.DEFAULT: all
-# Create the lib directory.
+# Make the lib directory.
libdir:
@mkdir -p $(PWD)/lib;
-# Create the bin directory.
+# Make the bin directory.
bindir:
@mkdir -p $(PWD)/bin;
-# Create .o files from .cpp files.
+# Make .o files from .cpp files.
%.o: %.cpp
- @echo "Compiling $< ..."; $(CXX) -c $(CXXFLAGS) -o $@ $<
+ @echo "Compiling $< ...";
+ $(CXX) -c $(CXXFLAGS) -o $@ $<
-# Create all the .o files.
+# Make all the .o files.
obj:
@$(MAKE) -s $(OBJS)
-# Create a static library.
+# Make a static library.
lib: libdir obj
@$(AR) rcs $(PWD)/lib/lib$(BINNAME).a $(OBJS)
-# Create a shared library.
+# Make a shared library.
shlib: libdir obj
@$(CXX) -shared -W1,-soname,lib$(BINNAME).so -o $(PWD)/lib/lib$(BINNAME).so $(OBJS) $(LIBS)
-# Both lib targets in one.
+# Run both lib targets.
libs: lib shlib
# Compile all the tests.
tests: bindir $(TESTS)
-# Single test program targets.
+# Compile a test.
$(TESTS):
@echo "Compiling $@ ..."; \
$(CXX) $(CXXFLAGS) $(RUNLIBS) -o ./bin/$@ $(PWD)[log in to unmask]
-# Clean up the object files and directories.
+# Clean up the object files and build directories.
clean:
- @rm -rf $(OBJS) $(PWD)/lib $(PWD)/bin
-
-# Run a single test. These are named like ${BINNAME}_run to avoid conflicts with other targets.
-#$(TESTRUN) :
-# @res=$(shell $(TESTSCRIPT) $(subst _run,,$@));
-
-# Run all the tests.
-#runtests: tests
-# @rm -f $(PWD)/test.log; \
-# for testrun in $(TESTRUN); do \
-# echo "Running test case: $$testrun"; \
-# $(MAKE) -s $$testrun; \
-# done;
-
-# No standalone binary is created for SlicPandora, just the library.
-# The test cases create binaries. Leave target here for reference.
-# --JM
-# Create a standalone binary.
-#bin: bindir
-# @$(CXX) $(SRCS) $(CXXFLAGS) $(LIBS) -o $(PWD)/bin/$(BINNAME)
+ @rm -rf $(OBJS) $(PWD)/lib $(PWD)/bin
\ No newline at end of file