From b15d13a6f54c7290057dc6ead5ce71d7bfc6c8d7 Mon Sep 17 00:00:00 2001
From: timmmooney <mooney@aps.anl.gov>
Date: Wed, 8 May 2013 16:44:22 +0000
Subject: [PATCH] Make the .dbd file generation much more sensitive to which
 modules are in configure/RELEASE, and pair link libraries with dbd files.

---
 xxxApp/src/Makefile | 364 +++++++++++++++++++++++++-------------------
 1 file changed, 209 insertions(+), 155 deletions(-)

diff --git a/xxxApp/src/Makefile b/xxxApp/src/Makefile
index fc11d08..bd27714 100644
--- a/xxxApp/src/Makefile
+++ b/xxxApp/src/Makefile
@@ -34,159 +34,251 @@ PROD_IOC = xxx
 # Note that the order in which .dbd files are added to a list variable
 # doesn't matter, but the order of libraries does.
 
-# <name>.dbd will be created from <name>Include.dbd
-ifeq (win32-x86,$(findstring win32-x86, $(T_A)))
-	DBD  += iocxxxWin32.dbd
-	iocxxxWin32_DBD += xxxCommonInclude.dbd
+##################################################################
+# First, define xxx_Common_DBD and xxx_Common_LIBS from the modules
+# defined in RELEASE
+##################################################################
+DBD += xxx_Common.dbd
+xxx_Common_DBD += base.dbd
+
+ifdef AREA_DETECTOR
+	xxx_Common_DBD += ADSupport.dbd  NDFileNetCDF.dbd
+	xxx_Common_LIBS += ADBase NDPlugin netCDF ADBase
+	xxx_Common_DBD += simDetectorSupport.dbd commonDriverSupport.dbd
+	xxx_Common_LIBS += simDetector
+endif
+ifdef ASYN
+	xxx_Common_DBD += asyn.dbd drvAsynSerialPort.dbd
+	xxx_Common_DBD += drvAsynIPPort.dbd drvVxi11.dbd devGpib.dbd
+	xxx_Common_LIBS += asyn
+endif
+ifdef STD
+	xxx_Common_DBD += stdSupport.dbd
+	xxx_Common_LIBS += std
+endif
+ifdef CALC
+	xxx_Common_DBD += calcSupport.dbd
+	xxx_Common_LIBS += calc
+endif
+ifdef BUSY
+	xxx_Common_DBD += busySupport.dbd
+	xxx_Common_LIBS += busy
+endif
+ifdef SSCAN
+	xxx_Common_DBD += sscanSupport.dbd
+	xxx_Common_LIBS += sscan
+	ifdef SNCSEQ
+		xxx_Common_DBD += sscanProgressSupport.dbd
+		xxx_Common_LIBS += scanProgress
+	endif
+endif
+ifdef AUTOSAVE
+	xxx_Common_DBD += asSupport.dbd
+	xxx_Common_LIBS += autosave
+endif
+ifdef OPTICS
+	xxx_Common_DBD += opticsSupport.dbd
+	xxx_Common_LIBS += optics
+endif
+ifdef MCA
+	xxx_Common_DBD += mcaSupport.dbd
+	xxx_Common_LIBS += mca
+endif
+ifdef IP
+	xxx_Common_DBD += ipSupport.dbd
+	xxx_Common_LIBS += ip
+endif
+ifdef QUADEM
+	xxx_Common_DBD += drvAHxxx.dbd
+	xxx_Common_LIBS += quadEM
+endif
+ifdef MOTOR
+	xxx_Common_DBD += motorSupport.dbd devAcsMotor.dbd devAerotech.dbd
+	xxx_Common_DBD += devAttocube.dbd devFaulhaberMotor.dbd devImsMotor.dbd
+	xxx_Common_DBD += devKohzuMotor.dbd devMclennanMotor.dbd devMicos.dbd
+	xxx_Common_DBD += devMicroMo.dbd devNewFocus.dbd devNewport.dbd
+	xxx_Common_DBD += devOriel.dbd devPC6K.dbd devPIJena.dbd devPIMotor.dbd
+	xxx_Common_DBD += devSPiiPlus.dbd devSmartMotorMotor.dbd devSoftMotor.dbd
+	xxx_Common_DBD += devThorLabs.dbd motorRecord.dbd motorSimSupport.dbd
+
+	xxx_Common_LIBS += Acs acsTech80 Aerotech Attocube Faulhaber Ims KohzuMotor
+	xxx_Common_LIBS += Mclennan Micos MicroMo NewFocus Newport Oriel PI PIJena
+	xxx_Common_LIBS += Parker SmartMotor ThorLabs softMotor motorSimSupport
+	xxx_Common_LIBS += motor
+endif
+ifdef SNCSEQ
+	xxx_Common_DBD += devSequencer.dbd
+	xxx_Common_LIBS += seqDev seq pv
+endif
+ifdef STREAM
+	xxx_Common_DBD += stream.dbd streamSynApps.dbd
+	xxx_Common_LIBS += stream streamSynApps
+endif
+ifdef DEVIOCSTATS
+	xxx_Common_DBD += devIocStats.dbd iocAdmin.dbd
+	xxx_Common_LIBS += devIocStats
+endif
+xxx_Common_LIBS += $(EPICS_BASE_IOC_LIBS)
 
