XCOMM $XConsortium: Imakefile /main/18 1996/05/08 09:29:12 drk $

#ifdef  BSDArchitecture
UTILLIB = -lutil
#endif  /* BSDArchitecture */

#define CplusplusSource	YES
DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES)
INCLUDES = $(TIRPCINC)
EXTRA_LOAD_FLAGS = ExtraLoadFlags $(UNSHARED_CXXLIB)

DEPLIBS = $(DEPDTTERMLIB) DepDtClientLibs $(DEPUTILLIB)
LOCAL_LIBRARIES = $(DTTERMLIB) DtClientLibs $(UTILLIB)
SYS_LIBRARIES = DtClientSysLibs DtClientExtraLibs
DTCODEGENCAT = NLSPATH=$(CDESRC)/dtappbuilder/src/abmf/dtcodegen.cat


XCOMM ##########################################################################
XCOMM  These parameters are generated by dtcodegen according to the structure
XCOMM  of the project as defined in the .bip and .bil files
XCOMM ##########################################################################

PROGRAMS = ttsnoop

XCOMM
XCOMM Generated from 
TARGETS.h = \
	apiTracer_ui.h		argChooser_ui.h \
	callbackChooser_ui.h 	dtb_utils.h \
	fileChooser_ui.h 	messageProps_ui.h \
	patternProps_ui.h 	sessionChooser_ui.h \
	stringChooser_ui.h 	ttChooser_ui.h \
	ttsnoop_ui.h

TARGETS.c = \
	apiTracer_ui.c		argChooser_ui.c \
	callbackChooser_ui.c 	dtb_utils.c \
	fileChooser_ui.c 	messageProps_ui.c \
	patternProps_ui.c 	sessionChooser_ui.c \
	stringChooser_ui.c 	ttChooser_ui.c \
	ttsnoop_ui.c
 
TARGETS.c.temp = \
	apiTracer_stubs.c 	argChooser_stubs.c \
	callbackChooser_stubs.c	fileChooser_stubs.c \
	messageProps_stubs.c 	patternProps_stubs.c \
	sessionChooser_stubs.c 	stringChooser_stubs.c \
	ttChooser_stubs.c 	ttsnoop.c \
	ttsnoop_stubs.c
 
TARGETS.h.merged = \
	ttsnoop.h
 
TARGETS.C.merged = \
	apiTracer_stubs.C 	argChooser_stubs.C \
	callbackChooser_stubs.C	fileChooser_stubs.C \
	messageProps_stubs.C 	patternProps_stubs.C \
	sessionChooser_stubs.C 	stringChooser_stubs.C \
	ttChooser_stubs.C 	ttsnoop.C \
	ttsnoop_stubs.C
 
SRCS2.h = $(TARGETS.h.merged) $(TARGETS.h) tt_c++.h DtTt.h

SRCS2 = $(TARGETS.C.merged) $(TARGETS.c) tt_c++.C DtTt.C

OBJS2 = \
	DtTt.o			apiTracer_stubs.o \
	apiTracer_ui.o		argChooser_stubs.o \
	argChooser_ui.o 	callbackChooser_stubs.o \
	callbackChooser_ui.o 	dtb_utils.o \
	fileChooser_stubs.o 	fileChooser_ui.o \
	messageProps_stubs.o 	messageProps_ui.o \
	patternProps_stubs.o 	patternProps_ui.o \
	sessionChooser_stubs.o 	sessionChooser_ui.o \
	stringChooser_stubs.o 	stringChooser_ui.o \
	ttChooser_stubs.o 	ttChooser_ui.o \
	tt_c++.o		ttsnoop.o \
	ttsnoop_stubs.o 	ttsnoop_ui.o
 
AB_MAKEFILES = \
	Makefile.aix \
	Makefile.hpux \
	Makefile.sunos \
	Makefile.linux \
	Makefile.freebsd \
	Makefile.netbsd \
	Makefile.openbsd

XCOMM ###
XCOMM ### This is basically a kludge since dtappbuilder is not being 
XCOMM ### successfully created during the make includes phase.
XCOMM ### Once it is, the following 2 line should be replaced with:
XCOMM ###
XCOMM ### includes::  $(TARGETS.h) $(TARGETS.c)
XCOMM ### localincludes::  $(TARGETS.h) $(TARGETS.c)
XCOMM ###

all:: targets ttdepend

targets::  $(TARGETS.h) $(TARGETS.c)

XCOMM Make initial copies of the .C.src files so that makedepend
XCOMM has some meaningful input.
depend::
	for file in $(TARGETS.C.merged) ; do \
	    if [ ! -r $$file ] ; then \
		$(CP) $$file.src $$file ; chmod -w $$file ; fi ; \
	done

NormalCplusplusObjectRule()

all:: $(PROGRAMS)

ComplexCplusplusProgramTarget_2($(PROGRAMS),$(LOCAL_LIBRARIES),)

ttdepend:: DependFileName

DependFileName::
	-RunProgram(DEPEND,$(DEPENDFLAGS) $(ALLDEFINES) $(DEPEND_DEFINES) $(SRCS2)) > $@

clean::
	RemoveFile(ProgramTargetName(PROGRAMS))


XCOMM #####################################################################
XCOMM Standard targets.
XCOMM #####################################################################

CppSourceFile(Ttsnoop,Ttsnoop.src,$(LOCAL_CPP_DEFINES),)

/*
 * CodeGenTarget - generate rules to create the generated source and
 * header files as well as the appropriate dependencies.
 */
#ifndef Plus
# ifdef SunArchitecture
#  define Plus() +
# else
#  define Plus()
# endif
#endif

