#########################################################################
#
#       MAKEFILE FOR STAND-ALONE XT CODE APPLICATION.  
#
#       SIGBRU      is the name of the executable to be created 
#       MAIN            is the .c file containing your main() function 
#       INTERFACES      is a list of the generated C code files
#       APP_OBJS        is a (possibly empty) list of the object code
#                       files that form the non-interface portion of
#                       your application
#
#       In the first three statements, the variables on the right 
#	of the equal sign will be replaced with their corresponding
#       values when the makefile is automatically generated.
#
#       This template is used for makefiles which do not reference 
#       the Ux runtime library.
#
#  	$Date: 2006-09-21 15:20:58 -0300 (Thu, 21 Sep 2006) $ 		$Revision: 17669 $
#########################################################################

CFLAGS_ALL      = -D${MACH_OS} -DMOTIF -DSYSV -DXT_CODE -DXOPEN_CATALOG \
                  -I./  -I../../include -I${IRIS_ROOT}/include

CFLAGS          = -c ${DEBUGFLAG} ${CC_OPT} ${CFLAGS_ALL}
CXXFLAGS        = -c ${DEBUGFLAG} ${CC_OPT} ${CFLAGS_ALL}
CCFLAGS = ${CXXFLAGS}

CFLAGS_RELAXED  = -c ${DEBUGFLAG} ${C_OPT_RELAXED}  ${CFLAGS_ALL}
CCFLAGS_RELAXED = -c ${DEBUGFLAG} ${CC_OPT_RELAXED} ${CFLAGS_ALL}

LDFLAGS         = -L./ \
                  -L../../libs/lib -L${IRIS_ROOT}/libs/lib ${LPATH_X11}

LANGUAGE        = C++
SIGBRU		= sigbru
MAIN		= sigbru.C

all : all_      # Just to insure that it's first

INTERFACES	= sigbruApplShell.C \
	statDiag.C \
	errDiag.C 


sigbruApplShell.o   : sigbruApplShell.C
	${CXX} ${CCFLAGS_RELAXED} sigbruApplShell.C
statDiag.o   : statDiag.C
	${CXX} ${CCFLAGS_RELAXED} statDiag.C
errDiag.o   : errDiag.C
	${CXX} ${CCFLAGS_RELAXED} errDiag.C

APPL_SRCS       = sigbruFunc.C
APPL_OBJS       = ${APPL_SRCS:.C=.o}


SIGBRU_SRCS = $(MAIN) $(INTERFACES) $(APPL_SRCS)
SIGBRU_OBJS = $(MAIN:.C=.o) $(INTERFACES:.C=.o) $(APPL_OBJS)

INITDVD         = init_sigbru_dvd

INITDVD_SRCS    = init_sigbru_dvd.C
INITDVD_OBJS    = ${INITDVD_SRCS:.C=.o}



LLIBS            = -luxsig -lXpm -lXm -lXt -lX11 \
                   -lconfig -lmisc -luser -lm  ${LSEARCH_BSD}


all_ :		$(SIGBRU) $(INITDVD)


MKDEPEND_CSRCS = ${SIGBRU_SRCS} ${INITDVD_SRCS}
depend: makefile.d

makefile.d:
	touch makefile.d
	makedepend -fmakefile.d -- ${CFLAGS} -- ${MKDEPEND_CSRCS}


$(SIGBRU): $(SIGBRU_OBJS)
	$(CXX) $(LD_OPT) $(SIGBRU_OBJS) $(LDFLAGS) $(LLIBS) -o $(SIGBRU)
	@strip $(SIGBRU)
	@rootchown operator $(SIGBRU)
	@rootchmod 775 $(SIGBRU)
	@rootchown operator *.rf
	@rootchmod 664 *.rf

$(INITDVD): $(INITDVD_OBJS)
	$(CXX) $(LD_OPT) $(INITDVD_OBJS) $(LDFLAGS) $(LLIBS) -o $(INITDVD)
	@strip $(INITDVD)
	@rootchown  root $(INITDVD)
	@rootchmod 6775 $(INITDVD)

install:	$(SIGBRU) $(INITDVD) 
		rootcp -p $(SIGBRU) ${IRIS_BIN}
		rootcp -p $(INITDVD) ${IRIS_BIN}
		cat *.rf > temp.rf
		rootcp -p temp.rf $(IRIS_APP_DEFAULTS)$(SIGBRU)
		rootcp -p temp.rf /usr/lib/X11/app-defaults/$(SIGBRU)
		rm temp.rf
		( cd ${IRIS_BIN} ; \
		  rootchown operator ${SIGBRU} ; rootchmod 775 ${SIGBRU})
		( cd ${IRIS_BIN} ; \
		  rootchown root ${INITDVD} ; rootchmod 6775 ${INITDVD})
		( cd ${IRIS_APP_DEFAULTS} ; \
		  rootchown operator ${SIGBRU} ; rootchmod 664 ${SIGBRU})
		( cd /usr/lib/X11/app-defaults ; \
		  rootchown operator ${SIGBRU} ; rootchmod 664 ${SIGBRU})
		rootcp sigbrush ${IRIS_BIN}
		( cd ${IRIS_BIN} ; \
		rootchown operator sigbrush ; rootchmod 775 sigbrush )

cleanexe:;	rm -f $(SIGBRU) $(INITDVD) core
clean:		cleanexe
		rm -f *.o *.d *.d.bak

-include makefile.d