-	# If your host supports libpcap and libnet and you want to build Canberra network
-	# support uncomment the following line
-	#iocxxxWin32_DBD += mcaCanberraSupport.dbd
+##################################################################
 
-	# If you want to build parallel port or USB interfaces to Saturn and/or xMAP DXP
-	# then uncomment the following lines
-	iocxxxWin32_DBD += dxpSupport.dbd
-	iocxxxWin32_DBD += ADSupport.dbd  NDFileNetCDF.dbd
-	xxx_LIBS_WIN32 += dxp handel
-	xxx_LIBS_WIN32 += ADBase NDPlugin netCDF
-	xxx_LIBS_WIN32 += DLPORTIO PlxApi
-	xxx_SYS_LIBS_WIN32 += setupapi
 
-	ifdef DEVIOCSTATS
-		iocxxxWin32_DBD += devIocStats.dbd iocAdmin.dbd
+ifeq (win32-x86,$(findstring win32-x86, $(T_A)))
+
+	DBD  += iocxxxWin32.dbd
+	iocxxxWin32_DBD += xxx_Common.dbd
+
+	ifdef MCA
+		# If your host supports libpcap and libnet and you want to build
+		# Canberra network support uncomment the following lines
+		#iocxxxWin32_DBD += mcaCanberraSupport.dbd
+		#xxx_LIBS_WIN32 += mcaCanberra
+		#xxx_SYS_LIBS_WIN32 += net pcap
+	endif
+
+	ifdef DXP
+		# If you want to build parallel port or USB interfaces to Saturn and/or
+		# xMAP DXP,
+		 then uncomment the following lines
+		iocxxxWin32_DBD += dxpSupport.dbd
+		xxx_LIBS_WIN32 += dxp handel
+		xxx_LIBS_WIN32 += DLPORTIO PlxApi
+		xxx_SYS_LIBS_WIN32 += setupapi
 	endif
+
 endif
 
 ifeq (windows-x64,$(findstring windows-x64, $(T_A)))
 	DBD  += iocxxxWin64.dbd
-	iocxxxWin64_DBD += xxxCommonInclude.dbd
-
-	# If your host supports libpcap and libnet and you want to build Canberra network
-	# support uncomment the following line
-	iocxxxWin32_DBD += mcaCanberraSupport.dbd
-
-	ifdef DEVIOCSTATS
-		iocxxxWin32_DBD += devIocStats.dbd iocAdmin.dbd
+	iocxxxWin64_DBD += xxx_Common.dbd
+
+	ifdef MCA
+		# If your host supports libpcap and libnet and you want to build Canberra network
+		# support uncomment the following line
+		iocxxxWin64_DBD += mcaCanberraSupport.dbd
+		xxx_LIBS_WIN64 += mcaCanberra
+		xxx_SYS_LIBS_WIN64 += net pcap
 	endif
+
 endif
 
 ifeq ($(EPICS_HOST_ARCH), cygwin-x86)
 	DBD  += iocxxxCygwin.dbd
