Files
pcas/config/RULES.Db
1997-09-23 16:24:49 +00:00

94 lines
2.2 KiB
Plaintext

#RULES.Db
SUBTOOL = $(EPICS_BASE_BIN)/subtool
PREFIX=$(shell echo $* | sed -e 's-[0-9]--g' | sed -e 's-\.db--g')
ARCHS += $(BUILD_ARCHS) host cross
ACTIONS += clean inc depends buildInstall build
actionArchTargets = $(foreach action, $(ACTIONS) install,\
$(foreach arch, $(ARCHS), \
$(action)$(DIVIDER)$(arch)))
all install :: inc buildInstall
buildInstall: .DEPENDS dbd $(DBFROMSCH) $(DBFROMTEMPLATE) $(INDDBFROMTEMPLATE) $(PROD)
inc build depends:
$(TOP)/dbd:
$(MKDIR) $(TOP)/dbd
dbd: $(TOP)/dbd
ifndef WIN32
ln -s $(TOP)/dbd dbd
endif
#### The following section is added to
#### allow optimized databases to be built
#### from capfast schematics
#optimization macro
ifeq '$(DB_OPT)' 'YES'
define DB_OPTIMIZE
@echo "Optimizing database $@"
$(RM) $@.tmp
$(DBST) $(INSTALL_DBD)/$(DBDNAME) $@ -d > $@.tmp
$(RM) $@
$(MV) $@.tmp $@
endef
else
define DB_OPTIMIZE
endef
endif
#Creates database in current directory from capfast schematics
$(DBFROMSCH):%.db: %.db.opt
@echo "Installing database $@"
@$(MV) $< $(<:%.opt=%)
%.db.opt: %.edf
$(E2DB) $(E2DB_SYSFLAGS) $(E2DB_FLAGS) -n $@ $<
$(DB_OPTIMIZE)
-@(echo '1,$$g/VAR(/s/VAR(/$$(/g';echo 'w';echo 'q') | ed $@
%.edf: ./%.sch $(DEPSCHS)
@if [ ! -f cad.rc -a -r ../cad.rc ] ; then ln -s ../cad.rc ; fi
$(SCH2EDIF) $(SCH2EDIF_SYSFLAGS) $(SCH2EDIF_FLAGS) $<
######end section added for captast schematics
$(DBFROMTEMPLATE):%.db: %.template %.substitutions
$(RM) $@
$(SUBTOOL) $*.template $*.substitutions > $@
$(INDDBFROMTEMPLATE):%.db: %.substitutions
$(RM) $@
ifndef WIN32
$(SUBTOOL) $(PREFIX).template $*.substitutions > $@
endif
.DEPENDS: Makefile
@$(RM) $@
ifndef WIN32
@for NAME in $(INDDBFROMTEMPLATE) garbage_marty ; do \
if [ $$NAME != garbage_marty ] ; then \
PREFIX="`echo $$NAME | sed -e 's-[0-9]--g' | sed -e 's-\.db--g'`";\
echo "$$NAME: $$PREFIX.template" >> $@;\
fi ; \
done
endif
clean::
@$(RM) dbd $(DBFROMTEMPLATE) $(DBFROMSCH) $(INDDBFROMTEMPLATE) .DEPENDS $(PROD)
$(actionArchTargets) :%:
$(MAKE) $(word 1, $(subst $(DIVIDER), ,$@))
$(ARCHS):%: install
.PHONY :: $(ARCHS) $(ACTIONS)
.PHONY :: $(actionArchTargets)
-include .DEPENDS