# $Id: Makefile.in,v 1.66 2005/04/24 23:06:20 tom Exp $
#
#  Copyright 2001-2004,2005 Thomas Dickey
#  Copyright 1999, Mike Glover
#  All rights reserved.
#
#  Redistribution and use in source and binary forms, with or without
#  modification, are permitted provided that the following conditions
#  are met:
#  1. Redistributions of source code must retain the above copyright
#     notice, this list of conditions and the following disclaimer.
#  2. Redistributions in binary form must reproduce the above copyright
#     notice, this list of conditions and the following disclaimer in the
#     documentation and/or other materials provided with the distribution.
#  3. All advertising materials mentioning features or use of this software
#     must display the following acknowledgment:
#       This product includes software developed by Mike Glover
#       and contributors.
#  4. Neither the name of Mike Glover, nor the names of contributors
#     may be used to endorse or promote products derived from this software
#     without specific prior written permission.
#
#  THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND
#  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
#  ARE DISCLAIMED.  IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE
#  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
#  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
#  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
#  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
#  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
#  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
#  SUCH DAMAGE.
#
SHELL		= /bin/sh
@SET_MAKE@
MAKE_RECUR	= @cf_cv_makeflags@ prefix=$(prefix)

LIB_ROOTNAME	= @LIB_ROOTNAME@
LIB_SUFFIX	= @LIB_SUFFIX@

VERSION_MAJOR	= @VERSION_MAJOR@
VERSION_MINOR	= @VERSION_MINOR@
VERSION		= $(VERSION_MAJOR).$(VERSION_MINOR)
CDKLIB		= @LIB_PREFIX@@LIB_ROOTNAME@$(LIB_SUFFIX)
CDKSHLIB	= @LIB_PREFIX@@LIB_ROOTNAME@.so.$(VERSION_MAJOR)
SONAME		= @LIB_PREFIX@@LIB_ROOTNAME@.so.$(VERSION_MAJOR)

prefix		= @prefix@
exec_prefix	= @exec_prefix@

srcdir		= @srcdir@
VPATH		= $(srcdir)

x		= @EXEEXT@
o		= .@OBJEXT@
a		= @LIB_SUFFIX@

DESTDIR		=
includedir	= $(DESTDIR)@includedir@
libdir		= $(DESTDIR)@libdir@
mandir		= $(DESTDIR)@mandir@

DOCUMENT_DIR	= @prefix@/share/doc/cdk
INCLUDE_DIR	= $(includedir)/cdk
LIB_DIR		= $(libdir)
MAN_DIR		= $(mandir)/man3

CC		= @CC@
CPP		= @CPP@
AR		= @AR@
RANLIB		= @LIB_PREP@
RM		= rm -f

LIBS		= @LIBS@

CFLAGS		= @CFLAGS@ @EXTRA_CFLAGS@
CPPFLAGS	= @DEFS@ -I./include -I$(srcdir)/include @CPPFLAGS@

LDFLAGS		= @LDFLAGS@

LIBTOOL		= @LIBTOOL@ @ECHO_LT@
LIBTOOL_CLEAN	= @LIB_CLEAN@
LIBTOOL_COMPILE	= @LIB_COMPILE@
LIBTOOL_CREATE	= @LIB_CREATE@
LIBTOOL_LINK	= @LIB_LINK@
LIBTOOL_INSTALL	= @LIB_INSTALL@
LIBTOOL_UNINSTALL = @LIB_UNINSTALL@

INSTALL		= @INSTALL@
INSTALL_PROGRAM	= $(LIBTOOL_INSTALL) @INSTALL_PROGRAM@
INSTALL_DATA	= @INSTALL_DATA@
INSTALL_LIB	= $(LIBTOOL_INSTALL) $(INSTALL_DATA)
UNINSTALL_LIB	= $(LIBTOOL_UNINSTALL) $(RM)

.SUFFIXES: .c .o .os .i

DEFAULT		= $(CDKLIB) headers.sed

default :: $(DEFAULT)

