# Unix makefile for cpp
#
# The redefinition of strchr() and strrchr() are needed for
# Ultrix-32, Unix 4.2 bsd (and maybe some other Unices).
#
#BSDDEFINE = /Dstrchr=index /Dstrrchr=rindex
#
# On certain systems, such as Unix System III, you may need to define
# $(LINTFLAGS) in the make command line to set system-specific lint flags.
#
# This Makefile assumes cpp will replace the "standard" preprocessor.
# Delete the reference to -DLINE_PREFIX=\"\" if cpp is used stand-alone.
# LINEFIX is a sed script filter that reinserts #line -- used for testing
# if LINE_PREFIX is set to "".   Note that we must stand on our heads to
# match the # and a line had better not begin with $.  By the way, what
# we really want is
#	LINEFIX = | sed "s/^#/#line/"
#
#CPPDEFINE = /DLINE_PREFIX=\"\"
LINEFIX = | sed "s/^[^ !\"%-~]/&line/"
#
# Define OLD_PREPROCESSOR non-zero to make a preprocessor which is
# "as compatible as possible" with the standard Unix V7 or Ultrix
# preprocessors.  This is needed to rebuild 4.2bsd, for example, as
# the preprocessor is used to modify assembler code, rather than C.
# This is not recommended for current development.  OLD_PREPROCESSOR
# forces the following definitions:
#   OK_DOLLAR		FALSE	$ is not allowed in variables
#   OK_CONCAT		FALSE	# cannot concatenate tokens
#   COMMENT_INVISIBLE	TRUE	old-style comment concatenation
#   STRING_FORMAL	TRUE	old-style string expansion
#
OLDDEFINE = #-DOLD_PREPROCESSOR=1
#
# DEFINES collects all -D arguments for cc and lint:
# Change DEFINES = $(BSDDEFINE) $(CPPDEFINE) $(OLDDEFINE)
# for an old-style preprocessor.
#
DEFINES = $(BSDDEFINE) $(CPPDEFINE) /DALLOW_NEST /DALLOW_UNDEF


# This is for debugging:
DEBUG=/d2
# This is for generating optimized code:
DEBUG=/oimrt/5/fpi/fp5/zp4/oe=100


CFLAGS = $(DEBUG) $(DEFINES)

#
# ** compile cpp
#
SRCS = cpp1.c cpp2.c cpp3.c cpp4.c cpp5.c cpp6.c
OBJS = cpp1.obj cpp2.obj cpp3.obj cpp4.obj cpp5.obj cpp6.obj

# Use the 16-bit compiler!
CC=wcl /mh /k32768

.c.obj:
	$(CC) /c $(CFLAGS) $[*


perlcpp.exe: $(OBJS)
	$(CC) $(DEBUG) /fe=perlcpp.exe $(OBJS)

clean:
	-del *.obj
	-del *.err
	-del *.map

#
# Object module dependencies
#

cpp1.obj	:	cpp1.c cpp.h cppdef.h

cpp2.obj	:	cpp2.c cpp.h cppdef.h

cpp3.obj	:	cpp3.c cpp.h cppdef.h

cpp4.obj	:	cpp4.c cpp.h cppdef.h

cpp5.obj	:	cpp5.c cpp.h cppdef.h

cpp6.obj	:	cpp6.c cpp.h cppdef.h


