# Makefile for menu source code.
#
# This makes the following:
#	libraries (normal/debug/profile/shared)
#
# The variable 'srcdir' refers to the source-distribution, and can be set with
# the configure script by "--srcdir=DIR".
#
# The rules are organized to produce the libraries for the configured models,

# turn off _all_ suffix rules; we'll generate our own
.SUFFIXES:

SHELL		= /bin/sh
THIS		= Makefile

MODEL		= @DFT_LWR_MODEL@
srcdir		= @srcdir@
VPATH		= @srcdir@
prefix		= @prefix@
exec_prefix	= @exec_prefix@
libdir		= $(exec_prefix)/lib
includedir	= @includedir@

INSTALL		= @INSTALL@
INSTALL_DATA	= @INSTALL_DATA@

AWK		= @AWK@

CC		= @CC@
CFLAGS		= @CFLAGS@

CPPFLAGS	= @INCLUDES@ \
		  -DHAVE_CONFIG_H 

CCFLAGS		= $(CPPFLAGS) $(CFLAGS)

CFLAGS_NORMAL	= $(CCFLAGS)
CFLAGS_DEBUG	= $(CCFLAGS) -g -DTRACE
CFLAGS_PROFILE	= $(CCFLAGS) -pg
CFLAGS_SHARED	= $(CCFLAGS) @CC_SHARED_OPTS@

CFLAGS_DEFAULT	= $(CFLAGS_@DFT_UPR_MODEL@)

LINK		= $(CC)
LDFLAGS		= @LDFLAGS@ @LD_MODEL@ @LIBS@

MK_SHARED_LIB	= @MK_SHARED_LIB@

RANLIB		= @RANLIB@

LIBRARIES	= @LIBS_TO_MAKE@

################################################################################
all ::	../include/menu.h ../include/eti.h $(LIBRARIES)

install :: install.libs

install.libs: $(LIBRARIES) $(includedir) $(libdir)
	$(INSTALL_DATA) $(srcdir)/menu.h $(includedir)/menu.h
	$(INSTALL_DATA) $(srcdir)/eti.h $(includedir)/eti.h
	@for lib in $(LIBRARIES); do \
		echo installing $${lib} as $(libdir)/$${lib}; \
		$(INSTALL_DATA) $${lib} $(libdir)/$${lib}; \
		$(RANLIB) $(libdir)/$${lib}; \
	done

$(includedir) \
$(libdir) :
	$(srcdir)/../mkinstalldirs $@

# make copies to simplify include-paths while still keeping menu's include
# file in this directory.
../include/menu.h : $(srcdir)/menu.h
	-rm -f $@
	cp $(srcdir)/menu.h $@
../include/eti.h : $(srcdir)/eti.h
	-rm -f $@
	cp $(srcdir)/eti.h $@

tags:
	ctags *.[ch]

TAGS:
	etags *.[ch]

clean ::
	-rm -f tags TAGS *~ ../include/menu.h ../include/eti.h

distclean: clean
	-rm -f Makefile

mostlyclean: clean

realclean: distclean

###############################################################################
# The remainder of this file is automatically generated during configuration
###############################################################################
