#
# $XFree86: xc/lib/Xft/Makefile.in,v 1.4 2002/05/31 07:01:49 keithp Exp $
#
# Copyright � 2002 Keith Packard, member of The XFree86 Project, Inc.
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of Keith Packard not be used in
# advertising or publicity pertaining to distribution of the software without
# specific, written prior permission.  Keith Packard makes no
# representations about the suitability of this software for any purpose.  It
# is provided "as is" without express or implied warranty.
#
# KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
# EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
# DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
#

SHELL = @SHELL@

srcdir=@srcdir@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
bindir=@bindir@
datadir=@datadir@
includedir=@includedir@
sysconfdir=@sysconfdir@

CDEBUGFLAGS=@CFLAGS@
CPPFLAGS=@CPPFLAGS@
DEFS=@DEFS@

DSO_LDOPTS=@DSO_LDOPTS@
DSO_CFLAGS=@DSO_CFLAGS@
DSO_PIC_CFLAGS=@DSO_PIC_CFLAGS@

INCLUDES=-I.

CFLAGS=$(CDEBUGFLAGS) $(INCLUDES) $(DEFS) $(CPPFLAGS)

INSTALL=@INSTALL@
INSTALL_PROGRAM=@INSTALL_PROGRAM@
INSTALL_SCRIPT=@INSTALL_SCRIPT@
INSTALL_DATA=@INSTALL_DATA@
MKSHLIB=@MKSHLIB@
LN_S=@LN_S@

X_FONT_DIR=@X_FONT_DIR@
FC_DEFAULT_FONTS=@FC_DEFAULT_FONTS@

# shared libraries
LIBDIR=$(libdir)
# programs
BINDIR=$(bindir)
# include files
INCLUDEDIR=$(includedir)/X11/Xft

LIBBASE=libXft.so
LIBFILE=$(LIBBASE).@PACKAGE_MAJOR@.@PACKAGE_MINOR@
LIBMAJOR=$(LIBBASE).@PACKAGE_MAJOR@

LIBS=@LIBS@

SRCS=xftcolor.c \
     xftcore.c \
     xftdbg.c \
     xftdpy.c \
     xftdraw.c \
     xftextent.c \
     xftfont.c \
     xftfreetype.c \
     xftglyphs.c \
     xftinit.c \
     xftlist.c \
     xftname.c \
     xftrender.c \
     xftstr.c \
     xftswap.c \
     xftxlfd.c
     
OBJS=xftcolor.@OBJEXT@ \
     xftcore.@OBJEXT@ \
     xftdbg.@OBJEXT@ \
     xftdpy.@OBJEXT@ \
     xftdraw.@OBJEXT@ \
     xftextent.@OBJEXT@ \
     xftfont.@OBJEXT@ \
     xftfreetype.@OBJEXT@ \
     xftglyphs.@OBJEXT@ \
     xftinit.@OBJEXT@ \
     xftlist.@OBJEXT@ \
     xftname.@OBJEXT@ \
     xftrender.@OBJEXT@ \
     xftstr.@OBJEXT@ \
     xftswap.@OBJEXT@ \
     xftxlfd.@OBJEXT@
     
HEADERS=Xft.h \
       XftCompat.h \
       xftint.h

.c.@OBJEXT@:
	$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) -c $< -o $@
	
all:: $(LIBFILE) $(LIBMAJOR) $(LIBBASE)

#
# Build the library
#
$(LIBFILE): $(OBJS)
	rm -f $@
	$(MKSHLIB) $(OBJS) $(LIBS)

$(LIBMAJOR): $(LIBFILE)
	rm -f  $@
	$(LN_S) $(LIBFILE) $(LIBMAJOR)

$(LIBBASE): $(LIBMAJOR)
	rm -f $@
	$(LN_S) $(LIBMAJOR) $(LIBBASE)

$(OBJS): $(HEADERS)

#
# install directories
#

install:: $(DESTDIR)$(LIBDIR) $(DESTDIR)$(LIBDIR)/pkgconfig
install:: $(DESTDIR)$(INCLUDEDIR) $(DESTDIR)$(BINDIR)

$(DESTDIR)$(LIBDIR):
	mkdir -p $@

$(DESTDIR)$(LIBDIR)/pkgconfig:
	mkdir -p $@

$(DESTDIR)$(INCLUDEDIR):
	mkdir -p $@

$(DESTDIR)$(BINDIR):
	mkdir -p $@

#
# install library
#

install:: $(DESTDIR)$(LIBDIR)/$(LIB) $(DESTDIR)$(LIBDIR)/$(LIBMAJOR) 
install:: $(DESTDIR)$(LIBDIR)/$(LIBBASE)

$(DESTDIR)$(LIBDIR)/$(LIBFILE): $(LIBFILE)
	$(INSTALL_PROGRAM) $< $(DESTDIR)$(LIBDIR)

$(DESTDIR)$(LIBDIR)/$(LIBMAJOR): $(DESTDIR)$(LIBDIR)/$(LIBFILE)
	rm -f  $@
	$(LN_S) $(LIBFILE) $(DESTDIR)$(LIBDIR)/$(LIBMAJOR)

$(DESTDIR)$(LIBDIR)/$(LIBBASE): $(DESTDIR)$(LIBDIR)/$(LIBMAJOR)
	rm -f  $@
	$(LN_S) $(LIBMAJOR) $(DESTDIR)$(LIBDIR)/$(LIBBASE)

#
# install xft-config script
#

install:: $(DESTDIR)$(BINDIR)/xft-config

$(DESTDIR)$(BINDIR)/xft-config: xft-config
	$(INSTALL_SCRIPT) $< $(DESTDIR)$(BINDIR)

#
# install pkgconfig control file
#

install:: $(DESTDIR)$(LIBDIR)/pkgconfig/xft.pc

$(DESTDIR)$(LIBDIR)/pkgconfig/xft.pc: xft.pc
	$(INSTALL_DATA) $< $(DESTDIR)$(LIBDIR)/pkgconfig


# 
# install header files
#

install::$(DESTDIR)$(INCLUDEDIR)/Xft.h $(DESTDIR)$(INCLUDEDIR)/XftCompat.h

$(DESTDIR)$(INCLUDEDIR)/Xft.h: Xft.h
	$(INSTALL_DATA) $< $(DESTDIR)$(INCLUDEDIR)

$(DESTDIR)$(INCLUDEDIR)/XftCompat.h: XftCompat.h
	$(INSTALL_DATA) $< $(DESTDIR)$(INCLUDEDIR)

#
# delete generated files
#
clean::
	rm -f $(LIBFILE) $(LIBMAJOR) $(LIBBASE) $(OBJS)
