Index: /trunk/Makefile
===================================================================
--- /trunk/Makefile	(revision 1175)
+++ /trunk/Makefile	(revision 1176)
@@ -19,4 +19,23 @@
 DELPHES_LIBS = $(shell $(RC) --libs) -lEG $(SYSLIBS)
 DISPLAY_LIBS = $(shell $(RC) --evelibs) $(SYSLIBS)
+
+ifneq ($(CMSSW_FWLITE_INCLUDE_PATH),)
+HAS_CMSSW = true
+CXXFLAGS += $(subst :, -I,$(CMSSW_FWLITE_INCLUDE_PATH))
+DELPHES_LIBS += $(subst include,lib,$(subst :, -L,$(CMSSW_FWLITE_INCLUDE_PATH))
+ifneq ($(CMSSW_RELEASE_BASE),)
+CXXFLAGS += -I$(CMSSW_RELEASE_BASE)/src
+endif
+ifneq ($(LD_LIBRARY_PATH),)
+DELPHES_LIBS += $(subst include,lib,$(subst :, -L,$(LD_LIBRARY_PATH))
+endif
+DELPHES_LIBS += -lFWCoreFWLite -lDataFormatsFWLite -lDataFormatsPatCandidates -lDataFormatsLuminosity -lCommonToolsUtils
+endif
+
+ifneq ($(PROMC),)
+HAS_PROMC = true
+CXXFLAGS += -I$(PROMC)/include
+DELPHES_LIBS += -L$(PROMC)/lib -lprotoc -lprotobuf -lprotobuf-lite -lcbook -lz
+endif
 
 ifneq ($(PYTHIA8),)
@@ -47,40 +66,4 @@
 
 
-DelphesLHEF$(ExeSuf): \
-	tmp/readers/DelphesLHEF.$(ObjSuf)
-
-tmp/readers/DelphesLHEF.$(ObjSuf): \
-	readers/DelphesLHEF.cpp \
-	modules/Delphes.h \
-	classes/DelphesClasses.h \
-	classes/DelphesFactory.h \
-	classes/DelphesLHEFReader.h \
-	external/ExRootAnalysis/ExRootTreeWriter.h \
-	external/ExRootAnalysis/ExRootTreeBranch.h \
-	external/ExRootAnalysis/ExRootProgressBar.h
-DelphesHepMC$(ExeSuf): \
-	tmp/readers/DelphesHepMC.$(ObjSuf)
-
-tmp/readers/DelphesHepMC.$(ObjSuf): \
-	readers/DelphesHepMC.cpp \
-	modules/Delphes.h \
-	classes/DelphesClasses.h \
-	classes/DelphesFactory.h \
-	classes/DelphesHepMCReader.h \
-	external/ExRootAnalysis/ExRootTreeWriter.h \
-	external/ExRootAnalysis/ExRootTreeBranch.h \
-	external/ExRootAnalysis/ExRootProgressBar.h
-DelphesSTDHEP$(ExeSuf): \
-	tmp/readers/DelphesSTDHEP.$(ObjSuf)
-
-tmp/readers/DelphesSTDHEP.$(ObjSuf): \
-	readers/DelphesSTDHEP.cpp \
-	modules/Delphes.h \
-	classes/DelphesClasses.h \
-	classes/DelphesFactory.h \
-	classes/DelphesSTDHEPReader.h \
-	external/ExRootAnalysis/ExRootTreeWriter.h \
-	external/ExRootAnalysis/ExRootTreeBranch.h \
-	external/ExRootAnalysis/ExRootProgressBar.h
 lhco2root$(ExeSuf): \
 	tmp/converters/lhco2root.$(ObjSuf)
@@ -159,8 +142,5 @@
 	external/ExRootAnalysis/ExRootResult.h \
 	external/ExRootAnalysis/ExRootUtilities.h
-EXECUTABLE =  \
-	DelphesLHEF$(ExeSuf) \
-	DelphesHepMC$(ExeSuf) \
-	DelphesSTDHEP$(ExeSuf) \
+EXECUTABLE +=  \
 	lhco2root$(ExeSuf) \
 	root2pileup$(ExeSuf) \
@@ -171,8 +151,5 @@
 	Example1$(ExeSuf)
 
-EXECUTABLE_OBJ =  \
-	tmp/readers/DelphesLHEF.$(ObjSuf) \
-	tmp/readers/DelphesHepMC.$(ObjSuf) \
-	tmp/readers/DelphesSTDHEP.$(ObjSuf) \
+EXECUTABLE_OBJ +=  \
 	tmp/converters/lhco2root.$(ObjSuf) \
 	tmp/converters/root2pileup.$(ObjSuf) \
@@ -182,4 +159,135 @@
 	tmp/converters/pileup2root.$(ObjSuf) \
 	tmp/examples/Example1.$(ObjSuf)
+
+DelphesHepMC$(ExeSuf): \
+	tmp/readers/DelphesHepMC.$(ObjSuf)
+
+tmp/readers/DelphesHepMC.$(ObjSuf): \
+	readers/DelphesHepMC.cpp \
+	modules/Delphes.h \
+	classes/DelphesClasses.h \
+	classes/DelphesFactory.h \
+	classes/DelphesHepMCReader.h \
+	external/ExRootAnalysis/ExRootTreeWriter.h \
+	external/ExRootAnalysis/ExRootTreeBranch.h \
+	external/ExRootAnalysis/ExRootProgressBar.h
+DelphesLHEF$(ExeSuf): \
+	tmp/readers/DelphesLHEF.$(ObjSuf)
+
+tmp/readers/DelphesLHEF.$(ObjSuf): \
+	readers/DelphesLHEF.cpp \
+	modules/Delphes.h \
+	classes/DelphesClasses.h \
+	classes/DelphesFactory.h \
+	classes/DelphesLHEFReader.h \
+	external/ExRootAnalysis/ExRootTreeWriter.h \
+	external/ExRootAnalysis/ExRootTreeBranch.h \
+	external/ExRootAnalysis/ExRootProgressBar.h
+DelphesSTDHEP$(ExeSuf): \
+	tmp/readers/DelphesSTDHEP.$(ObjSuf)
+
+tmp/readers/DelphesSTDHEP.$(ObjSuf): \
+	readers/DelphesSTDHEP.cpp \
+	modules/Delphes.h \
+	classes/DelphesClasses.h \
+	classes/DelphesFactory.h \
+	classes/DelphesSTDHEPReader.h \
+	external/ExRootAnalysis/ExRootTreeWriter.h \
+	external/ExRootAnalysis/ExRootTreeBranch.h \
+	external/ExRootAnalysis/ExRootProgressBar.h
+EXECUTABLE +=  \
+	DelphesHepMC$(ExeSuf) \
+	DelphesLHEF$(ExeSuf) \
+	DelphesSTDHEP$(ExeSuf)
+
+EXECUTABLE_OBJ +=  \
+	tmp/readers/DelphesHepMC.$(ObjSuf) \
+	tmp/readers/DelphesLHEF.$(ObjSuf) \
+	tmp/readers/DelphesSTDHEP.$(ObjSuf)
+
+ifeq ($(HAS_CMSSW),true)
+DelphesCMSFWLite$(ExeSuf): \
+	tmp/readers/DelphesCMSFWLite.$(ObjSuf)
+
+tmp/readers/DelphesCMSFWLite.$(ObjSuf): \
+	readers/DelphesCMSFWLite.cpp \
+	modules/Delphes.h \
+	classes/DelphesStream.h \
+	classes/DelphesClasses.h \
+	classes/DelphesFactory.h \
+	external/ExRootAnalysis/ExRootTreeWriter.h \
+	external/ExRootAnalysis/ExRootTreeBranch.h \
+	external/ExRootAnalysis/ExRootProgressBar.h
+EXECUTABLE +=  \
+	DelphesCMSFWLite$(ExeSuf)
+
+EXECUTABLE_OBJ +=  \
+	tmp/readers/DelphesCMSFWLite.$(ObjSuf)
+
+endif
+
+ifeq ($(HAS_PROMC),true)
+DelphesProMC$(ExeSuf): \
+	tmp/readers/DelphesProMC.$(ObjSuf)
+
+tmp/readers/DelphesProMC.$(ObjSuf): \
+	readers/DelphesProMC.cpp \
+	modules/Delphes.h \
+	classes/DelphesStream.h \
+	classes/DelphesClasses.h \
+	classes/DelphesFactory.h \
+	external/ExRootAnalysis/ExRootTreeWriter.h \
+	external/ExRootAnalysis/ExRootTreeBranch.h \
+	external/ExRootAnalysis/ExRootProgressBar.h \
+	external/ProMC/ProMCBook.h
+EXECUTABLE +=  \
+	DelphesProMC$(ExeSuf)
+
+EXECUTABLE_OBJ +=  \
+	tmp/readers/DelphesProMC.$(ObjSuf)
+
+tmp/external/ProMC/ProMCBook.$(ObjSuf): \
+	external/ProMC/ProMCBook.$(SrcSuf)
+tmp/external/ProMC/ProMC.pb.$(ObjSuf): \
+	external/ProMC/ProMC.pb.$(SrcSuf)
+tmp/external/ProMC/ProMCStat.pb.$(ObjSuf): \
+	external/ProMC/ProMCStat.pb.$(SrcSuf)
+tmp/external/ProMC/ProMCHeader.pb.$(ObjSuf): \
+	external/ProMC/ProMCHeader.pb.$(SrcSuf)
+tmp/external/ProMC/ProMCDescription.pb.$(ObjSuf): \
+	external/ProMC/ProMCDescription.pb.$(SrcSuf)
+DELPHES_OBJ +=  \
+	tmp/external/ProMC/ProMCBook.$(ObjSuf) \
+	tmp/external/ProMC/ProMC.pb.$(ObjSuf) \
+	tmp/external/ProMC/ProMCStat.pb.$(ObjSuf) \
+	tmp/external/ProMC/ProMCHeader.pb.$(ObjSuf) \
+	tmp/external/ProMC/ProMCDescription.pb.$(ObjSuf)
+
+ifeq ($(HAS_PYTHIA8),true)
+DELPHES_OBJ +=  \
+	
+endif
+
+endif
+
+ifeq ($(HAS_PYTHIA8),true)
+DelphesPythia8$(ExeSuf): \
+	tmp/readers/DelphesPythia8.$(ObjSuf)
+
+tmp/readers/DelphesPythia8.$(ObjSuf): \
+	readers/DelphesPythia8.cpp \
+	modules/Delphes.h \
+	classes/DelphesClasses.h \
+	classes/DelphesFactory.h \
+	external/ExRootAnalysis/ExRootTreeWriter.h \
+	external/ExRootAnalysis/ExRootTreeBranch.h \
+	external/ExRootAnalysis/ExRootProgressBar.h
+EXECUTABLE +=  \
+	DelphesPythia8$(ExeSuf)
+
+EXECUTABLE_OBJ +=  \
+	tmp/readers/DelphesPythia8.$(ObjSuf)
+
+endif
 
 tmp/classes/ClassesDict.$(SrcSuf): \
@@ -795,5 +903,5 @@
 	external/fastjet/ClusterSequence.hh \
 	external/fastjet/NNH.hh
-DELPHES_OBJ =  \
+DELPHES_OBJ +=  \
 	tmp/classes/DelphesHepMCReader.$(ObjSuf) \
 	tmp/classes/DelphesLHEFReader.$(ObjSuf) \
@@ -923,5 +1031,5 @@
 	display/DelphesCaloData.$(SrcSuf) \
 	display/DelphesCaloData.h
-DISPLAY_OBJ =  \
+DISPLAY_OBJ +=  \
 	tmp/display/DelphesDisplay.$(ObjSuf) \
 	tmp/display/DelphesCaloData.$(ObjSuf)
Index: /trunk/doc/genMakefile.tcl
===================================================================
--- /trunk/doc/genMakefile.tcl	(revision 1175)
+++ /trunk/doc/genMakefile.tcl	(revision 1176)
@@ -36,15 +36,15 @@
     foreach file $list {puts -nonewline $suffix$file}
     if {$command != {}} {
-      puts ""
+      puts {}
       puts $command
     }
-    puts ""
+    puts {}
   } elseif {$force} {
     puts -nonewline $firstLine
     if {$command != {}} {
-      puts ""
+      puts {}
       puts $command
     }
-    puts ""
+    puts {}
   }
 
@@ -73,9 +73,9 @@
   puts -nonewline "${dictVar} = $suffix"
   puts [join $dictSrcFiles $suffix]
-  puts ""
+  puts {}
 
   puts -nonewline "${dictVar}_OBJ = $suffix"
   puts [join $dictObjFiles $suffix]
-  puts ""
+  puts {}
 
 }