-	iocxxxCygwin_DBD += xxxCommonInclude.dbd
-	# for simDetector
-	iocxxxCygwin_DBD += ADSupport.dbd  NDFileNetCDF.dbd
-	xxx_LIBS_cygwin32 += ADBase NDPlugin netCDF
-	iocxxxCygwin_DBD += simDetectorSupport.dbd commonDriverSupport.dbd
-	xxx_LIBS_cygwin32 += simDetector
-
-	# If you want to build parallel port or USB interfaces to Saturn and/or xMAP DXP
-	# then uncomment the following six lines
-	#iocxxxCygwin_DBD += dxpSupport.dbd
-	#iocxxxCygwin_DBD += ADSupport.dbd NDFileNetCDF.dbd
-	#xxx_LIBS_cygwin32 += dxp handel
-	#xxx_LIBS_cygwin32 += ADBase NDPlugin netCDF
-	#xxx_SYS_LIBS_cygwin32 += DLPORTIO PlxApi
-	#xxx_SYS_LIBS_cygwin32 += setupapi
+	iocxxxCygwin_DBD += xxx_Common.dbd
+
+	ifdef DXP
+		# If you want to build parallel port or USB interfaces to Saturn and/or
+		# xMAP DXP,then uncomment the following lines
+		#iocxxxCygwin_DBD += dxpSupport.dbd
+		#xxx_LIBS_cygwin32 += dxp handel
+		#xxx_SYS_LIBS_cygwin32 += DLPORTIO PlxApi setupapi
+	endif
 
 	xxx_SYS_LIBS_cygwin32 += $(CYGWIN_RPC_LIB)
 
-	ifdef DEVIOCSTATS
-		iocxxxCygwin_DBD += devIocStats.dbd iocAdmin.dbd
-	endif
-
 endif
 
 ifeq (vxWorks,$(findstring vxWorks, $(T_A)))
 	DBD  += iocxxxVX.dbd
-	#iocxxxVX_DBD += iocxxxVXInclude.dbd
-
-	iocxxxVX_DBD += xxxCommonInclude.dbd
-
-	iocxxxVX_DBD += NDFileNetCDF.dbd
-	iocxxxVX_DBD += simDetectorSupport.dbd ADSupport.dbd NDPluginSupport.dbd
-	xxx_LIBS_vxWorks += ADBase NDPlugin netCDF ADBase
-	xxx_LIBS_vxWorks += simDetector
-
-
-	iocxxxVX_DBD += vmeVXSupport.dbd
-	iocxxxVX_DBD += stdVXSupport.dbd
-	iocxxxVX_DBD += ipVXSupport.dbd
-	iocxxxVX_DBD += SIS38XXSupport.dbd
-	iocxxxVX_DBD += ipUnidigSupport.dbd
-	iocxxxVX_DBD += dac128VSupport.dbd
-	iocxxxVX_DBD += ip330Support.dbd
-ifdef CAMAC
-	iocxxxVX_DBD += camacSupport.dbd
-	iocxxxVX_DBD += devCamacSupport.dbd
-endif
-ifdef ALLEN_BRADLEY
-	iocxxxVX_DBD += allenBradley.dbd
-endif
-	iocxxxVX_DBD += drvAPS_EM.dbd
-	iocxxxVX_DBD += mcaCanberraSupport.dbd
-	iocxxxVX_DBD += devLove.dbd
-	# from ipac
-	iocxxxVX_DBD += tyGSOctal.dbd
-	iocxxxVX_DBD += drvIpac.dbd
-	# from asyn
-	iocxxxVX_DBD += drvGsIP488.dbd
-	ifndef DEVIOCSTATS
-		iocxxxVX_DBD += vxStats.dbd
+	iocxxxVX_DBD += xxx_Common.dbd
+
+	ifdef ALLEN_BRADLEY
+		xxx_LIBS_vxWorks += allenBradley
+	endif
+	ifdef VME
+		iocxxxVX_DBD += vmeVXSupport.dbd
+		xxx_LIBS_vxWorks += vme
+	endif
+	ifdef STD
+		iocxxxVX_DBD += stdVXSupport.dbd
+	endif
+	ifdef IP
+		iocxxxVX_DBD += ipVXSupport.dbd
+	endif
+	ifdef MCA
+		iocxxxVX_DBD += SIS38XXSupport.dbd
+		iocxxxVX_DBD += mcaCanberraSupport.dbd
+		xxx_LIBS_vxWorks += SIS38XX
+		xxx_LIBS_vxWorks += mcaCanberra
+	endif
+	ifdef IPUNIDIG
+		iocxxxVX_DBD += ipUnidigSupport.dbd
+		xxx_LIBS_vxWorks += ipUnidig
+	endif
+	ifdef DAC128V
+		iocxxxVX_DBD += dac128VSupport.dbd
+		xxx_LIBS_vxWorks += dac128V
+	endif
+	ifdef IP330
+		iocxxxVX_DBD += ip330Support.dbd
+		xxx_LIBS_vxWorks += ip330
+	endif
+	ifdef CAMAC
+		iocxxxVX_DBD += camacSupport.dbd
+		iocxxxVX_DBD += devCamacSupport.dbd
+		xxx_LIBS_vxWorks += camac devCamac
+	endif
+	ifdef ALLEN_BRADLEY
+		iocxxxVX_DBD += allenBradley.dbd
+	endif
+	ifdef QUADEM
+		iocxxxVX_DBD += drvAPS_EM.dbd
+	endif
+	ifdef LOVE
+		iocxxxVX_DBD += devLove.dbd
+		xxx_LIBS_vxWorks += love
+	endif
+	ifdef IPAC
+		iocxxxVX_DBD += tyGSOctal.dbd
+		iocxxxVX_DBD += drvIpac.dbd
+		xxx_LIBS_vxWorks += TyGSOctal Ipac
+	endif
+	ifdef ASYN
+		iocxxxVX_DBD += drvGsIP488.dbd
+	endif
+	ifdef SOFTGLUE
+		iocxxxVX_DBD += softGlueSupport.dbd
+		xxx_LIBS_vxWorks += softGlue
+	endif
+	ifdef MOTOR
+		iocxxxVX_DBD += devDeltaTau.dbd
+		iocxxxVX_DBD += devOms.dbd
+		xxx_LIBS_vxWorks += oms DeltaTau
 	endif