#
# Create the file lists.
#
AUTO_HDR	= \
		include/dscale.h \
		include/fscale.h \
		include/fslider.h \
		include/scale.h \
		include/slider.h \
		include/uscale.h \
		include/uslider.h

AUTO_SRC	= \
		dscale.c \
		fscale.c \
		fslider.c \
		scale.c \
		slider.c \
		uscale.c \
		uslider.c

AUTO_MAN	= \
		man/cdk_dscale.3 \
		man/cdk_fscale.3 \
		man/cdk_fslider.3 \
		man/cdk_scale.3 \
		man/cdk_slider.3 \
		man/cdk_uscale.3 \
		man/cdk_uslider.3

MY_HDR		= \
		include/cdk_config.h \
		$(AUTO_HDR)

CDKHDR		= \
		alphalist.h \
		binding.h \
		button.h \
		buttonbox.h \
		calendar.h \
		cdk.h \
		cdk_compat.h \
		cdk_objs.h \
		cdk_params.h \
		cdk_util.h \
		cdk_version.h \
		cdkscreen.h \
		curdefs.h \
		dialog.h \
		draw.h \
		entry.h \
		fselect.h \
		graph.h \
		histogram.h \
		itemlist.h \
		label.h \
		marquee.h \
		matrix.h \
		mentry.h \
		menu.h \
		radio.h \
		scroll.h \
		selection.h \
		swindow.h \
		template.h \
		traverse.h \
		viewer.h

CDKSRC		= \
		$(AUTO_SRC) \
		alphalist.c \
		binding.c \
		button.c \
		buttonbox.c \
		calendar.c \
		cdk.c \
		cdk_compat.c \
		cdk_objs.c \
		cdk_params.c \
		cdkscreen.c \
		debug.c \
		dialog.c \
		draw.c \
		entry.c \
		fselect.c \
		get_index.c \
		get_string.c \
		graph.c \
		histogram.c \
		itemlist.c \
		label.c \
		marquee.c \
		matrix.c \
		mentry.c \
		menu.c \
		popup_dialog.c \
		popup_label.c \
		position.c \
		radio.c \
		scroll.c \
		selection.c \
		swindow.c \
		select_file.c \
		template.c \
		traverse.c \
		version.c \
		view_file.c \
		view_info.c \
		viewer.c

CDKMAN		= \
		cdk.3 \
		cdk_alphalist.3 \
		cdk_binding.3 \
		cdk_button.3 \
		cdk_buttonbox.3 \
		cdk_calendar.3 \
		cdk_compat.3 \
		cdk_dialog.3 \
		cdk_display.3 \
		cdk_entry.3 \
		cdk_fscale.3 \
		cdk_fselect.3 \
		cdk_graph.3 \
		cdk_histogram.3 \
		cdk_itemlist.3 \
		cdk_label.3 \
		cdk_marquee.3 \
		cdk_matrix.3 \
		cdk_mentry.3 \
		cdk_menu.3 \
		cdk_misc.3 \
		cdk_objs.3 \
		cdk_params.3 \
		cdk_position.3 \
		cdk_process.3 \
		cdk_radio.3 \
		cdk_scale.3 \
		cdk_screen.3 \
		cdk_scroll.3 \
		cdk_selection.3 \
		cdk_swindow.3 \
		cdk_template.3 \
		cdk_traverse.3 \
		cdk_util.3 \
		cdk_viewer.3

CDKREADME	= EXPANDING NOTES TODO COPYING INSTALL README

OBJECTS		= $(CDKSRC:.c=.o)
CDKSHOBJS	= $(CDKSRC:.c=.os)
LIB_OBJECT	= @LIB_OBJECT@

all sources :: $(AUTO_SRC)

$(OBJECTS) :	include/cdk_config.h

#
# Standard library directive.
#
all cdklib :: $(DEFAULT)

$(CDKLIB) :: $(OBJECTS)
	@echo creating $@; $(LIBTOOL_CREATE) $@ $(LIB_OBJECT)
	@$(RANLIB) $@

