#
# Makefile for the GNU LessTif clients
#
# Copyright (C) 1995 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@
VPATH=$(srcdir)
EXTRALIBS=@extralibs@

x_libraries=@x_libraries@
x_includes=@x_includes@

CC=@CC@
YACC=@YACC@
LEX=@LEX@
LEXLIB=@LEXLIB@
CFLAGS=-I$(srcdir) -I../../../include -I$(srcdir)/../../../include/Motif-1.2 ${x_includes} @CFLAGS@ \
	-DXLIB_PATH=\"@x_lib_path@\" -DXINCL_PATH=\"@x_inc_path@\"

CLIENTS=mwm
MOTIFCLIENTS=mwm.motif

SRCS= \
    colormaps.c \
    cursors.c \
    decorate.c \
    defaults.c \
    desktop.c \
    events.c \
    functions.c \
    icons.c \
    menus.c \
    misc.c \
    move.c \
    mwm.c \
    mwmerr.c \
    mwmparse.c \
    mwmlex.c \
    pager.c \
    pan.c \
    props.c \
    resize.c \
    resources.c \
    screens.c \
    windows.c

OBJS=@objs_pat_subst@

@client_include@

X_LIBRARY=-lXext -lX11

clean:
	rm -f $(OBJS) $(CLIENTS) $(MOTIFCLIENTS) *~ core *.bak *.BAK \
              $(srcdir)/mwmparse.c $(srcdir)/mwmlex.c $(srcdir)/y.tab.h $(srcdir)/y.output $(srcdir)/version.h .stamp-version

mwm: version.h $(OBJS)
	$(CC) -o ${@} ${OBJS} ../lib/libltc.a ${xm_library} ${x_libraries} ${LEXLIB} ${EXTRALIBS}

mwm.motif: version.h $(OBJS)
	$(CC) -o ${@} ${OBJS} ../lib/libltc.a ${motif_xm_library} ${x_libraries} ${LEXLIB} ${EXTRALIBS}

$(srcdir)/mwmparse.c $(srcdir)/y.tab.h: mwmparse.y
	cd $(srcdir) && $(YACC) -v -d mwmparse.y
	mv -f $(srcdir)/y.tab.c $(srcdir)/mwmparse.c

$(srcdir)/mwmlex.c: mwmlex.l
	cd $(srcdir) && $(LEX) -v mwmlex.l && mv lex.yy.c mwmlex.c

mwm.o: version.h

mwmlex.o: y.tab.h

version.h $(srcdir)/version.h: Makefile
	echo "#define VERSION \"@major_shared@.@minor_shared@\"" > $(srcdir)/version.h