-	iocxxxVX_DBD += softGlueSupport.dbd
-	# from motor
-	iocxxxVX_DBD += devDeltaTau.dbd
-	iocxxxVX_DBD += devOms.dbd
 
 	ifdef DEVIOCSTATS
-		iocxxxVX_DBD += devIocStats.dbd iocAdmin.dbd
 		iocxxxVX_DBD += devVxStats.dbd
 	endif
 endif
 
 ifneq (,$(findstring linux, $(T_A)))
 	DBD  += iocxxxLinux.dbd
-	iocxxxLinux_DBD += xxxCommonInclude.dbd
-	iocxxxLinux_DBD += ADSupport.dbd  NDFileNetCDF.dbd
-	xxx_LIBS_Linux += ADBase NDPlugin netCDF
-	iocxxxLinux_DBD += simDetectorSupport.dbd commonDriverSupport.dbd
-	xxx_LIBS_Linux += simDetector
-
-	# If your host supports libpcap and libnet and you want to build Canberra network
-	# support, set LINUX_NET_INSTALLED to YES in <synApps>/configure/CONFIG_SITE.
-	ifeq ($(LINUX_NET_INSTALLED), YES)
-		iocxxxLinux_DBD += mcaCanberraSupport.dbd
-		xxx_LIBS_Linux += mcaCanberra
-		xxx_SYS_LIBS_Linux += net pcap
-	endif
-	# If your host supports parallel port or USB interfaces to Saturn DXP, set
-	# LINUX_USB_INSTALLED to YES in <synApps>/configure/CONFIG_SITE.
-	ifeq ($(LINUX_USB_INSTALLED), YES)
-		iocxxxLinux_DBD += dxpSupport.dbd
-		xxx_LIBS_Linux  += dxp handel
-		xxx_SYS_LIBS_Linux += usb
+	iocxxxLinux_DBD += xxx_Common.dbd
+
+	ifdef MCA
+		# If your host supports libpcap and libnet and you want to build Canberra network
+		# support, set LINUX_NET_INSTALLED to YES in <synApps>/configure/CONFIG_SITE.
+		ifeq ($(LINUX_NET_INSTALLED), YES)
+			iocxxxLinux_DBD += mcaCanberraSupport.dbd
+			xxx_LIBS_Linux += mcaCanberra
+			xxx_SYS_LIBS_Linux += net pcap
+		endif
 	endif
 
