2010-10-17 04:14:59 +03:00
|
|
|
MASTER = db/all.equ db/all.dsc db/all.inv
|
2010-10-17 19:55:44 +03:00
|
|
|
PARTS = avx-cersmt murata-grm panasonic-erj stackpole-rmcf \
|
|
|
|
tdk-c yageo-cc yageo-rc
|
2010-10-16 05:58:57 +03:00
|
|
|
|
2010-10-17 04:14:59 +03:00
|
|
|
.SECONDARY: # prevent *.cache from being automatically deleted
|
2010-10-16 05:58:57 +03:00
|
|
|
|
2010-10-17 04:14:59 +03:00
|
|
|
.PHONY: all clean rebuild update spotless
|
2010-10-16 05:58:57 +03:00
|
|
|
|
2010-10-17 04:14:59 +03:00
|
|
|
all: $(MASTER) \
|
|
|
|
$(PARTS:%=db/%.equ) \
|
|
|
|
$(PARTS:%=db/%.inv) \
|
|
|
|
$(PARTS:%=db/%.dsc)
|
|
|
|
|
|
|
|
db/%.cache: db/%.equ
|
2010-10-16 05:58:57 +03:00
|
|
|
awk '/^#END/ { exit } /^DIGI-KEY / { print $$2 }' $< | \
|
|
|
|
perl ./dk-db.pl query \
|
2010-10-17 04:14:59 +03:00
|
|
|
`[ -r $@ ] && echo '' -i $@` >$(@)_ || \
|
|
|
|
{ rm -f $@ $(@)_; exit 1; }
|
|
|
|
mv $(@)_ $@
|
|
|
|
|
|
|
|
db:
|
|
|
|
mkdir -p db
|
|
|
|
|
|
|
|
#
|
|
|
|
# We need "db" to create the directory. However, this also means that any
|
|
|
|
# change in the db/ directory triggers a rebuild of all.equ. This is cheap, so
|
|
|
|
# this is nothing but a small cosmetic issue.
|
|
|
|
#
|
2010-10-16 05:58:57 +03:00
|
|
|
|
2010-10-17 04:14:59 +03:00
|
|
|
db/all.equ: db Makefile
|
|
|
|
for n in $(PARTS); do echo "include $$n.equ"; done >$@
|
2010-10-16 05:58:57 +03:00
|
|
|
|
2010-10-17 04:14:59 +03:00
|
|
|
db/all.inv: Makefile
|
|
|
|
for n in $(PARTS); do echo "include $$n.inv"; done >$@
|
2010-10-16 05:58:57 +03:00
|
|
|
|
2010-10-17 04:14:59 +03:00
|
|
|
db/all.dsc: Makefile
|
|
|
|
for n in $(PARTS); do echo "include $$n.dsc"; done >$@
|
2010-10-16 05:58:57 +03:00
|
|
|
|
2010-10-16 14:59:51 +03:00
|
|
|
db/%.equ: %.catq
|
2010-10-16 05:58:57 +03:00
|
|
|
perl ./dk-catq.pl $< >$@ || { rm -rf $@; exit 1; }
|
2010-10-17 04:14:59 +03:00
|
|
|
|
|
|
|
db/%.inv: db/%.cache
|
|
|
|
perl ./dk-db.pl inv $< >$@ || { rm -f $@; exit 1; }
|
|
|
|
|
|
|
|
db/%.dsc: db/%.cache
|
|
|
|
perl ./dk-db.pl dsc $< >$@ || { rm -f $@; exit 1; }
|
|
|
|
|
|
|
|
|
|
|
|
# --- Cleanup -----------------------------------------------------------------
|
|
|
|
|
|
|
|
#
|
|
|
|
# We have various levels of cleanup:
|
|
|
|
#
|
|
|
|
# - clean: remove left-over temporary files
|
|
|
|
# - rebuild: remove everything that can be rebuilt from cached data
|
|
|
|
# - update: remove the short-lived inventory and pricing cache too
|
|
|
|
# - again: remove also the long-lived equivalences cache
|
|
|
|
#
|
|
|
|
# "clean" does not disturb use of the database. The run-time cost of recovering
|
|
|
|
# from "rebuild" is small. What takes a lot of time is "update". The additional
|
|
|
|
# cost of "spotless" is small again.
|
|
|
|
#
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f $(PARTS:%=db/%.cache_)
|
|
|
|
|
|
|
|
rebuild: clean
|
|
|
|
rm -f $(MASTER)
|
|
|
|
rm -f $(PARTS:%=db/%.inv)
|
|
|
|
rm -f $(PARTS:%=db/%.dsc)
|
|
|
|
|
|
|
|
update: rebuild
|
|
|
|
rm -f $(PARTS:%=db/%.cache)
|
|
|
|
|
|
|
|
spotless: update
|
|
|
|
rm -f $(PARTS:%=db/%.equ)
|