diff --git a/App/tools/driver.makefile b/App/tools/driver.makefile index 0fc64dcf45f914ebeb614d75b89a9fe768c76f50..a3bf5611556192e6d9415dd604f1e012f7ff7688 100644 --- a/App/tools/driver.makefile +++ b/App/tools/driver.makefile @@ -1,6 +1,6 @@ # driver.makefile # -# $Id: driver.makefile,v 1.2 2011/06/07 15:00:25 zimoch Exp $ +# $Id: driver.makefile,v 1.3 2011/06/14 16:00:52 zimoch Exp $ # # This generic makefile compiles EPICS code (drivers, records, snl, ...) # for all installed EPICS versions in parallel. @@ -105,7 +105,7 @@ ifndef EPICSVERSION # in source directory, first run # Find out which EPICS versions to build -INSTALLED_EPICS_VERSIONS := $(patsubst ${EPICS_LOCATION}/base-%/config/CONFIG,%,$(wildcard ${EPICS_LOCATION}/base-*[0-9]/config/CONFIG)) +INSTALLED_EPICS_VERSIONS := $(patsubst ${EPICS_LOCATION}/base-%,%,$(wildcard ${EPICS_LOCATION}/base-*[0-9])) EPICS_VERSIONS = $(filter-out ${EXCLUDE_VERSIONS:=%},${DEFAULT_EPICS_VERSIONS}) MISSING_EPICS_VERSIONS = $(filter-out ${BUILD_EPICS_VERSIONS},${EPICS_VERSIONS}) BUILD_EPICS_VERSIONS = $(filter ${EPICS_VERSIONS},${INSTALLED_EPICS_VERSIONS}) @@ -159,7 +159,7 @@ endif VERSIONCHECKFILES = ${SOURCES} ${SOURCES_3.13} ${SOURCES_3.14} ${DBDS} ${DBDS_3.13} ${DBD_3.14} VERSIONCHECKCMD = ${MAKEHOME}/getVersion.tcl ${VERSIONCHECKFILES} -LIBVERSION_YES = $(shell ${VERSIONCHECKCMD}) +LIBVERSION_YES = $(shell ${VERSIONCHECKCMD} 2>/dev/null) LIBVERSION_Yes = $(LIBVERSION_YES) LIBVERSION_yes = $(LIBVERSION_YES) LIBVERSION = ${LIBVERSION_${USE_LIBVERSION}} @@ -320,9 +320,7 @@ endif # 3.14 PROJECTDBD=${PRJ}${LIBVERSIONSTR}.dbd export DBDFILES PROJECTDBD -FINDINDBD = $(foreach file,${DBDFILES},$(shell grep -o $(subst *,[[:alnum:]_]*,$(1)) ${file})) - -RECORDS = $(sort $(patsubst %.dbd,%.h,$(notdir $(filter %Record.dbd,${DBDFILES})) $(call FINDINDBD,*Record.dbd))) +RECORDS = $(shell ${MAKEHOME}/expandDBD.tcl -r $(addprefix -I, $(sort $(dir ${DBDFILES}))) ${DBDFILES}) export RECORDS MENUS = $(patsubst %.dbd,%.h,$(wildcard menu*.dbd)) @@ -331,7 +329,7 @@ export MENUS BPTS = $(patsubst %.data,%.dbd,$(wildcard bpt*.data)) export BPTS -HDRS = ${HEADERS} ${RECORDS} +HDRS = ${HEADERS} $(addsuffix Record.h,${RECORDS}) export HDRS TEMPLS = ${TEMPLATES} @@ -634,12 +632,12 @@ CPPFLAGS += -MD -include *.d # Setup searchpaths from all used files -DIRS = $(sort $(dir ${SRCS:%=../%} ${HDRS:%=../%} ${TEMPLS:%=../%} ${DOCU:%=../%})) vpath % .. vpath % $(sort $(dir ${SRCS:%=../%})) vpath %.h $(sort $(dir ${HDRS:%=../%})) vpath %.template $(sort $(dir ${TEMPLS:%=../%})) vpath %.db $(sort $(dir ${TEMPLS:%=../%})) +vpath %.dbd $(sort $(dir ${DBDFILES:%=../%})) #VPATH += $(sort $(dir ${DOCU:%=../%})) DBDDIRS = $(sort $(dir ${DBDFILES:%=../%})) @@ -649,7 +647,7 @@ USR_DBDFLAGS += $(DBDEXPANDPATH) ifeq (${EPICS_BASETYPE},3.13) USR_INCLUDES += $(addprefix -I, $(sort $(dir ${SRCS:%=../%} ${HDRS:%=../%}))) -build:: ${PROJECTDBD} ${RECORDS} ${PROJECTLIB} +build:: ${PROJECTDBD} $(addsuffix Record.h,${RECORDS}) ${PROJECTLIB} ifneq ($(filter %.cc %.cpp,${SRCS}),) ifneq (${T_A},T1-ppc604) #add munched library for C++ code (does not work for T1-ppc604) @@ -658,7 +656,7 @@ endif # T1-ppc604 endif # .cc or .cpp found else # 3.14 GENERIC_SRC_INCLUDES = $(addprefix -I, $(sort $(dir ${SRCS:%=../%} ${HDRS:%=../%}))) -build: ${PROJECTDBD} ${RECORDS} +build: ${PROJECTDBD} $(addsuffix Record.h,${RECORDS}) EXPANDARG = -3.14 endif # 3.14 @@ -859,3 +857,5 @@ endif # in O.* directory endif # T_A defined endif # OS_CLASS in BUILDCLASSES endif # EPICSVERSION defined + +# $Header: /cvs/G/DRV/misc/App/tools/driver.makefile,v 1.3 2011/06/14 16:00:52 zimoch Exp $ diff --git a/App/tools/expandDBD.tcl b/App/tools/expandDBD.tcl index a5c50d886a7634853667400dccfdf48252e1ff5d..3299a30d95b1250e997a2213e1f52582e4a23389 100755 --- a/App/tools/expandDBD.tcl +++ b/App/tools/expandDBD.tcl @@ -2,12 +2,29 @@ package require Tclx -set epicsversion 3.13 set global_context [scancontext create] +set epicsversion 3.13 +set quiet 0 +set recordtypes 0 +set seachpath {} + +while {[llength $argv]} { + switch -glob -- [lindex $argv 0] { + "-3.14" { set epicsversion 3.14 } + "-q" { set quiet 1 } + "-r" { set recordtypes 1; set quiet 1 } + "-I" { lappend seachpath [lindex $argv 1]; set argv [lreplace $argv 0 1]; continue } + "-I*" { lappend seachpath [string range [lindex $argv 0] 2 end] } + "-*" { puts stderr "Unknown option [lindex $argv 0] ignored" } + default { break } + } + set argv [lreplace $argv 0 0] +} + proc opendbd {name} { - global seachpatch - foreach dir $seachpatch { + global seachpath + foreach dir $seachpath { if ![catch { set file [open [file join $dir $name]] }] { @@ -21,35 +38,39 @@ scanmatch $global_context {^[ \t]*(#|%|$)} { continue } -scanmatch $global_context {include[ \t]+"(.*)"} { - global FileName - if [catch { - includeFile $global_context $matchInfo(submatch0) - } msg] { - puts stderr "ERROR: $msg in $FileName($matchInfo(handle)) line $matchInfo(linenum)" - exit 1 - } +if {$recordtypes} { + scanmatch $global_context {include[ \t]+"?(.*)Record.dbd"?} { + puts $matchInfo(submatch0) continue } -scanmatch $global_context {include[ \t]+(.*)} { +} else { + + scanmatch $global_context {(registrar|variable|function)[ \t]*\(} { + global epicsversion + if {$epicsversion == 3.14} {puts $matchInfo(line)} + } + + scanmatch $global_context { + puts $matchInfo(line) + } +} + +scanmatch $global_context {include[ \t]+"?([^"]*)"?} { + global seachpath + global FileName + global quiet if [catch { includeFile $global_context $matchInfo(submatch0) } msg] { - puts stderr "ERROR: $msg in $FileName($matchInfo(handle)) line $matchInfo(linenum)" - exit 1 + if {!$quiet} { + puts stderr "ERROR: $msg in path \"$seachpath\" called from $FileName($matchInfo(handle)) line $matchInfo(linenum)" + exit 1 + } } continue } -scanmatch $global_context {(registrar|variable|function)[ \t]*\(} { - global epicsversion - if {$epicsversion == 3.14} {puts $matchInfo(line)} -} - -scanmatch $global_context { - puts $matchInfo(line) -} proc includeFile {context name} { global global_context FileName @@ -59,17 +80,6 @@ proc includeFile {context name} { close $file } -if {[lindex $argv 0] == "-3.14"} { - set epicsversion 3.14 - set argv [lreplace $argv 0 0] -} - -set seachpatch {} -while {[lindex $argv 0] == "-I"} { - lappend seachpatch [lindex $argv 1] - set argv [lreplace $argv 0 1] -} - foreach filename $argv { set file [open $filename] set FileName($file) $filename @@ -77,4 +87,4 @@ foreach filename $argv { close $file } -# $Header: /cvs/G/DRV/misc/App/tools/expandDBD.tcl,v 1.2 2010/08/03 08:42:40 zimoch Exp $ +# $Header: /cvs/G/DRV/misc/App/tools/expandDBD.tcl,v 1.3 2011/06/14 16:00:55 zimoch Exp $