#******************************************************************************
#
# Filename:	~icurtis/src/mx/Makefile
#
# Description:	Makefile for libmx menu library
#
# Update History:   (most recent first)
#   I. Curtis   9-Apr-97 12:04 -- updated
#   I. Curtis   2-Feb-94 13:19 -- created
#
#******************************************************************************

LIBINCDIR = ${HOME}/lib/include
LIBOBJDIR = ${HOME}/lib/${HOSTTYPE}

LIBOBJS = -lX11
LIBINCS = 

SRCS = filesel.c buttons.c select.c request.c menu.c alert.c basic.c
OBJS = filesel.o buttons.o select.o request.o menu.o alert.o basic.o
INCS = basic.h alert.h menu.h request.h select.h buttons.h filesel.h

CC = gcc

#
# use the following CFLAGS for linux
CFLAGS = -O5 -g -pipe -Wall
IFLAGS = -I.

#
# use the following CFLAGS and IFLAGS for SunOS 4.1.1
#CFLAGS = -O5 -pipe -Wall -DSUNOS414
#IFLAGS = -I. -I${OPENWINHOME}/include

all : libmx.a libmx.h

#*****************************************************************************
#* 			Maintain Menu library                                *
#*****************************************************************************

basic.o : basic.c basic.h
	${CC} ${CFLAGS} -c ${IFLAGS} basic.c

alert.o : alert.c alert.h basic.h
	${CC} ${CFLAGS} -c ${IFLAGS} alert.c

menu.o : menu.c menu.h basic.h
	${CC} ${CFLAGS} -c ${IFLAGS} menu.c

request.o : request.c request.h basic.h
	${CC} ${CFLAGS} -c ${IFLAGS} request.c

select.o : select.c select.h menu.h basic.h
	${CC} ${CFLAGS} -c ${IFLAGS} select.c

buttons.o : buttons.c buttons.h menu.h basic.h
	${CC} ${CFLAGS} -c ${IFLAGS} buttons.c

pop_alert.o : pop_alert.c alert.h basic.h
	${CC} ${CFLAGS} -c ${IFLAGS} pop_alert.c

filesel.o : filesel.c filesel.h basic.h menu.h select.h
	${CC} ${CFLAGS} -c ${IFLAGS} filesel.c

libmx.a : ${OBJS} ${INCS}
	ar r libmx.a ${OBJS}
	ranlib libmx.a

libmx.h : ${INCS}
	cat ${INCS} > libmx.h

#*****************************************************************************
#* 			 Release the library                                 *
#*****************************************************************************
release : ${LIBOBJDIR}/libmx.a ${LIBINCDIR}/libmx.h

${LIBOBJDIR}/libmx.a : ${OBJS} ${INCS}
	ar r ${LIBOBJDIR}/libmx.a ${OBJS}
	ranlib ${LIBOBJDIR}/libmx.a

${LIBINCDIR}/libmx.h : ${INCS}
	cat ${INCS} > ${LIBINCDIR}/libmx.h

tar:
	tar -cvf libmx.tar Makefile ${SRCS} ${INCS} test_menu.c test_filesel.c
	
#*****************************************************************************
#* Test the library                                                          *
#*****************************************************************************
test_menu : test_menu.c libmx.a libmx.h
	${CC} ${CFLAGS} -o test_menu ${IFLAGS} test_menu.c libmx.a ${LIBOBJS}

test_filesel : test_filesel.c libmx.a libmx.h
	${CC} ${CFLAGS} -o test_filesel ${IFLAGS} test_filesel.c libmx.a ${LIBOBJS}

#*****************************************************************************
# Keep it clean
#*****************************************************************************
clean ::
	/bin/rm -f *.o

clobber :: clean
	/bin/rm -f libmx.a libmx.h test_menu test_filesel *~
