#
#   libmodem library, a modem control facility.
#
#   Makefile
#
#   Copyright (C) 1994, 1995  Riccardo Facchetti
#
#   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.
#
#   You can contact the author at this e-mail address:
#
#   riccardo@cdc8g5.cdc.polimi.it
#
#
# Makefile for lib/ss
#

include CONFIG.MAKE

CFLAGS= -I. $(CCFLAGS) $(DEBUG) -DLIBRARY
MANFIN= $(MANDIR)/man$(MANEXT)

# for the library

LIB=	libmodem.a

OBJS=	modems.o mdmerrno.o line_manage.o mdmlock.o mdmlog.o

SRCS=	modems.c mdmerrno.c line_manage.c mdmlock.c mdmlog.c

#
# stuff to build
#

.c.o:
	$(CC) $(CFLAGS) -c $*.c

all:	$(LIB)

dep depend .depend:
	$(CPP) -M $(CFLAGS) *.c >.depend

$(LIB): $(OBJS)
	$(RM) $@.bak
	-$(MV) $@ $@.bak
	$(AR) $@ $(OBJS)
	$(RANLIB) $@

test: libmodem.a
	$(CC) $(CFLAGS) -o call call.c $(LIB)

install: libmodem.a
	$(INSTALL) -m 755 -d $(LIBDIR)
	$(INSTALL) -m 755 -d $(MANFIN)
	$(INSTALL) -m 755 -d $(INCDIR)
	$(INSTALL) -o bin -g bin -m 644 libmodem.a $(LIBDIR)
	$(INSTALL) -o bin -g bin -m 644 dial/modems.h $(INCDIR)
	$(INSTALL) -o bin -g bin -m 644 dial/mdmerrno.h $(INCDIR)
	$(INSTALL) -o bin -g bin -m 644 doc/modems.man $(MANFIN)/modems.$(MANEXT)

clean:
	$(RM) *.o *~ \#* *.bak core call
	(cd etc; rm -f *.bak)
	(cd dial; rm -f *.bak)
	(cd doc; rm -f *.bak)

distclean: clean
	$(RM) $(LIB) .depend

ifeq (.depend,$(wildcard .depend))
include .depend
endif