#ifndef CodeGenAppendableTarget
# define CodeGenAppendableTarget(m)					@@\
m.SRC_STUBS_C++	= Concat(m,_stubs.C.src)				@@\
m.SRC_BIL	= Concat(m,.bil)					@@\
m.GEN_UI_C	= Concat(m,_ui.c)					@@\
m.GEN_UI_H	= Concat(m,_ui.h)					@@\
m.GEN_UI_O	= Concat(m,_ui.o)					@@\
m.GEN_STUBS_C	= Concat(m,_stubs.c)					@@\
m.GEN_STUBS_C++	= Concat(m,_stubs.C)					@@\
m.GEN_STUBS_O	= Concat(m,_stubs.o)					@@\
$(m.GEN_UI_O):	 $(m.GEN_UI_C) $(m.GEN_UI_H) $(m.SRC_BIL)		@@\
$(m.GEN_STUBS_O): $(m.GEN_STUBS_C++) $(m.GEN_UI_H) $(m.SRC_BIL)		@@\
$(m.GEN_UI_C) Plus() $(m.GEN_UI_H) Plus() $(m.GEN_STUBS_C++): ttsnoop.bip $(m.SRC_BIL) $(m.SRC_STUBS_C++) @@\
	$(CP) $(m.SRC_STUBS_C++) $(m.GEN_STUBS_C)			@@\
	-if [ ! -w $(m.GEN_STUBS_C) ]; then \				@@\
		chmod +w $(m.GEN_STUBS_C); fi				@@\
	$(DTCODEGEN) -changed -merge -p ttsnoop.bip $(m.SRC_BIL)	@@\
	$(RM) $(m.GEN_STUBS_C++)					@@\
	$(MV) $(m.GEN_STUBS_C) $(m.GEN_STUBS_C++)			@@\
	cat externC.h $(m.GEN_UI_H) closeBrace.h > $(m.GEN_UI_H).patched @@\
	$(MV) $(m.GEN_UI_H).patched $(m.GEN_UI_H)
#endif

#ifndef CodeGenTarget
# define CodeGenTarget(m) CodeGenAppendableTarget(m)
#endif

#define SED_MoreButton $(SED) \						@@\
	-e 's/\(MoreButton;\)/\1Boolean _DtCanHelp( const char * );/' \	@@\
	-e 's/\(XtManageChild(Quick_help\)/XtSetSensitive(MoreButton,_DtCanHelp(help_data->help_text));\1/' \	@@\
	-e 's/\(buffer, vol, loc;\)/\1Boolean _DtHelped( Widget );/' \	@@\
	-e 's/\(if( (cp=strrchr\)/if (_DtHelped( help_dialog)) return;\1/' \ @@\
	dtb_utils.c > dtb_utils.c.patched

#define SED_DtbTt $(SED) \						@@\
	-e 's/^DtbTt/extern String snooperArgv[];DtbTt/' \		@@\
	-e 's/XmNheight, 257,//' \					@@\
	-e 's/XmNwidth, 580,//' \					@@\
	-e 's/XmNcolumns, 80,//' \					@@\
	-e 's/XmNrows, 24/DtNsubprocessArgv, snooperArgv/' \		@@\
	ttsnoop_ui.c > ttsnoop_ui.c.patched

#define SED_DtbApi $(SED) \						@@\
	-e 's/^DtbApi/extern String apiTracerArgv[];DtbApi/' \		@@\
	-e 's/XmNrows, 24/XmNrows, 24, DtNsubprocessArgv, apiTracerArgv/' \ @@\
	apiTracer_ui.c > apiTracer_ui.c.patched

ttsnoop.C ttsnoop.h dtb_utils.c dtb_utils.h: ttsnoop.bip ttsnoop.C.src
	$(CP) ttsnoop.C.src ttsnoop.c
	-if [ ! -w ttsnoop.c ]; then chmod +w ttsnoop.c; fi
	$(DTCODEGEN) -changed -merge -p ttsnoop.bip -main
	$(RM) ttsnoop.C
	$(MV) ttsnoop.c ttsnoop.C
	chmod -w ttsnoop.C
	cat externC.h dtb_utils.h closeBrace.h > dtb_utils.h.patched
	$(MV) dtb_utils.h.patched dtb_utils.h
	SED_MoreButton
	$(MV) dtb_utils.c.patched dtb_utils.c
ttsnoop.o: ttsnoop.C ttsnoop.bip $(TARGETS.h) $(TARGETS.h.merged)

CodeGenAppendableTarget(ttsnoop)
	SED_DtbTt
	$(MV) ttsnoop_ui.c.patched ttsnoop_ui.c

CodeGenAppendableTarget(apiTracer)
	SED_DtbApi
	$(MV) apiTracer_ui.c.patched apiTracer_ui.c

CodeGenTarget(ttChooser)
CodeGenTarget(patternProps)
CodeGenTarget(stringChooser)
CodeGenTarget(messageProps)
CodeGenTarget(sessionChooser)
CodeGenTarget(fileChooser)
CodeGenTarget(argChooser)
CodeGenTarget(callbackChooser)

CLEAN_FILES =	core .dtcodegen.log *.BAK *.delta *.patched \
                $(PROGRAMS) $(OBJS2) $(TARGETS.c) $(TARGETS.h) \
		$(TARGETS.c.temp) $(TARGETS.C.merged) Ttsnoop

clean::
	$(RM) $(CLEAN_FILES) $(AB_MAKEFILES)

scour:
	$(RM) $(CLEAN_FILES) $(TARGETS.h.merged) Makefile Makefile.aix Makefile.hpux Makefile.sunos
