#
#
# Copyright (C) 1990 Texas Instruments Incorporated.
#
# Permission is granted to any individual or institution to use, copy, modify,
# and distribute this software, provided that this complete copyright and
# permission notice is maintained, intact, in all copies and supporting
# documentation.
#
# Texas Instruments Incorporated provides this software "as is" without
# express or implied warranty.
#
#

#
# For a cpp without defmacro extensions use the following definitions.
#
#CPPFLAGS =
#SRCS = cpp1.c cpp2.c cpp3.c cpp4.c cpp5.c cpp6.c

CC = cc
CFLAGS = -O
CPPFLAGS = -DCOOL

.SUFFIXES: .c .o
.c.o:
	$(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c

SRCS = cpp1.c cpp2.c cpp3.c cpp4.c cpp5.c cpp6.c cpp7.c \
       defmacio.c hash.c defpacka.c parmtype.c macro.c \
       member.c class.c template.c exceptio.c generate.c compress.c
OBJS = $(SRCS:.c=.o)

#
# ** compile cpp
#

cpp: $(OBJS)
	$(CC) -o cpp $(OBJS)

#
# ** Remove unneeded files
#

clean:
	rm *.o cpp

#
# ** Test cpp by preprocessing itself, compiling the result,
# ** repeating the process and diff'ing the result.  Note: this
# ** is not a good test of cpp, but a simple verification.
# ** The diff's should not report any changes.
#

test:
	for FILE in $(SRCS) ; do ./cpp $(CPPFLAGS) $$FILE > t_$$FILE ; done
	$(CC) $(CPPFLAGS) $(CFLAGS) t_*.c
	for FILE in $(SRCS) ; do ./a.out $(CPPFLAGS) $$FILE > tt_$$FILE ; done
	for FILE in $(SRCS) ; do diff t_$$FILE  tt_$$FILE ; done
	rm t_* tt_* a.out

#
# Object module dependencies
#

cpp1.o  :	cpp1.c cpp.h cppdef.h

cpp2.o  :	cpp2.c cpp.h cppdef.h

cpp3.o  :	cpp3.c cpp.h cppdef.h

cpp4.o  :	cpp4.c cpp.h cppdef.h

cpp5.o  :	cpp5.c cpp.h cppdef.h

cpp6.o  :	cpp6.c cpp.h cppdef.h

cpp7.o  :	cpp7.c cpp.h cppdef.h

defmacio.o :	defmacio.c defmacio.h

parmtype.o :	parmtype.c defmacio.h

macro.o :	macro.c macro.h defmacio.h

defpacka.o :  defpacka.c defmacio.h

hash.o :	hash.c

issame.o :	issame.c defmacio.h

member.o :	member.c defmacio.h

class.o :	class.c defmacio.h

template.o :	template.c defmacio.h

exceptio.o :	exceptio.c macro.h defmacio.h

generate.o :	generate.c macro.h defmacio.h

compress.o :	compress.c defmacio.h
