XCOMM $XConsortium: Imakefile,v 1.17 92/08/22 13:05:25 rws Exp $
/*
 * NOTE: CppSourcesPresent IS NO LONGER TESTED OR SUPPORTED,
 * and is nearly guaranteed to not work.
 */

#ifndef CppSourcesPresent
#define CppSourcesPresent	NO	/* only works with BSD sources */
#endif
#ifndef CppSources
#define CppSources /usr/src/lib/cpp
#endif

#if CppSourcesPresent
    SRCS = include.c main.c parse.c pr.c cppsetup.c cpp.c cpy.y
    OBJS = include.o main.o parse.o pr.o cppsetup.o cpp.o cpy.o
 CPPDEFS = -DCPP
  CPPSRC = CppSources
#else
/*
 * But if you do not have cpp source...
 */
    SRCS = include.c main.c parse.c pr.c cppsetup.c ifparser.c 
    OBJS = include.o main.o parse.o pr.o cppsetup.o ifparser.o 
#endif

#if HasGcc && !defined(PreIncDir)
#define PreIncDir /usr/local/lib/gcc-include
#endif
#ifdef PreIncDir
PREINCDIR = PreIncDir
PREINC_DEFINES = -DPREINCDIR=\"$(PREINCDIR)\"
#endif
#ifndef StdIncDir
#define StdIncDir /usr/include
#endif
STDINCDIR = StdIncDir
STDINC_DEFINES = -DINCLUDEDIR=\"$(STDINCDIR)\"
#ifdef PostIncDir
POSTINCDIR = PostIncDir
POSTINC_DEFINES = -DPOSTINCDIR=\"$(POSTINCDIR)\"
#endif
INC_DEFINES = $(PREINC_DEFINES) $(STDINC_DEFINES) $(POSTINC_DEFINES)
MAIN_DEFINES = $(INC_DEFINES) $(SIGNAL_DEFINES)
INCLUDES = -I$(CONFIGSRC)
 DEFINES = $(CPPDEFS)
 DEPLIBS =

#ifdef MacIIArchitecture
 XBSDLIB = /**/
#endif

all:: makedepend

#undef InstallManPage
#define InstallManPage(file,dest) /* as nothing */
ComplexProgramTarget(makedepend)

SpecialCObjectRule(main,$(ICONFIGFILES),$(MAIN_DEFINES))

InstallManPageLong(mkdepend,$(MANDIR),makedepend)


#if CppSourcesPresent
cpy.c: cpy.y yylex.c
	yacc cpy.y
	sed -e '/^# *line/d' < y.tab.c > cpy.c
	$(RM) y.tab.c

cpy.y: $(CPPSRC)/cpy.y
	$(RM) $@
	$(LN) $(CPPSRC)/cpy.y .

yylex.c: $(CPPSRC)/yylex.c
	$(RM) $@
	sed -e 's/#if pdp11 | vax | mc68000/& | ns16000 | ibm032/' \
		$(CPPSRC)/yylex.c > yylex.c

cpp.c: $(CPPSRC)/cpp.c cpp.ed
	$(RM) cpp.c
	/lib/cpp $(CPPSRC)/cpp.c \
		| cb \
		| sed -e '/^$$/d' -e '/^#/d' -e 's/	/ /g' > cpp.c
	sed -e '/^#/d' < cpp.ed | ed - cpp.c

cpp.o: cpp.c
cpy.o: cpy.c

clean::
	$(RM) cpp.c cpy.? yylex.c
#endif