-	ifdef DEVIOCSTATS
-		iocxxxLinux_DBD += devIocStats.dbd iocAdmin.dbd
-	endif
-endif
-
-ifeq ($(OS_CLASS), solaris)
-	DBD  += iocxxx_solaris.dbd
-	iocxxx_solaris_DBD += xxxCommonInclude.dbd
-	ifdef DEVIOCSTATS
-		iocxxx_solaris_DBD += devIocStats.dbd iocAdmin.dbd
-		xxx_SYS_LIBS_solaris += kstat
+	ifdef DXP
+		# If your host supports parallel port or USB interfaces to Saturn DXP, set
+		# LINUX_USB_INSTALLED to YES in <synApps>/configure/CONFIG_SITE.
+		ifeq ($(LINUX_USB_INSTALLED), YES)
+			iocxxxLinux_DBD += dxpSupport.dbd
+			xxx_LIBS_Linux  += dxp handel
+			xxx_SYS_LIBS_Linux += usb
+		endif
 	endif
 endif
 
 ifeq ($(OS_CLASS), Darwin)
 	DBD  += iocxxxDarwin.dbd
-	iocxxxDarwin_DBD += xxxCommonInclude.dbd
-	ifdef DEVIOCSTATS
-		iocxxxDarwin_DBD += devIocStats.dbd iocAdmin.dbd
-	endif
+	iocxxxDarwin_DBD += xxx_Common.dbd
 endif
 
 
@@ -204,45 +296,7 @@ xxx_SRCS_cygwin32 += iocxxxCygwin_registerRecordDeviceDriver.cpp    xxxMain.cpp
 xxx_SRCS_solaris  += iocxxx_solaris_registerRecordDeviceDriver.cpp  xxxMain.cpp
 xxx_SRCS_Darwin   += iocxxxDarwin_registerRecordDeviceDriver.cpp    xxxMain.cpp
 
-xxx_Common_LIBS += mca
-xxx_Common_LIBS += calc
-xxx_Common_LIBS += busy
-xxx_Common_LIBS += sscan scanProgress
-xxx_Common_LIBS += autosave
-xxx_Common_LIBS += optics
-xxx_Common_LIBS += std
-xxx_Common_LIBS += ip
-xxx_Common_LIBS += quadEM
-xxx_Common_LIBS += Acs acsTech80 Aerotech Attocube Faulhaber Ims KohzuMotor Mclennan
-xxx_Common_LIBS += Micos MicroMo NewFocus Newport Oriel PI PIJena Parker SmartMotor
-xxx_Common_LIBS += ThorLabs softMotor motorSimSupport motor
-xxx_Common_LIBS += asyn
-xxx_Common_LIBS += stream streamSynApps
-xxx_Common_LIBS += seqDev seq pv
-xxx_Common_LIBS += $(EPICS_BASE_IOC_LIBS)
-ifdef DEVIOCSTATS
-	xxx_Common_LIBS += devIocStats
-endif
 
-ifdef ALLEN_BRADLEY
-xxx_LIBS_vxWorks += allenBradley
-endif
-xxx_LIBS_vxWorks += SIS38XX
-xxx_LIBS_vxWorks += mcaCanberra
-xxx_LIBS_vxWorks += ip330
-xxx_LIBS_vxWorks += ipUnidig
-xxx_LIBS_vxWorks += dac128V
-ifdef CAMAC
-xxx_LIBS_vxWorks += camac devCamac
-endif
-xxx_LIBS_vxWorks += love
-ifndef DEVIOCSTATS
-	xxx_LIBS_vxWorks += vxStats
-endif
-xxx_LIBS_vxWorks += vme
-xxx_LIBS_vxWorks += TyGSOctal Ipac
-xxx_LIBS_vxWorks += oms DeltaTau
-xxx_LIBS_vxWorks += softGlue
 
 #The following adds support from base/src/vxWorks
 xxx_OBJS_vxWorks += $(EPICS_BASE_BIN)/vxComLibrary
-- 
GitLab