#
SHELL=/bin/sh

@SET_MAKE@

top_srcdir=@top_srcdir@
srcdir=@srcdir@
prefix=@prefix@
exec_prefix=@exec_prefix@
bin_dir=@exec_prefix@/bin
x_includes=@x_includes@
x_libraries=@x_libraries@
fvwm_icons=@fvwm_icons@
fvwm_rc=@fvwm_rc@
fvwm_name=@fvwm_name@
#
# This is where the modules will be installed
fvwm_dir=@prefix@/lib/X11/@fvwm_name@
man_dir=@prefix@/man/man1

#
# Libs
X_LIBRARY=-lX11 @LIBS@
XEXT_LIBRARY=-lXext
XPM_LIBRARY=-lXpm
FVWM_LIBRARY=-l${fvwm_name}
LIBS=-L${top_srcdir}/libs ${x_libraries} ${FVWM_LIBRARY} ${XPM_LIBRARY} ${XEXT_LIBRARY} ${X_LIBRARY}

PATH_DEFINES=-DFVWM_ICONDIR=\"${fvwm_icons}\" \
               -DFVWMDIR=\"${fvwm_dir}\" \
               -DFVWMRC=\"${fvwm_rc}\"

EXTRA_DEFINES=-DXPM -DSHAPE ${PATH_DEFINES}

CC=@CC@
INCLUDES=-I${top_srcdir}/include ${x_includes}
CFLAGS=${INCLUDES} @CFLAGS@ ${EXTRA_DEFINES} 
MAKEDEPEND=@MAKEDEPEND@
INSTALL=@INSTALL@
INSTALL_PROGRAM=@INSTALL_PROGRAM@
INSTALL_DATA=@INSTALL_DATA@
RM=@RM@

PROG=${fvwm_name}

SRCS=add_window.c \
       bindings.c \
       borders.c \
       builtins.c \
       colormaps.c \
       colors.c \
       complex.c \
       decorations.c \
       events.c \
       focus.c \
       functions.c \
       fvwm.c \
       icons.c \
       menus.c \
       misc.c \
       module.c \
       move.c \
       placement.c \
       read.c \
       resize.c \
       style.c \
       virtual.c \
       windows.c
 
OBJS=add_window.o \
       bindings.o \
       borders.o \
       builtins.o \
       colormaps.o \
       colors.o \
       complex.o \
       decorations.o \
       events.o \
       focus.o \
       functions.o \
       fvwm.o \
       icons.o \
       menus.o \
       misc.o \
       module.o \
       move.o \
       placement.o \
       read.o \
       resize.o \
       style.o \
       virtual.o \
       windows.o

all: ${PROG}

depend:
	${MAKEDEPEND} ${CFLAGS} ${SRCS}

install: all
	@mkdir -p ${bin_dir}
	${INSTALL_PROGRAM} ${PROG} ${bin_dir}
	@mkdir -p ${man_dir}
	${INSTALL_DATA} ${PROG}.man ${man_dir}/${PROG}.1 

uninstall: 
	${RM} ${bin_dir}/${PROG}
	${RM} ${man_dir}/${PROG}.1

clean:
	${RM} ${PROG} ${OBJS} *~ core *.bak

distclean: clean


${PROG}: ${OBJS}
	${CC} -o ${PROG} ${OBJS} ${LIBS}

#