cdkshlib $(CDKSHLIB) :: $(CDKSHOBJS) headers.sed
	gcc -shared -Wl,-soname=$(SONAME) $(LDFLAGS) -o $(CDKSHLIB) $(CDKSHOBJS)

#
# Make the examples directory.
#
all examples ::
	cd examples && $(MAKE) $(MAKE_RECUR)

#
# Make the demos directory.
#
all demos ::
	cd demos && $(MAKE) $(MAKE_RECUR)

#
# Make the cli directory.
#
all cli ::
	cd cli && $(MAKE) $(MAKE_RECUR)

#
# Make the generated manpages.
#
all manpages :: $(AUTO_MAN)

# Order of install-targets should match the order of uninstalls.  Put the
# documentation first, then the headers, and finally the library:
#	(un)installCDKReadme
#	(un)installCDKManPages
#	(un)installCDKHeaderFiles
#	(un)installCDKLibrary

#
# This installs the informational readme files.
#
install \
installCDKReadme :: $(DOCUMENT_DIR)
	@echo "Installing CDK Readme files in $(DOCUMENT_DIR)..."
	@for i in $(CDKREADME); do \
	   echo "	... $$i"; \
	   $(INSTALL_DATA) $(srcdir)/$$i $(DOCUMENT_DIR)/$$i; \
	done

uninstall \
uninstallCDKReadme ::
	@echo "Uninstalling CDK Readme files from $(DOCUMENT_DIR)..."
	@- for i in $(CDKREADME); do \
	   $(RM) $(DOCUMENT_DIR)/$$i; \
	done

#
# This installs the CDK man pages.
#
install \
installCDKManPages :: headers.sed $(AUTO_MAN) $(MAN_DIR)
	@echo "Installing the CDK man pages in $(MAN_DIR) ..."
	@for i in $(AUTO_MAN); do \
	   $(SHELL) $(srcdir)/headers.sh -x "$(INSTALL_DATA)" -d $(MAN_DIR) -s . $$i; \
	   $(SHELL) $(srcdir)/manlinks.sh installing $(srcdir) $(MAN_DIR) $$i;  \
	done
	@for i in $(CDKMAN); do \
	   $(SHELL) $(srcdir)/headers.sh -x "$(INSTALL_DATA)" -d $(MAN_DIR) -s . $(srcdir)/man/$$i; \
	   $(SHELL) $(srcdir)/manlinks.sh installing $(srcdir) $(MAN_DIR) $(srcdir)/man/$$i;  \
	done

uninstall \
uninstallCDKManPages ::
	@echo "Uninstalling the CDK man pages from $(MAN_DIR) ..."
	@- for i in $(AUTO_MAN); do \
	   $(RM) $(MAN_DIR)/`basename $$i`; \
	   $(SHELL) $(srcdir)/manlinks.sh removing $(srcdir) $(MAN_DIR) $(srcdir)/$$i; \
	done
	@- for i in $(CDKMAN); do \
	   $(RM) $(MAN_DIR)/$$i; \
	   $(SHELL) $(srcdir)/manlinks.sh removing $(srcdir) $(MAN_DIR) $(srcdir)/man/$$i; \
	done

#
# This installs the header files.
#
install \
installCDKHeaderFiles :: headers.sed $(MY_HDR) $(INCLUDE_DIR)
	@echo "Installing CDK header files in $(INCLUDE_DIR)..."
	$(SHELL) $(srcdir)/headers.sh -x "$(INSTALL_DATA)" -d $(INCLUDE_DIR) -s $(srcdir) $(MY_HDR)
	@for i in $(CDKHDR); do \
	   $(SHELL) $(srcdir)/headers.sh -x "$(INSTALL_DATA)" -d $(INCLUDE_DIR) -s $(srcdir) include/$$i; \
	done

