From 1d97e2845281e03bed68b0207cd976cadb94ea0b Mon Sep 17 00:00:00 2001
From: "Stephen A. Wood" <zviwood@gmail.com>
Date: Wed, 14 Jun 2017 22:06:44 -0400
Subject: [PATCH] Autogenerate HallC_Linkdef.h in Makefile   Also use wildcard
 to make SRC list of sources

---
 Makefile | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/Makefile b/Makefile
index 22d0741..a8874b2 100644
--- a/Makefile
+++ b/Makefile
@@ -7,6 +7,10 @@
 # List only the implementation files (*.cxx). For every implementation file
 # there must be a corresponding header file (*.h).
 
+USEWILDCARD = 1
+ifdef USEWILDCARD
+SRC = $(wildcard src/*.cxx)
+else
 SRC  =  src/THcInterface.cxx src/THcParmList.cxx src/THcAnalyzer.cxx \
 	src/THcHallCSpectrometer.cxx \
 	src/THcDetectorMap.cxx \
@@ -35,6 +39,7 @@ SRC  =  src/THcInterface.cxx src/THcParmList.cxx src/THcAnalyzer.cxx \
 	src/THcTrigApp.cxx src/THcTrigDet.cxx src/THcTrigRawHit.cxx \
 	src/THcRawAdcHit.cxx src/THcRawTdcHit.cxx \
 	src/THcDummySpectrometer.cxx
+endif
 
 # Name of your package.
 # The shared library that will be built will get the name lib$(PACKAGE).so
@@ -211,6 +216,11 @@ $(USERDICT).cxx: $(RCHDR) $(HDR) $(LINKDEF)
 	@echo "Generating dictionary $(USERDICT)..."
 	$(ROOTBIN)/rootcint -f $@ -c $(INCLUDES) $(CCDBFLAGS) $^
 
+$(LINKDEF): $(LINKDEF)_preamble $(LINKDEF)_postamble $(SRC)
+	@cat $(LINKDEF)_preamble > $(LINKDEF)
+	@echo $(SRC) | tr ' ' '\n' | sed -e "s|src/|#pragma link C++ class |" | sed -e "s|.cxx|+;|" >> $(LINKDEF)
+	@cat $(LINKDEF)_postamble >> $(LINKDEF)
+
 install:	all
 	cp -p $(USERLIB) $(HOME)/cue/SRC/ana
 
-- 
GitLab