# Generated automatically from Makefile.in by configure.
# This Makefile presumes GNU make in order to do dynamic dependencies

########################################

srcdir  = ..
include ${srcdir}/make.inc

########################################

# directory containing architecture-independent executables
SHAREBIN = $(prefix)/bin

########################################

#

TLIB    = ucodb


ALL     = $(TLIB).tndx







########################################
# this space intentionally left blank





########################################
#

all: $(ALL)

install: $(UCODB_DIR) \
	$(UCODB_DIR)/$(TLIB).tndx \
	$(UCODB_DIR)/.ucodb.cf


# I can't make this work, but I really wish I could.
# it bothers me that these new superior makefiles don't
# allow for 2 install targets, local vs production (borg)
# as the old ones used to.

public: $(PUBLIC_LIB) \
	$(PUBLIC_LIB)/$(TLIB).tndx \
	$(PUBLIC_LIB)/.ucodb.cf


clean:
	$(RM) $(ALL) $(TLIB).tlib Tlib/AAA_PackageHeader


distclean: clean
	$(RM) config.log config.cache config.status Makefile


${srcdir}/configure: ${srcdir}/configure.in
	cd ${srcdir} && autoconf

Makefile: Makefile.in ${srcdir}/config.status
	cd ${srcdir} && ./config.status




${srcdir}/config.status: ${srcdir}/configure
	cd ${srcdir} && ./config.status --recheck

########################################################################
PACKDEF = AAA_Package.mk

include $(PACKDEF)

########

# names of all the packages within the Tlib

PACKAGES := $(shell awk '/[A-Za-z][A-Za-z0-9_-]* *=/ {print $$1}' < $(PACKDEF) )

########

# GNU make is used to create a macro containing a list of
# all the files upon which the Tlib depends

PACKFILES := $(foreach package, $(PACKAGES), $($(package)) )

########################################
# locally-built targets

$(TLIB).tndx: $(TLIB).tlib
	$(BPI) $(TLIB)

$(TLIB).tlib: tlibHeader Tlib/AAA_PackageHeader $(PACKFILES:%=Tlib/%)
	cat tlibHeader > $@
	$(MKTLIB) Tlib $@

Tlib/AAA_PackageHeader: $(PACKDEF)
	@echo "converting $? into $@"
	@echo "# DO NOT EDIT!" > $@
	@echo "# This file was generated by GNU make on `date`" >> $@
	@echo "# The input data came from the file ../$?" >> $@
	@echo "#########################################################" >> $@
	@$(SED) 's/^\([A-Za-z][A-Za-z0-9_-]*\) *= *\(.*\)/\#@package: \1 \2/' $? >>$@

########################################
# installed stuff from this directory

$(UCODB_DIR)/$(TLIB).tndx: $(UCODB_DIR)/$(TLIB).tlib
	$(BPI) $(UCODB_DIR)/$(TLIB)

$(UCODB_DIR)/$(TLIB).tlib: $(TLIB).tlib
	$(INSTALL_DATA) $? $@

$(UCODB_DIR):
	../mkinstalldirs $@

$(UCODB_DIR)/.ucodb.cf: CONFIG.ucodb.cf
	$(INSTALL_DATA) $? $@

########################################
# this space also intentionally left blank




########################################
# targets preserved from old Makefile for compatibility

production: install

tlib: $(TLIB).tndx

########################################