uninstall \
uninstallCDKHeaderFiles ::
	@echo "Uninstalling CDK header files from $(INCLUDE_DIR)..."
	@- for i in $(MY_HDR); do \
	   $(RM) $(INCLUDE_DIR)/`basename $$i`; \
	done
	@- for i in $(CDKHDR); do \
	   $(RM) $(INCLUDE_DIR)/$$i; \
	done

#
# This installs the CDK library.
#
install \
installCDKLibrary :: $(LIB_DIR) $(CDKLIB)
	@echo "Installing CDK library"
	@$(INSTALL_LIB) $(CDKLIB) $(LIB_DIR)/$(CDKLIB)

uninstall \
uninstallCDKLibrary ::
	@echo "Uninstalling CDK library"
	@- $(UNINSTALL_LIB) $(LIB_DIR)/$(CDKLIB) 

#
# This installs the CDK shared library.  The rules are for an RPM spec, and
# not of general interest.
#
installCDKSHLibrary :: $(LIB_DIR) $(CDKSHLIB)
	@echo "Installing CDK library"
	@echo "	$(INSTALL_DATA) $(CDKSHLIB) $(LIB_DIR)"
	@$(INSTALL_DATA) $(CDKSHLIB) $(LIB_DIR)
	@echo " ln -sf $(CDKSHLIB) $(LIB_DIR)/@LIB_PREFIX@@LIB_ROOTNAME@.so"
	@ln -sf $(CDKSHLIB) $(LIB_DIR)/@LIB_PREFIX@@LIB_ROOTNAME@.so

uninstall \
uninstallCDKSHLibrary ::
	@- $(RM) $(LIB_DIR)/@LIB_PREFIX@@LIB_ROOTNAME@.so
	@- $(RM) $(LIB_DIR)/$(CDKSHLIB) 

headers.sed : $(srcdir)/headers.sh
	$(SHELL) $(srcdir)/headers.sh -p CDK -c include/cdk_config.h -d $(INCLUDE_DIR) -s $(srcdir)/include -i -s include -i

@MAKE_LOWER_TAGS@tags :
@MAKE_LOWER_TAGS@	ctags *.[ch] */*.[ch]

@MAKE_LOWER_TAGS@TAGS :
@MAKE_LOWER_TAGS@	etags *.[ch] */*.[ch]

#
# Clean up after ourselves...
#
clean ::
	@- $(RM) -r autom4te.cache
	- $(LIBTOOL_CLEAN) $(RM) $(LIB_OBJECT) $(CDKLIB)
	- $(RM) *.i *.os $(CDKSHLIB)
	- $(RM) headers.sed core tags *~
	$(RM) $(AUTO_HDR)
	$(RM) $(AUTO_SRC)
	$(RM) $(AUTO_MAN)

realclean :: clean
	cd examples	&& $(MAKE) $(MAKE_RECUR) clean
	cd demos	&& $(MAKE) $(MAKE_RECUR) clean
	cd cli		&& $(MAKE) $(MAKE_RECUR) clean

#
# Use this to clean the distribution.
#
distclean :: realclean
	$(RM) config.cache config.log config.status
	cd examples	&& $(RM) Makefile
	cd demos	&& $(RM) Makefile
	cd cli		&& $(RM) Makefile
	$(RM) include/cdk_config.h
	$(RM) include/cdk_version.h
	$(RM) Makefile
	@- $(SHELL) -c 'if test "$(srcdir)" != . ; then \
			rmdir examples; \
			rmdir demos; \
			rmdir cli; \
			rmdir include; \
		fi'

#
# Standard .c to .o compile line.
#
.c.o:
@RULE_CC@
	@ECHO_CC@$(LIBTOOL_COMPILE) $(CC) $(CFLAGS) $(CPPFLAGS) -c $<

.c.i:
@RULE_CC@
	@ECHO_CC@$(CPP) $(CPPFLAGS) -E -C $< >$@

.c.os:
@RULE_CC@
	@ECHO_CC@$(CC) $(CFLAGS) $(CPPFLAGS) -c -fPIC $< -o $@	

