# Makefile for the selective C preprocessor, scpp.
#
# Copyright (c) 1985 by
# Tektronix, Incorporated Beaverton, Oregon 97077
# All rights reserved.
#
# Permission is hereby granted for personal, non-commercial
# reproduction and use of this program, provided that this
# notice and all copyright notices are included in any copy.

DEFS=
HDRS= scpp.h

SOURCES= ctrl.c io.c lex.l parse.y scpp.c
OBJECTS= ctrl.obj io.obj lex.obj parse.obj scpp.obj

all:    scpp scpp.cat
scpp:   $(OBJECTS)
        $(CC) $(CFLAGS) -o scpp $(OBJECTS) -ll
scpp.cat: scpp.1
        nroff -man scpp.1 >scpp.cat

scpp.o: scpp.c y.tab.h scpp.h
ctrl.o: ctrl.c y.tab.h scpp.h
io.o:  io.c scpp.h
lex.o: lex.c y.tab.h scpp.h
parse.o: parse.c scpp.h

lex.c: lex.l
        lex lex.l
        sed -e '/yylex/s//xxlex/g' <lex.yy.c >lex.c
        rm lex.yy.c
y.tab.h parse.c: parse.y
        yacc -d parse.y
        mv y.tab.c parse.c

clean:
        -rm -f lex.yy.c lex.c y.tab.c y.tab.h y.output parse.c
        -rm -f $(OBJECTS)

tags: $(SOURCES)
        ctags $(SOURCES)
mail:
        shar -a scpp.1 Makefile lex.l ctrl.c interp io.c >scpp.shar1
        shar -a parse.y scpp.c scpp.h >scpp.shar2
