#
# Makefile for the GNU LessTif library (lib/Xm-CDE directory)
#
# Copyright (C) 1997 Free Software Foundation, Inc.
#
# This file is part of the GNU LessTif Library.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#

srcdir=@srcdir@
prefix=@prefix@
exec_prefix=@exec_prefix@
lib_dir = @exec_prefix@/lib

VPATH = $(srcdir)

x_includes=@x_includes@

major_shared=@major_shared@
minor_shared=@minor_shared@
lib_name=Xm

CC=@CC@
CFLAGS=-I$(srcdir)/../../include/Motif-CDE -I$(srcdir)/../../include/Motif-1.2 -I../../include ${x_includes} @CFLAGS@
RANLIB=@RANLIB@
AR=@AR@
INSTALL=@INSTALL@
INSTALL_DATA=@INSTALL_DATA@

STATIC_LIB = lib${lib_name}.a

SRCS12 = ArrowB.c \
       ArrowBG.c \
       AtomMgr.c \
       BaseClass.c \
       BulletinBoard.c \
       Cache.c \
       CascadeB.c \
       CascadeBG.c \
       Command.c \
       CutPaste.c \
       DebugUtil.c \
       Desktop.c \
       Dest.c \
       DialogS.c \
       Display.c \
       DragBS.c \
       DragC.c \
       DragDrop.c \
       DragIcon.c \
       DragOverS.c \
       DragUnder.c \
       DrawingArea.c \
       DrawnB.c \
       DropSMgr.c \
       DropTrans.c \
       ExtObject.c \
       FileSB.c \
       FontList.c \
       Form.c \
       Frame.c \
       Gadget.c \
       GadgetUtil.c \
       GeoUtils.c \
       Hash.c \
       ImageCache.c \
       LTEditres.c \
       LTfnmatch.c \
       LTglob.c \
       Label.c \
       LabelG.c \
       List.c \
       MapEvent.c \
       MainW.c \
       Manager.c \
       MenuShell.c \
       MenuUtil.c \
       MessageB.c \
       Messages.c \
       Mwm.c \
       PanedW.c \
       Primitive.c \
       Protocols.c \
       PushB.c \
       PushBG.c \
       ReadImage.c \
       Region.c \
       RepType.c \
       ResConvert.c \
       ResInd.c \
       RowColumn.c \
       Sash.c \
       Scale.c \
       Screen.c \
       ScrollBar.c \
       ScrolledW.c \
       Selection.c \
       SelectionBox.c \
       Separator.c \
       SeparatoG.c \
       Shadow.c \
       ShellExt.c \
       Simple.c \
       TearOff.c \
       TearOffB.c \
       Text.c \
       TextF.c \
       TextIn.c \
       TextOut.c \
       TextStrSo.c \
       ToggleB.c \
       ToggleBG.c \
       TrackLoc.c \
       Traversal.c \
       TravAct.c \
       UniqueEvent.c \
       VaSimple.c \
       Vendor.c \
       VirtKeys.c \
       Visual.c \
       World.c \
       XmString.c \
       XmIm.c \
       XmXpm.c \
       Xmos.c \
       misc.c alloca.c gdb-inline.c

EXTRA12 = \
	inlines.in mkinline.c

SRCS_CDE = \
	ComboBox.c \
	SpinButton.c

SRCS   = ${SRCS12} ${SRCS_CDE}

OSRCS12= ${SRCS12:%=$(srcdir)/../Xm/%}

SRCDIR_SRCS=@srcdir_src_pat_subst@
OBJS= @objs_pat_subst@
SH_OBJS= @shobjs_pat_subst@

all::	links

@obj_rule1@
@obj_rule2@
@obj_rule3@
@obj_rule4@

@static_prefix@all:: ${STATIC_LIB}

@static_prefix@install:: ${STATIC_LIB}
@static_prefix@	-mkdir -p ${lib_dir}
@static_prefix@	${INSTALL_DATA} ${STATIC_LIB} ${lib_dir}

@static_prefix@clean::
@static_prefix@	rm -f ${OBJS} ${STATIC_LIB}
clean::
	rm -f *~ core *.bak *.o shared/*.o libXm.* mkinline \
		$(srcdir)/gdb-inline.c

distclean: clean

# Rules for building the static library

@static_prefix@${STATIC_LIB}: ${OBJS}
@static_prefix@	${AR} cr ${STATIC_LIB} ${OBJS}
@static_prefix@	${RANLIB} ${STATIC_LIB}

# Rules for building the shared library

@shared_include@

@shared_rule1@
@shared_rule2@
@shared_rule3@
@shared_rule4@

# for depending

depend: ${SRCDIR_SRCS}
#	makedepend -- ${CFLAGS} -- ${SRCDIR_SRCS} 
	makedepend -a -pshared/ -- ${CFLAGS} -- ${SRCDIR_SRCS}

mkinline:	$(srcdir)/mkinline.c
	${CC} ${CFLAGS} -o $@ $(srcdir)/mkinline.c

$(srcdir)/gdb-inline.c:	inlines.in mkinline
	./mkinline $(srcdir)/inlines.in $(srcdir)/gdb-inline.c

links:
	@for i in ${SRCS12} ${EXTRA12}; do \
	  if [ ! -r $(srcdir)/$$i ]; then \
	    ln -s $(srcdir)/../Xm/$$i $(srcdir) ;\
	  fi ;\
        done

clean::
	@for i in ${SRCS12} ${EXTRA12}; do \
	  rm -f $(srcdir)/$$i ;\
        done
