# @(#)$Mu: mgv/GNUmakefile,v 1.88 $

##
## GNUmakefile
##	GNU Makefile for mgv.
##
## Copyright (C) 1996  Eric A. Howe
##
## 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., 675 Mass Ave, Cambridge, MA 02139, USA.
##
##   Authors:	Matthew D. Francey
##		Eric A. Howe (mu@trends.net)
##

##
## This Makefile requires GNU Make
##

##
## get things that everyone might need
##
include	make/top.mk

##
## get the system dependent definitions
##
include	make/sys.mk

##
## define the mgv specific things (you shouldn't have to touch these)
##
subdirs = tools wlib doc
csrcs   = $(wildcard [A-Za-z]*.c)
objs    = $(subst .c,.o,$(csrcs)) _ad.o _switch_help.o

incl     := -I$(top)/wlib $(incl)
dflags   += $(defs) $(incl)
ldflags  := -L$(top)/wlib $(ldflags)
mgv-libs  = -lwlib
exe       = mgv
mgv-deps  = $(top)/wlib/libwlib.a .toplevel.mk
appdef    = MGv
rclean   += mgv.1 .initted ,LOG
clean    += mgv.man.in.bak

spellcheck-t = mgv.man.in

all:: .initted

all:: mgv.1

all:: res.m4

res.m4: doc/mgv.sg
	$(top)/tools/mkresm4 --prefix=mgv --output=res.m4 $<

##
## we need to generate the fixdep script before doing deps
## in wlib
##
rdep:: .initted
dep:: .initted
.initted:
	$(MAKE) -C tools all
	@touch .initted

##
## get the rules so we can do something
##
include	make/rules.mk
include make/switch_help.mk
include make/man.mk

##
## I keep the generated strdefs.[ch] files around all the time to avoid
## problems during "make dep".  I maintain them by hand since they don't
## change very much.
##
strdefs:
	tools/mkstrdefs mine/strdefs.h.in strdefs.c.in mine/strdefs.h strdefs.c

##
## support for making tar.gz files
##
include make/tar.mk

all:: .been_warned
.been_warned:: GNUmakefile
	@echo
	@echo "Please delete any old MGv application defaults files"
	@echo "you have before running MGv.  If you don't want to"
	@echo "delete them yet, you can run MGv like this:"
	@echo
	@echo "        XENVIRONMENT=./MGv ./mgv"
	@echo
	@echo "To test things out."
	@echo
	@touch .been_warned

install::
	@echo
	@echo "The application defaults file goes in $(libdir)"
	@echo "now (I got hit with a version conflict so I moved"
	@echo "it); if you installed an earlier release of MGv,"
	@echo "you should delete the old application defaults file."
	@echo

##
## include dependency file if you've got one, there's no need to
## bother with this unless you are hacking the source
##
-include .depend
