/*   CrossFire, A Multiplayer game for X-windows
 *
 *   $Id: Imakefile,v 1.15 1995/04/15 03:03:27 master Exp master $
 *
 *   Copyright (C) 1992 Frank Tore Johansen
 *
 *   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.
 *
 *   The author can be reached via e-mail to frankj@ifi.uio.no.
 */

IMAKE_DEFINES=-I$(NEWTOP)/.. -I$(NEWTOP)/config -I$(NEWTOP)
#include "config/crosssite.def"
#include "config/crossfire.tmpl"

MAKE = make
#define IHaveSubdirs

SUBDIRS = common doc server client utils crossedit include config lib

FILES = CHANGES CREDITS DEVELOPERS DONE Imakefile INSTALL License README \
	TODO TODO.soon 

AllTarget(emptyrule)

World::
	@echo ""
	@echo "Starting to build crossfire.  Time to start praying 8)"
	@echo ""
	@date
	@echo ""
	$(XMKMF)
	make Makefiles
	$(MAKE) $(MFLAGS) clean
	$(MAKE) $(MFLAGS) includes
	$(MAKE) $(MFLAGS) depend
	$(MAKE) $(MFLAGS) all
	@echo ""
	@date
	@echo ""
	@echo "Complete build of crossfire (hopefully) finished."
	@echo ""


MakeSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS))

relink:
	$(RM) server/crossfire
	$(RM) client/crossclient
	$(RM) crossedit/crossedit
	$(RM) images/xbmtobdf
	$(MAKE) $(MKFLAGS) all

ifi:
	(cd common; $(MAKE) $(MKFLAGS) all)
	(cd server; $(MAKE) $(MKFLAGS) ifi)
	(cd client; $(MAKE) $(MKFLAGS) ifi)
/*	(cd crossedit; $(MAKE) $(MKFLAGS) ifi)*/
	(cd images; $(MAKE) $(MKFLAGS) install)

maps:
	$(RM) $(VERSION).maps.tar.Z $(VERSION).maps.tar
	tar cvfh $(VERSION).maps.tar lib/README lib/archetypes lib/artifacts lib/treasures lib/mapindex lib/motd lib/maps lib/rplay.conf lib/sounds
	compress $(VERSION).maps.tar

PackArchive($(VERSION))

MakeArchive($(SUBDIRS))

InsertArchive($(FILES),.)

dist: archive

shar: /* Doesn't work anymore */
	$(RM) $(VERSION).shar.*
	shar -n $(VERSION) -a -s frankj@ifi.uio.no -c -o $(VERSION).shar -L50 $(FILES) $(SUBDIRS)

proto:
	(cd common; make proto)
	(cd client; make proto)
	(cd server; make proto)
	(cd crossedit; make proto)

clean::
	(cd include; $(RM) *~ *proto.h.orig)
	(cd crossedit; $(RM) *proto.h.orig)
	(cd client; $(RM) *proto.h.orig)

distclean: clean
	$(RM) */Makefile Makefile

love::
	@echo UmuwzG niCtB.  Kwzm lCuxml. | tr I-Za-zA-H A-Za-z