man \
$(DOCUMENT_DIR) \
$(INCLUDE_DIR) \
$(LIB_DIR) \
$(MAN_DIR) : ; $(srcdir)/mkdirs.sh $@

#
# Files generated from templates:
#
GEN_SCALE	= $(SHELL) $(srcdir)/gen-scale.sh

SCALE_H		= $(srcdir)/include/gen-scale.h
SCALE_C		= $(srcdir)/gen-scale.c
SCALE_M		= $(srcdir)/man/gen-scale.3

include/dscale.h :	$(SCALE_H)
	$(GEN_SCALE) DSCALE DScale Double double $(SCALE_H) >$@
dscale.c :		$(SCALE_C) $(AUTO_HDR)
	$(GEN_SCALE) DSCALE DScale Double double $(SCALE_C) >$@
man/cdk_dscale.3 :	$(SCALE_M) man
	$(GEN_SCALE) DSCALE DScale Double double $(SCALE_M) >$@

include/fscale.h :	$(SCALE_H)
	$(GEN_SCALE) FSCALE FScale Float float $(SCALE_H) >$@
fscale.c :		$(SCALE_C) $(AUTO_HDR)
	$(GEN_SCALE) FSCALE FScale Float float $(SCALE_C) >$@
man/cdk_fscale.3 :	$(SCALE_M) man
	$(GEN_SCALE) FSCALE FScale Float float $(SCALE_M) >$@

include/scale.h :	$(SCALE_H)
	$(GEN_SCALE) SCALE Scale Int int $(SCALE_H) >$@
scale.c :		$(SCALE_C) $(AUTO_HDR)
	$(GEN_SCALE) SCALE Scale Int int $(SCALE_C) >$@
man/cdk_scale.3 :	$(SCALE_M) man
	$(GEN_SCALE) SCALE Scale Int int $(SCALE_M) >$@

include/uscale.h :	$(SCALE_H)
	$(GEN_SCALE) USCALE UScale Unsigned unsigned $(SCALE_H) >$@
uscale.c :		$(SCALE_C) $(AUTO_HDR)
	$(GEN_SCALE) USCALE UScale Unsigned unsigned $(SCALE_C) >$@
man/cdk_uscale.3 :	$(SCALE_M) man
	$(GEN_SCALE) USCALE UScale Unsigned unsigned $(SCALE_M) >$@

SLIDER_H	= $(srcdir)/include/gen-slider.h
SLIDER_C	= $(srcdir)/gen-slider.c
SLIDER_M	= $(srcdir)/man/gen-slider.3

include/fslider.h :	$(SLIDER_H)
	$(GEN_SCALE) FSLIDER FSlider Float float $(SLIDER_H) >$@
fslider.c :		$(SLIDER_C) $(AUTO_HDR)
	$(GEN_SCALE) FSLIDER FSlider Float float $(SLIDER_C) >$@
man/cdk_fslider.3 :	$(SLIDER_M) man
	$(GEN_SCALE) FSLIDER FSlider Float float $(SLIDER_M) >$@

include/slider.h :	$(SLIDER_H)
	$(GEN_SCALE) SLIDER Slider Int int $(SLIDER_H) >$@
slider.c :		$(SLIDER_C) $(AUTO_HDR)
	$(GEN_SCALE) SLIDER Slider Int int $(SLIDER_C) >$@
man/cdk_slider.3 :	$(SLIDER_M) man
	$(GEN_SCALE) SLIDER Slider Int int $(SLIDER_M) >$@

include/uslider.h :	$(SLIDER_H)
	$(GEN_SCALE) USLIDER USlider Unsigned unsigned $(SLIDER_H) >$@
uslider.c :		$(SLIDER_C) $(AUTO_HDR)
	$(GEN_SCALE) USLIDER USlider Unsigned unsigned $(SLIDER_C) >$@
man/cdk_uslider.3 :	$(SLIDER_M) man
	$(GEN_SCALE) USLIDER USlider Unsigned unsigned $(SLIDER_M) >$@


syntax highlighted by Code2HTML, v. 0.9.1