@@ -103,7 +103,7 @@
   }
 
-  puts -nonewline "${srcPrefix}_OBJ = $suffix"
+  puts -nonewline "${srcPrefix}_OBJ += $suffix"
   puts [join $srcObjFiles $suffix]
-  puts ""
+  puts {}
 
   puts {ifeq ($(HAS_PYTHIA8),true)}
@@ -111,5 +111,5 @@
   puts [join $srcObjFilesPythia8 $suffix]
   puts {endif}
-  puts ""
+  puts {}
 }
 
@@ -135,17 +135,17 @@
   puts -nonewline "TCL_OBJ = $suffix"
   puts [join $srcObjFiles $suffix]
-  puts ""
-}
-
-proc executableDeps {} {
+  puts {}
+}
+
+proc executableDeps {args} {
 
   global prefix suffix objSuf exeSuf
 
-  set executable [glob -nocomplain {readers/*.cpp} {converters/*.cpp} {examples/*.cpp}]
+  set executable [eval glob -nocomplain $args]
 
   set exeFiles {}
 
   foreach fileName $executable {
-    if {$fileName == "examples/DelphesCMSFWLite.cpp" || $fileName == "examples/DelphesProMC.cpp"} continue
+    if {$fileName == "examples/DelphesProMC.cpp"} continue
 
     regsub {\.cpp} $fileName {} exeObjName
@@ -157,5 +157,5 @@
 
     puts "$exeName$exeSuf:$suffix$exeObjName$objSuf"
-    puts ""
+    puts {}
 
     dependencies $fileName "$exeObjName$objSuf:$suffix$fileName"
@@ -163,12 +163,12 @@
 
   if [info exists exeFiles] {
-    puts -nonewline "EXECUTABLE = $suffix"
+    puts -nonewline "EXECUTABLE += $suffix"
     puts [join $exeFiles $suffix]
-    puts ""
+    puts {}
   }
   if [info exists exeObjFiles] {
-    puts -nonewline "EXECUTABLE_OBJ = $suffix"
+    puts -nonewline "EXECUTABLE_OBJ += $suffix"
     puts [join $exeObjFiles $suffix]
-    puts ""
+    puts {}
   }
 }
@@ -203,4 +203,23 @@
 DISPLAY_LIBS = $(shell $(RC) --evelibs) $(SYSLIBS)
 
+ifneq ($(CMSSW_FWLITE_INCLUDE_PATH),)
+HAS_CMSSW = true
+CXXFLAGS += $(subst :, -I,$(CMSSW_FWLITE_INCLUDE_PATH))
+DELPHES_LIBS += $(subst include,lib,$(subst :, -L,$(CMSSW_FWLITE_INCLUDE_PATH))
+ifneq ($(CMSSW_RELEASE_BASE),)
+CXXFLAGS += -I$(CMSSW_RELEASE_BASE)/src
+endif
+ifneq ($(LD_LIBRARY_PATH),)
+DELPHES_LIBS += $(subst include,lib,$(subst :, -L,$(LD_LIBRARY_PATH))
+endif
+DELPHES_LIBS += -lFWCoreFWLite -lDataFormatsFWLite -lDataFormatsPatCandidates -lDataFormatsLuminosity -lCommonToolsUtils
+endif
+
+ifneq ($(PROMC),)
+HAS_PROMC = true
+CXXFLAGS += -I$(PROMC)/include
+DELPHES_LIBS += -L$(PROMC)/lib -lprotoc -lprotobuf -lprotobuf-lite -lcbook -lz
+endif
+
 ifneq ($(PYTHIA8),)
 HAS_PYTHIA8 = true
@@ -231,5 +250,23 @@
 }
 
-executableDeps
+executableDeps {converters/*.cpp} {examples/*.cpp}
+
+executableDeps {readers/DelphesHepMC.cpp} {readers/DelphesLHEF.cpp} {readers/DelphesSTDHEP.cpp}
+
+puts {ifeq ($(HAS_CMSSW),true)}
+executableDeps {readers/DelphesCMSFWLite.cpp}
+puts {endif}
+puts {}
+
+puts {ifeq ($(HAS_PROMC),true)}
+executableDeps {readers/DelphesProMC.cpp}
+sourceDeps {DELPHES} {external/ProMC/*.cc}
+puts {endif}
+puts {}
+
+puts {ifeq ($(HAS_PYTHIA8),true)}
+executableDeps {readers/DelphesPythia8.cpp}
+puts {endif}
+puts {}
 
 dictDeps {DELPHES_DICT} {classes/*LinkDef.h} {modules/*LinkDef.h} {external/ExRootAnalysis/*LinkDef.h}
