#*++
#COPYRIGHT:
#This file is part of the GSM Suite, a set of programs for
#manipulating state machines in a graphical fashion.
#Copyright (C) 1996, 1997  G. Andrew Mangogna.
#
#LICENSE:
#This program is free software; you can redistribute it and/or
#modify it under the terms of the GNU General Public License
#as published by the Free Software Foundation; either version 2
#of the License, or (at your option) any later version.
#
#This program 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 General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the
#Free Software Foundation, Inc.,
#59 Temple Place - Suite 330,
#Boston, MA  02111-1307, USA.
#
#MODULE:
#	Makefile for the "gsmcheck" program.
#
#$RCSfile: Makefile,v $
#$Revision: 1.6 $
#$Date: 1997/07/18 04:31:57 $
#
#ABSTRACT:
#
#MODIFICATION HISTORY:
#$Log: Makefile,v $
#Revision 1.6  1997/07/18 04:31:57  andrewm
#Changes to makefiles in preparation for final build.
#
#Revision 1.5  1997/07/14 02:30:33  andrewm
#Checkpoint.  Rework makefiles.  Rework man pages.  Fixed PostScript problems.
#
#*--

BASEDIR	=	/usr
BINDIR	=	$(BASEDIR)/bin
MANDIR	=	$(BASEDIR)/man/man1

SRCS	= \
		gsmcheck.cc \
		$(NULL)
OBJS	=	$(SRCS:%.cc=%.o)
TARGET	=	$(SRCS:%.cc=%)
GSMLIBS		= \
			machvisit \
			machbase \
			machcommon \
			chio \
			$(NULL)

CXXFLAGS	=	-m486 -g -O
CPPFLAGS	+=	$(foreach dir,$(GSMLIBS),-I../$(dir))

CLEANFILES	= \
			*.o \
			.*.d \
			a.out \
			core \
			Makefile.bak \
			$(TARGET) \
			$(NULL)

LIBDEPEND	=	$(foreach lib,$(GSMLIBS),../$(lib)/lib$(lib).a)
LIBFILES	= \
			$(GSMLIBS) \
			m \
			c \
			$(NULL)
LDFLAGS		=	$(foreach dir,$(GSMLIBS),-L../$(dir))
LOADLIBES	=	$(LIBFILES:%=-l%)

.PHONEY : all clean install installbin installman uninstall \
			uninstallbin uninstallman

$(TARGET) : $(OBJS) $(LIBDEPEND)
	g++ -o $(TARGET) $(LDFLAGS) $(OBJS) $(LOADLIBES)

clean:
	$(RM) $(CLEANFILES)

install: installbin installman

installbin : $(TARGET)
	install -s -m 555 $(TARGET) $(BINDIR)

installman: $(TARGET).1
	install -m 444 $(TARGET).1 $(MANDIR)

uninstall: uninstallbin uninstallman

uninstallbin : $(TARGET)
	$(RM) $(BINDIR)/$(TARGET)

uninstallman: $(TARGET).1
	$(RM) $(MANDIR)/$(TARGET).1

.%.d : %.cc
	@$(SHELL) -ec '$(CXX) -MM $(CPPFLAGS) $< \
		| sed '\''s/\($*\.o\)[ :]*/\1 $@ : /g'\'' > $@'

include $(SRCS:%.cc=.%.d)
