# $Id: makefile.in,v 1.13 2000/04/24 01:01:42 tom Exp $
# template makefile for DIALOG
#
SHELL		= /bin/sh

VERSION		= `cat VERSION`

prefix		= /usr/local
exec_prefix	= ${prefix}

srcdir		= .
top_builddir	= .

DESTDIR		=
bindir		= $(DESTDIR)${exec_prefix}/bin
libdir		= $(DESTDIR)${exec_prefix}/lib
mandir		= $(DESTDIR)${prefix}/man
MANDIR		= $(mandir)/man1

# see po/makefile
localedir       = $(prefix)/share/locale

CFLAGS		= -g -O2
CPPFLAGS	=  -DHAVE_CONFIG_H -I. -I$(srcdir) -DLOCALEDIR=\"$(localedir)\" -DVERSION=\"$(VERSION)\"
EXTRA_CFLAGS	= 
CC		= gcc
LDFLAGS		= 
LIBS		= -lpdcurses  # 
RANLIB		= :

RM		= rm -f

INSTALL		= ./install-sh -c
INSTALL_PROGRAM	= ${INSTALL}
INSTALL_DATA	= ${INSTALL} -m 644

#
# Standard .c to .o compile line.
#
.c.o:
# compiling
	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CPPFLAGS) -c $<

EXTRAOBJS =  guage.o tailbox.o
OBJS = $(EXTRAOBJS) \
	arrows.o \
	buttons.o \
	checklist.o \
	inputbox.o \
	inputstr.o \
	menubox.o \
	mousewget.o \
	msgbox.o \
	textbox.o \
	util.o \
	yesno.o

SRCS = $(OBJS:.o=.c)

LIB	= libdialog.a
PROG	= dialog
ALL	= $(LIB) $(PROG)

DIRS	= $(bindir) $(MANDIR)

all	:: $(ALL)

:
	@echo "Building GNU gettext library..."
	@cd intl && $(MAKE) 

$(OBJS) : $(srcdir)/dialog.h config.h

$(LIB) : $(OBJS)
	ar crv $(LIB) $(OBJS)
	$(RANLIB) $@

dialog: $(LIB) dialog.o # 
	$(CC) -o $@ dialog.o -L. -ldialog $(LDFLAGS) $(LIBS)

clean	::
#	@-test -f intl/Makefile && cd intl && $(MAKE)  $@
#	@-test -f po/Makefile && cd po && $(MAKE)  $@
	rm -f core *.o *~ $(ALL)

distclean :: clean
#	@-test -f intl/Makefile && cd intl && $(MAKE)  $@
#	@-test -f po/Makefile && cd po && $(MAKE)  $@
	rm -f intl/libintl.h intl/po2tbl.sed
	rm -f makefile config.h config.cache config.log config.status

install :: $(ALL) $(DIRS)
#	@-test -f intl/Makefile && cd intl && $(MAKE)  $@
#	@-test -f po/Makefile && cd po && $(MAKE)  $@
	$(INSTALL_PROGRAM) -s $(PROG) $(bindir)
	$(INSTALL_DATA) dialog.1 $(MANDIR)

uninstall ::
#	@-test -f intl/Makefile && cd intl && $(MAKE)  $@
#	@-test -f po/Makefile && cd po && $(MAKE)  $@
	rm -f $(bindir)/$(PROG)
	rm -f $(MANDIR)/dialog.1

$(bindir) \
$(MANDIR) : ; $(srcdir)/mkdirs.sh $@
