#	$Id: Makefile.in,v 1.28 2010/12/18 15:22:13 ragge Exp $
#
# Makefile.in for cpp
#

srcdir=.
top_srcdir=..
builddir=.
top_builddir=..
XFL=-DCPP_DEBUG

prefix = /amd/orange2b/usr/home/home01/taka/OX4L/asir-2018/OpenXM/misc/packages/Linux/Debian2/work/OpenXM
exec_prefix = ${prefix}
bindir = ${exec_prefix}/bin
libexecdir = ${exec_prefix}/bin
datarootdir = ${prefix}/share
mandir = ${datarootdir}/man
strip = yes
CC = gcc
EXEEXT = 
CFLAGS = -g -O2  -Wall -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wsign-compare
CPPFLAGS =   -DGCC_COMPAT ${XFL} -I${srcdir} -I${top_builddir} -I${builddir} -I${MIPDIR} -I${MDIR}
LIBS = 
LDFLAGS = 
LEX = flex
YACC = bison -y
INSTALL = /usr/bin/install -c
INSTALL_PROGRAM = ${INSTALL}
TARGMACH = amd64

OBJS=cpp.o cpy.o token.o compat.o
HEADERS=cpp.h
DEST=ox_cpp$(EXEEXT)

MIPDIR=$(top_srcdir)/mip
MDIR=$(top_srcdir)/arch/$(TARGMACH)

all: ${DEST}

${DEST}: $(OBJS) $(HEADERS)
	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@

.c.o:
	$(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) -c $<

.l.o:
	$(LEX) $(LFLAGS) $<
	$(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) -c -o $@ lex.yy.c

.y.o:
	$(YACC) -d $(YFLAGS) $<
	$(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) -c -o $@ y.tab.c

compat.o: $(MIPDIR)/compat.c
	$(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $(MIPDIR)/compat.c

$(OBJS): $(HEADERS)

cpp.o: cpy.o
token.o: cpy.o

test:
	./cpp < tests/test1 > tests/run1
	cmp tests/run1 tests/res1
	./cpp < tests/test2 > tests/run2
	cmp tests/run2 tests/res2
	./cpp < tests/test3 > tests/run3
	cmp tests/run3 tests/res3
	./cpp < tests/test4 > tests/run4
	cmp tests/run4 tests/res4
	./cpp < tests/test5 > tests/run5
	cmp tests/run5 tests/res5
	./cpp < tests/test6 > tests/run6
	cmp tests/run6 tests/res6
	./cpp < tests/test7 > tests/run7
	cmp tests/run7 tests/res7
	./cpp < tests/test8 > tests/run8
	cmp tests/run8 tests/res8
	./cpp < tests/test9 > tests/run9
	cmp tests/run9 tests/res9
	./cpp < tests/test10 > tests/run10
	cmp tests/run10 tests/res10


install:
	test -z "${DESTDIR}$(libexecdir)" || mkdir -p "${DESTDIR}$(libexecdir)"
	${INSTALL_PROGRAM} ${DEST} ${DESTDIR}${libexecdir}
	@if [ ${strip} = yes ]; then		\
		strip ${DESTDIR}${libexecdir}/${DEST} ;	\
		echo strip ${DESTDIR}${libexecdir}/${DEST} ;	\
	fi

clean:
	/bin/rm -f $(OBJS) $(DEST) lex.yy.c y.tab.[ch] tests/run*

distclean: clean
	/bin/rm -f Makefile
