/*   CrossFire, A Multiplayer game for X-windows
 *
 *   $Id: Imakefile,v 1.9 1993/04/12 18:55:58 frankj Exp $
 *
 *   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/crossfire.tmpl"

MAKE = make
#define IHaveSubdirs
/* #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' */
/* #define PassCDebugFlags It's set in crosssite.def now */

SUBDIRS = utils config common server client crossedit doc include lib

AllTarget(emptyrule)

PackArchieve($(VERSION))

MakeArchieve($(SUBDIRS))

InsertArchieve(Imakefile README CREDITS DONE TODO License,.)

World::
	@echo "make World not supported"
	@exit 1
	@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
	$(MAKE) $(MKFLAGS) autoinstall
	@echo ""
	@date
	@echo ""
	@echo "Complete build of crossfire (hopefully) finished."
	@echo ""

#ifdef AutoInstall
autoinstall:
	$(MAKE) $(MKFLAGS) install
#else
autoinstall:
	@echo "(AutoInstall disabled)"
#endif

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 cvf $(VERSION).maps.tar lib/README lib/archetypes lib/treasures lib/mapindex lib/motd lib/maps
	compress $(VERSION).maps.tar

dist: archive

shar:
	$(RM) $(VERSION).shar.*
	shar -n $(VERSION) -a -s frankj@ifi.uio.no -c -o $(VERSION).shar -L50 $(ALL_FILES) lib bitmaps

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
