# $Id: Imakefile.in,v 1.53 2004/07/08 06:09:53 nishida Exp $

@SET_MAKE@
srcdir=	@srcdir@
VPATH=	@srcdir@
SRCS=	mgp.c draw.c parse.c plist.c print.c globals.c x11.c x11dummy.c \
	font.c background.c scanner.c grammar.c postscript.c tfont.c \
	embed.c unimap.c mng.c m17n.c
TPOBJS=	mgp.o draw.o parse.o plist.o globals.o x11.o font.o background.o \
	scanner.o grammar.o postscript.o tfont.o embed.o unimap.o mng.o m17n.o
PROBJS=	print.o parse.o globals.o x11dummy.o scanner.o grammar.o postscript.o \
	embed.o 
LIBOBJS=	@LIBOBJS@
OBJS=	${TPOBJ} ${PROBJS} ${LIBOBJS}
LIBS=	$(srcdir)/image/libmgpimage.a
AWK=	@AWK@
PERL=	@mgp_cv_path_perl@
YACC=	@YACC@
LEX=	@LEX@
# NOTE: we must not define CC here, since imake may assume other CC to be used.

OPTFLAGS=	@OPTFLAGS@
DEFS=	@DEFS@ -DMGPLIBDIR=\"$(LIBDIR)/mgp\"
#DEFS+=	-DGLYPHEDGE

SYS_LIBRARIES=	-L$(srcdir)/image -lmgpimage @LIBS@
EXTRA_DEPLIBS=	@DEPLIBS@

#undef DefaultCDebugFlags
#define DefaultCDebugFlags	@DEBUGFLAGS@
#undef ServerCDebugFlags
#undef LibraryDebugFlags

AllTarget(mgp mgp2ps)
DependTarget()

#ifndef NullParameter
#define  NullParameter 
#endif

NormalProgramTarget(mgp,$(TPOBJS) $(LIBOBJS), $(LIBS) $(EXTRA_DEPLIBS), NullParameter,$(XLIB))
NormalProgramTarget(mgp2ps,$(PROBJS) $(LIBOBJS), $(LIBS) $(EXTRA_DEPLIBS), NullParameter,$(XLIB))

InstallProgram(mgp,$(BINDIR))
InstallProgram(mgp2ps,$(BINDIR))
InstallManPage(mgp,$(MANDIR))
InstallManPage(mgp2ps,$(MANDIR))

#if defined(ImakeConfigRelease) && ImakeConfigRelease >= 6
InstallNamedTarget(install,mgpembed.pl,$(INSTBINFLAGS),$(BINDIR),mgpembed) /*R6 only*/
#else
InstallNamedProg(mgpembed.pl,mgpembed,$(BINDIR)) /*obsoleted in R6?*/
#endif
InstallManPage(mgpembed,$(MANDIR))

SpecialObjectRule(draw.o,draw.c, $(DEFS) $(OPTFLAGS))
SpecialObjectRule(parse.o,parse.c, $(DEFS) $(OPTFLAGS))
SpecialObjectRule(plist.o,plist.c, $(DEFS) $(OPTFLAGS))
SpecialObjectRule(postscript.o,postscript.c, $(DEFS) $(OPTFLAGS))
SpecialObjectRule(print.o,print.c, $(DEFS) $(OPTFLAGS))
SpecialObjectRule(x11.o,x11.c, $(DEFS) $(OPTFLAGS))
SpecialObjectRule(font.o,font.c, $(DEFS) $(OPTFLAGS))
SpecialObjectRule(tfont.o,tfont.c, $(DEFS) $(OPTFLAGS))
SpecialObjectRule(x11dummy.o,x11dummy.c, $(DEFS) $(OPTFLAGS))
SpecialObjectRule(background.o,background.c, $(DEFS) $(OPTFLAGS))
SpecialObjectRule(globals.o,globals.c, $(DEFS) $(OPTFLAGS))
SpecialObjectRule(mgp.o,mgp.c, $(DEFS) $(OPTFLAGS))
SpecialObjectRule(scanner.o,scanner.c, $(DEFS) $(OPTFLAGS))
SpecialObjectRule(grammar.o,grammar.c, $(DEFS) $(OPTFLAGS))
SpecialObjectRule(embed.o,embed.c, $(DEFS) $(OPTFLAGS))
SpecialObjectRule(mng.o,mng.c, $(DEFS) $(OPTFLAGS))
SpecialObjectRule(m17n.o,m17n.c, $(DEFS) $(OPTFLAGS))

