/*   CrossFire, A Multiplayer game for X-windows
 *
 *   $Id: Imakefile,v 1.6 1993/04/25 16:33:05 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.
 */

#include "../config/crossfire.tmpl"

INCLUDES = -I../include

/* LOCAL_LDFLAGS = -L../common SGI doesn't understand this */
LOCAL_LIBRARIES = -L../common -lcross -lX11

#ifdef OSFArchitecture
LOCAL_LIBRARIES = $(LOCAL_LIBRARIES) -lbsd
TARGET = -Dosf1
#endif

DEFINES = -DFONTDIR=\"${FONTDIR}\" -DFONTNAME=\"$(FONTNAME)\" $(TARGET) \
	-DLIBDIR=\"$(C_LIBDIR)\" $(COMPRESS_DEF)

OBJS = \
	apply.o\
	attack.o\
	daemon.o\
	hiscore.o\
	init.o\
	input.o\
	login.o\
	main.o\
	monster.o\
	move.o\
	obwin.o\
	pets.o\
	player.o\
	shop.o\
	socket.o\
	spells.o\
	swamp.o\
	swap.o\
	time.o\
	xio.o

SRCS = \
	apply.c\
	attack.c\
	daemon.c\
	hiscore.c\
	init.c\
	input.c\
	login.c\
	main.c\
	monster.c\
	move.c\
	obwin.c\
	pets.c\
	player.c\
	shop.c\
	socket.c\
	spells.c\
	swamp.c\
	swap.c\
	time.c\
	xio.c

PROGRAMS = crossfire

BINDIR = $(C_BINDIR)

ComplexProgramTarget(crossfire)

install_dirs:
	test -d $(C_BINDIR) || mkdir $(C_BINDIR)

install_bin: crossfire install_dirs
	$(MV) crossfire $(C_BINDIR)

install_bitmaps: bitmaps
	rm -rf $(C_LIBDIR)/bitmaps
	cp -r bitmaps $(C_LIBDIR)/bitmaps

install_lib: bmaps install_bitmaps
	rm -f $(C_LIBDIR)/bmaps
	$(CP) bmaps $(C_LIBDIR)/bmaps

clean:: distclean

cvsclean:: distclean
	$(RM) Makefile

distclean::
	$(RM) crossfire $(OBJS) Makefile.bak

proto:
	touch ../include/sproto.h
	$(MV) ../include/sproto.h ../include/sproto.h.orig
	touch ../include/sproto.h
	cextract +p -I$(INCROOT) $(INCLUDES) $(SRCS) | grep -v \/\\\* | tail +9 >../include/sproto.h
	chmod 644 ../include/sproto.h
	$(RM) ../include/sproto.h.orig

InsertArchieve(Imakefile $(SRCS),server)

/*
 * ifi: is just something I use locally to reinstall crossfire on a system
 * which connects several architectures via NFS.
 */

ifi: crossfire install_bin
	$(RM) crossfire
	chmod 2755 $(C_BINDIR)/crossfire
	test -d $(C_BINDIR)/$(HOSTTYPE) || mkdir $(C_BINDIR)/$(HOSTTYPE)
	$(RM) $(C_BINDIR)/$(HOSTTYPE)/last
	date +%d-%H-%M > $(C_BINDIR)/$(HOSTTYPE)/last
	$(MV) $(C_BINDIR)/crossfire $(C_BINDIR)/$(HOSTTYPE)/crossfire.`cat $(C_BINDIR)/$(HOSTTYPE)/last`
