/*
 * $Id: Imakefile,v 1.3 1998/01/05 10:31:25 master Exp master $
 *
 * CrossEdit - Game world editor
 * Copyright (C) 1993 Petri Heinila & Jarkko Sonninen
 *
 * 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 can be connected by email from Jarkko.Sonninen@lut.fi &
 * Petri.Heinila@lut.fi
 */

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

/* subdirectories */
#define IHaveSubdirs 
SUBDIRS = bitmaps doc Cnv include


LOCAL_LIBRARIES =  $(DLSYM) -L../common -lcross -L./Cnv -lCnv $(XPM_LIBS) \
	XawClientLibs $(MALLOC_LIBS)
EXTRA_INCLUDES  = -I. -I../include -I./include -I./Cnv $(RPLAY_INCDIR)
DEPENDLIB = ../common/libcross.a ./Cnv/libCnv.a


/* program */
PROG = crossedit

/* files */
SRCS = \
	$(PROG).c \
	Attr.c \
	CrFace.c \
	CrEdit.c \
	CrList.c \
	CrUtil.c \
	Edit.c \
	App.c \
	Bitmaps.c \
	Str.c 

HDRS = \
	CrFace.h \
	CrFaceP.h \
	CrEdit.h \
	CrEditP.h \
	CrList.h \
	CrListP.h \
	CrUtil.h \
	App.h \
	Edit.h \
	Bitmaps.h \
	Str.h \
	Attr.h \
	Crossedit.ad.h \
	Defines.h 

OBJS = \
	$(PROG).o \
	Attr.o \
	CrFace.o \
	CrEdit.o \
	CrList.o \
	CrUtil.o \
	Edit.o \
	App.o \
	Bitmaps.o \
	Str.o 

FILES	=	README		TODO		Imakefile \
		Crossedit.ad	Crossedit.ad.h	config.h

/***************************************************************************/

MakeSubdirs(bitmaps doc Cnv include)

AllTarget($(PROG))

MakeArchive(bitmaps doc Cnv include)

InsertArchive($(SRCS) $(HDRS) $(FILES),crossedit)

patchlist::
	@echo $(SRCS) $(HDRS) $(FILES) > .patchlist

NamedTargetSubdirs(patchlist,bitmaps doc Cnv include ,"Making patchlist",'ATOP=$(ATOP)',patchlist)

depend:: Crossedit.ad.h

NormalProgramTarget($(PROG),$(OBJS),$(DEPENDLIB),$(LOCAL_LIBRARIES),)

DependTarget()

DependSubdirs(Cnv)

/* resources */
crossedit.c: Crossedit.ad.h
Crossedit.ad.h: Crossedit.ad
	-../utils/ad2c.script Crossedit.ad > Crossedit.ad.h

/* indent */
indent: $(SRCS)
	for a in $(SRCS) $(HDRS);do \
	indent $$a -bap -bacc -nbad -nbbb -nbc -br -bs -ncdb -ce -neei \
		-nfc1 -i4 -nip -nlp -npro -pcs -npsl -nsc -nsob \
		-c33 -cd33 -ci2 -cli0.0 -d0 -di4 -l78 -lc78;\
	done

/* prototypes */
proto:
	cextract +p -P -o proto.h.bak -cpp-program="gcc -E -C" \ 
	$(EXTRA_DEFINES) -I$(INCROOT) $(EXTRA_INCLUDES) $(SRCS)
	sed -e "s/#if __STDC__/#ifdef __STDC__/" -e "s/__signed/signed/g" -e "/__inline/d" < proto.h.bak > proto.h
	chmod 644 proto.h
	$(RM) proto.h.bak


/* install */
#if ProjectX < 5
install::
	@echo Can not install $(PROG) due to too low X-release.
#else
InstallProgram($(PROG),$(C_BINDIR))
#endif

/* END OF IMAKEFILE */
