# This Makefile is a plain old hand written one; all configuration settings
# are included from ../Makefile.conf which is scconfig generated

ROOT=..

all:

# NOTE: this rule is _not_ called from linstall
install_:
	$(MKDIR) "$(DATADIR)/symbol" "$(DATADIR)/hlibrary" "$(DATADIR)/devmap" "$(DATADIR)/spice"
	$(CPC) "`pwd`/devmap"/* "$(DATADIR)/devmap"
	$(CPC) "`pwd`/spice"/* "$(DATADIR)/spice"
	$(CPC) "`pwd`/symbol"/common_sym.awk "$(DATADIR)/symbol"/common_sym.awk
	$(CPC) "`pwd`/symbol"/LICENSE "$(DATADIR)/symbol"/LICENSE
	$(MKDIR) "$(DATADIR)/symbol/analog"
	$(CPC) "`pwd`/symbol/analog"/* "$(DATADIR)/symbol/analog"
	$(MKDIR) "$(DATADIR)/symbol/diode"
	$(CPC) "`pwd`/symbol/diode"/* "$(DATADIR)/symbol/diode"
	$(MKDIR) "$(DATADIR)/symbol/mech"
	$(CPC) "`pwd`/symbol/mech"/* "$(DATADIR)/symbol/mech"
	$(MKDIR) "$(DATADIR)/symbol/misc"
	$(CPC) "`pwd`/symbol/misc"/* "$(DATADIR)/symbol/misc"
	$(MKDIR) "$(DATADIR)/symbol/passive"
	$(CPC) "`pwd`/symbol/passive"/* "$(DATADIR)/symbol/passive"
	$(MKDIR) "$(DATADIR)/symbol/power"
	$(CPC) "`pwd`/symbol/power"/* "$(DATADIR)/symbol/power"
	$(MKDIR) "$(DATADIR)/symbol/transistor"
	$(CPC) "`pwd`/symbol/transistor"/* "$(DATADIR)/symbol/transistor"

install:
	$(MAKE) install_ CPC="$(CP)"

# hack: pcb's chdir() based approach gets fooled on symlinks because of "cd .."
# returns to the wrong dir - rather symlink the whole dir
linstall:
	$(MAKE) uninstall
	$(MKDIR) "$(DATADIR)"
	$(LN) "`pwd`/symbol" "$(DATADIR)/symbol"
	$(LN) "`pwd`/hlibrary" "$(DATADIR)/hlibrary"
	$(LN) "`pwd`/devmap" "$(DATADIR)/devmap"
	$(LN) "`pwd`/spice" "$(DATADIR)/spice"

uninstall:
	$(RM) "$(DATADIR)/symbol" "$(DATADIR)/devmap" "$(DATADIR)/spice"

clean:

include $(ROOT)/Makefile.conf

