#########################################################################
#
#       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-11-01 10:41:30 -0500 (Wed, 01 Nov 2006) $ 		$Revision: 17932 $
#########################################################################
CUR_REL_PATH := "utils/sigbru"

include ../../config.mk

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

INTERFACES	= sigbruApplShell.C \
	statDiag.C \
	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}

MKDEPEND_CSRCS = ${SIGBRU_SRCS} ${INITDVD_SRCS}

all: $(SIGBRU) $(INITDVD)

depend: makefile.d

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

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

$(SIGBRU): $(SIGBRU_OBJS)
	$(CXX) $(LD_OPT) $^ $(LDFLAGS) $(LLIBS) -o $@

$(INITDVD): $(INITDVD_OBJS)
	$(CXX) $(LD_OPT) $^ $(LDFLAGS) $(LLIBS) -o $@

install: all ${IRIS_BIN} ${SIGBRU}.rf
	install -m 0775 -o ${IRIS_USER} -g ${IRIS_GROUP} -s ${SIGBRU}  ${IRIS_BIN}
	install -m 0775 -o ${IRIS_USER} -g ${IRIS_GROUP}    sigbrush   ${IRIS_BIN}
	install -m 6775 -o root -g ${IRIS_GROUP} -s ${INITDVD} ${IRIS_BIN}
	install -m 0664 -o ${IRIS_USER} -g ${IRIS_GROUP} \
			${SIGBRU}.rf $(IRIS_APP_DEFAULTS)/$(SIGBRU)
	install -m 0664 ${SIGBRU}.rf $(SYS_APP_DEFAULTS)/$(SIGBRU)

uninstall:
	rm -f $(IRIS_APP_DEFAULTS)/$(SIGBRU) $(SYS_APP_DEFAULTS)/$(SIGBRU)
	cd ${IRIS_BIN}; rm -f ${SIGBRU} ${INITDVD} sigbrush

cleanexe:
	rm -f $(SIGBRU) $(INITDVD) core

clean: cleanexe
	rm -f *.o *~ *.d *.d.bak

install_src: ${INST_SRC_DIR}
	install -m 0664 -o ${IRIS_USER} -g ${IRIS_GROUP} Makefile \
	sigbrush  tape_backup \
	*.[Chi] *.prj *.op *.rf ${INST_SRC_DIR}

uninstall_src:
	rm -rf ${INST_SRC_DIR}

-include makefile.d
