Files
pcas/configure/RULES.Db
2002-10-04 14:51:05 +00:00

242 lines
6.7 KiB
Plaintext

#*************************************************************************
# Copyright (c) 2002 The University of Chicago, as Operator of Argonne
# National Laboratory.
# Copyright (c) 2002 The Regents of the University of California, as
# Operator of Los Alamos National Laboratory.
# EPICS BASE Versions 3.13.7
# and higher are distributed subject to a Software License Agreement found
# in file LICENSE that is included with this distribution.
#*************************************************************************
#RULES.Db
##################################################### vpath
vpath %.dbd $(USR_VPATH) $(GENERIC_SRC_DIRS) $(dir $(DBD)) $(COMMON_DIR)
vpath %.db $(USR_VPATH) $(GENERIC_SRC_DIRS) $(dir $(DB)) $(COMMON_DIR)
vpath %.substitutions $(USR_VPATH) $(GENERIC_SRC_DIRS) $(COMMON_DIR)
vpath %.template $(USR_VPATH) $(GENERIC_SRC_DIRS) $(COMMON_DIR)
vpath %.edf $(USR_VPATH) $(GENERIC_SRC_DIRS) $(COMMON_DIR)
vpath bpt%.data $(USR_VPATH) $(GENERIC_SRC_DIRS) $(COMMON_DIR)
##################################################### dbdflags
# dbExpand
INSTALL_DBDFLAGS += -I $(INSTALL_LOCATION)/dbd
DBDFLAGS = $(USR_DBDFLAGS) -I . -I .. $(INSTALL_DBDFLAGS) $(RELEASE_DBDFLAGS)
##################################################### Targets
# Following line added for backward compatibilty
DBD += $(DBDNAME)
DBD += $(addsuffix .dbd,$(patsubst %.h,%,$(patsubst %.db,%,$(DBDINC))))
INC += $(addsuffix .h,$(patsubst %.h,%,$(patsubst %.db,%,$(DBDINC))))
INSTALL_DBDS += $(addprefix $(INSTALL_DBD)/,$(notdir $(DBD)))
COMMON_DBDS += $(filter $(COMMON_DIR)/%, $(foreach file, $(DBD), \
$(firstword $(SOURCE_DBD) $(COMMON_DIR)/$(file) ) ) )
SOURCE_DBD = $(wildcard $(file) $(SOURCE_DBD_bbb) )
SOURCE_DBD_bbb = $(foreach dir, $(GENERIC_SRC_DIRS), $(SOURCE_DBD_aaa) )
SOURCE_DBD_aaa = $(addsuffix /$(file), $(dir) )
INSTALL_DBS += $(addprefix $(INSTALL_DB)/,$(notdir $(DB)))
COMMON_DBS += $(filter $(COMMON_DIR)/%, $(foreach file, $(DB), \
$(firstword $(SOURCE_DB) $(COMMON_DIR)/$(file) ) ) )
SOURCE_DB = $(wildcard $(file) $(SOURCE_DB_bbb) )
SOURCE_DB_bbb = $(foreach dir, $(GENERIC_SRC_DIRS), $(SOURCE_DB_aaa) )
SOURCE_DB_aaa = $(addsuffix /$(file), $(dir) )
COMMONS = $(COMMON_DIR)/*.dbd $(COMMON_DIR)/*.db $(COMMON_DIR)/*.h \
$(COMMON_DIR)/*.substitutions $(COMMON_DIR)/*.template
PREFIX=$(shell echo $* | sed -e 's-[0-9]--g' | sed -e 's-\.db--g')
##################################################### dependancies
HINC += $(addsuffix .h,$(patsubst %.h,%,$(patsubst %.db,%,$(DBDINC))))
COMMON_DBDINC += $(addprefix $(COMMON_DIR),$(HINC))
DBDDEPENDS_FILES += $(addsuffix $(DEP),$(COMMON_DBDS) \
$(COMMON_DBDINC) $(COMMON_DBS))
DBDDEPENDS_FLAGS = $(filter .%,$(subst -I,,$(filter-out -S%,$(DBDFLAGS))))
DBDDEPENDS_CMD = -$(MKMF) -m $@$(DEP) $(DBDDEPENDS_FLAGS) $@ $<
#####################################################
ifndef T_A
COMMON_DIR = .
INSTALL_DBDS =
INSTALL_DBS =
COMMON_DBDS = $(DBD)
COMMON_DBS = $(DB)
COMMONS = $(DBD) $(DB)
-include $(TOP)/configure/O.$(EPICS_HOST_ARCH)/CONFIG_APP_INCLUDE
all: install
install: buildInstall
buildInstall : build
rebuild: clean install
.PHONY: all inc build install clean rebuild buildInstall
endif # T_A defined
ifneq (,$(strip $(DBDDEPENDS_FILES)))
-include $(DBDDEPENDS_FILES)
endif
$(DBDDEPENDS_FILES):
##################################################### build dependancies, clean rule
inc : $(COMMON_INC) $(INSTALL_INC)
build : $(COMMON_DBDS) $(COMMON_DBS) \
$(INSTALL_DBDS) $(INSTALL_DBS) \
$(DBDDEPENDS_FILES) $(INDDBFROMTEMPLATE) $(TARGETS)
clean::
@$(RM) $(COMMONS) $(DBDDEPENDS_FILES)
@$(RM) *_registerRecordDeviceDriver.cpp
@$(RM) $(INDDBFROMTEMPLATE) $(TARGETS)
##################################################### "Foreign" templates
TEMPLATE_LINKS = $(filter-out $(notdir $(USES_TEMPLATE)), $(USES_TEMPLATE))
TEMPLATE_FILES = $(filter $(notdir $(USES_TEMPLATE)), $(USES_TEMPLATE))
COMMON_TEMPLATES=$(addsuffix $(COMMON_DIR)/,$(notdir $(TEMPLATE_LINKS)))
ifneq '$(TEMPLATE_LINKS)' ''
build: $(notdir $(TEMPLATE_LINKS))
endif
build: $(TEMPLATE_FILES)
$(COMMON_TEMPLATES): $(COMMON_DIR)/%.template:
ifndef WIN32
@$(RM) $(notdir $(TEMPLATE_LINKS))
ln -s $(TEMPLATE_LINKS)
else
@$(RM) $(notdir $(TEMPLATE_LINKS))
$(CP) $(TEMPLATE_LINKS)
endif
##################################################### CapFast filter
$(COMMON_DIR)/%.edf: ../%.sch $(DEPSCHS)
@$(RM) $@
@if [ ! -f cad.rc -a -r ../cad.rc ] ; then ln -s ../cad.rc ; fi
$(SCH2EDIF) $(SCH2EDIF_SYSFLAGS) $(SCH2EDIF_FLAGS) $<
##################################################### Substitution files
# WARNING: CREATESUBSTITUTIONS script needs output dir on command line
ifdef CREATESUBSTITUTIONS
$(COMMON_DIR)/%.substitutions:
@$(RM) $@
@$(CREATESUBSTITUTIONS) $(COMMON_DIR)/$*
endif
.PRECIOUS: $(DB:%.db=$(COMMON_DIR)/%.substitutions)
##################################################### Template files
$(COMMON_DIR)/%.template: %.edf
@$(RM) $@
$(E2DB) $(E2DB_SYSFLAGS) $(E2DB_FLAGS) -n $@.VAR $<
@$(REPLACEVAR) < $@.VAR > $@
@$(RM) $@.VAR
.PRECIOUS: $(DB:%.db=$(COMMON_DIR)/%.template)
##################################################### INC files
$(COMMON_DIR)/%Record.h: %Record.dbd
@$(RM) $@
$(DBTORECORDTYPEH) $(DBDFLAGS) $< $@
$(COMMON_DIR)/menu%.h: menu%.dbd
@$(RM) $@
$(DBTOMENUH) $< $@
##################################################### DBD files
$(COMMON_DIR)/bpt%.dbd: bpt%.data
@$(RM) $@
$(MAKEBPT) $< $@
$(COMMON_DIR)/%.dbd: %Include.dbd
@$(RM) $@$(DEP)
@$(DBDDEPENDS_CMD)
@echo "Expanding dbd"
@$(RM) $@
$(DBEXPAND) $(DBDFLAGS) $< > $@
$(INSTALL_DBD)/%: %
@echo "Installing dbd file $@"
@$(INSTALL) -d -m 644 $< $(@D)
.PRECIOUS: $(COMMON_DBDS)
##################################################### DB files
$(COMMON_DIR)/%.db$(RAW): %.edf
$(E2DB) $(E2DB_SYSFLAGS) $(E2DB_FLAGS) -n $@.VAR $<
@$(REPLACEVAR) < $@.VAR > $@
@$(RM) $@.VAR
$(COMMON_DIR)/%.db$(RAW): %.substitutions %.template
@$(RM) $@$(DEP)
@$(DBDDEPENDS_CMD)
@echo "Inflating database from $<"
@$(RM) $@
$(MSI) -S $^ > $@
# dbst based database optimization
ifeq '$(DB_OPT)' 'YES'
$(COMMON_DIR)/%.db$(RAW): %.db
@$(RM) $@
$(CP) $< $@
$(COMMON_DIR)/%.db: $(COMMON_DIR)/%.db$(RAW)
@echo "Optimizing database $@"
@$(RM) $@
$(DBST) . $< -d > $@
$(INDDBFROMTEMPLATE):%.db: %.substitutions
$(RM) $@
ifndef WIN32
$(MSI) -S$*.substitutions $(PREFIX).template > $@
endif
RAW=.raw
.PRECIOUS: $(DB:%=$(COMMON_DIR)/%$(RAW))
endif
$(INSTALL_DB)/%: %
@echo "Installing db file $@"
@$(INSTALL) -d -m 644 $< $(@D)
.PRECIOUS: $(COMMON_DBS)
##################################################### register record,device,driver support
%_registerRecordDeviceDriver.cpp: %.dbd
@$(RM) $@
$(REGISTERRECORDDEVICEDRIVER) $< > $@
.PRECIOUS: %_registerRecordDeviceDriver.cpp
##################################################### END OF FILE