#define PassCDebugFlags
#define IHaveSubdirs

SUBDIRS=	image sample contrib
NamedMakeSubdirs($(srcdir)/image/libmgpimage.a, image)
MakeSubdirs(sample contrib)

mgp.o: $(srcdir)/mgp.c ctlwords.h
draw.o: $(srcdir)/draw.c ctlwords.h
globals.o: $(srcdir)/globals.c ctlwords.h
grammar.o: $(srcdir)/grammar.c ctlwords.h
parse.o: $(srcdir)/parse.c ctlwords.h
plist.o: $(srcdir)/plist.c ctlwords.h
print.o: $(srcdir)/print.c ctlwords.h

ctlwords.h: $(srcdir)/ctlwords.c $(srcdir)/globals.c
	$(CC) -o ./ctlwords $(srcdir)/ctlwords.c
	./ctlwords < $(srcdir)/globals.c > ctlwords.h

clean::
	rm -f ctlwords

scanner.c: $(srcdir)/scanner.l
	$(LEX) -t $(srcdir)/scanner.l > scanner.c
scanner.o: scanner.c tokdefs.h

grammar.c tokdefs.h: $(srcdir)/grammar.y
	$(YACC) -d $(srcdir)/grammar.y
	mv y.tab.c grammar.c
	mv y.tab.h tokdefs.h

# -O2 will work badly...
unimap.o:
	$(CC) -c $(CCOPTIONS) $(THREADS_CFLAGS) $(ALLDEFINES) \
		-I$(srcdir) $(DEFS) $(OPTFLAGS) unimap.c

# missing libraries
memcmp.o: missing/memcmp.c
	$(CC) -c $(CFLAGS) -I$(srcdir) $(DEFS) $(OPTFLAGS) \
		$(srcdir)/missing/memcmp.c
strdup.o: missing/strdup.c
	$(CC) -c $(CFLAGS) -I$(srcdir) $(DEFS) $(OPTFLAGS) \
		$(srcdir)/missing/strdup.c
strsep.o: missing/strsep.c
	$(CC) -c $(CFLAGS) -I$(srcdir) $(DEFS) $(OPTFLAGS) \
		$(srcdir)/missing/strsep.c
usleep.o: missing/usleep.c
	$(CC) -c $(CFLAGS) -I$(srcdir) $(DEFS) $(OPTFLAGS) \
		$(srcdir)/missing/usleep.c
mkstemp.o: missing/mkstemp.c
	$(CC) -c $(CFLAGS) -I$(srcdir) $(DEFS) $(OPTFLAGS) \
		$(srcdir)/missing/mkstemp.c
snprintf.o: missing/snprintf.c
	$(CC) -c $(CFLAGS) -I$(srcdir) $(DEFS) $(OPTFLAGS) \
		$(srcdir)/missing/snprintf.c
strlcpy.o: missing/strlcpy.c
	$(CC) -c $(CFLAGS) -I$(srcdir) $(DEFS) $(OPTFLAGS) \
		$(srcdir)/missing/strlcpy.c
strlcat.o: missing/strlcat.c
	$(CC) -c $(CFLAGS) -I$(srcdir) $(DEFS) $(OPTFLAGS) \
		$(srcdir)/missing/strlcat.c

distclean:: clean
	-/bin/rm -f config.status config.log config.cache ctlwords.h
	-/bin/rm -f scanner.c grammar.c tokdefs.h mgp.0 mgp2ps.0 mgpembed.pl
	-/bin/rm -f contrib/mgp2html.pl contrib/mgp2latex.pl
	for i in $(SUBDIRS); do \
		(cd $$i; if [ -f Makefile ]; then make distclean; fi); \
	done
	-/bin/rm -f Makefile Imakefile

/*EOF*/


syntax highlighted by Code2HTML, v. 0.9.1