#########################################################################
#
#       MAKEFILE FOR STAND-ALONE XT CODE APPLICATION.  
#
#       EXECUTABLE      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-12-14 17:23:23 -0500 (Thu, 14 Dec 2006) $ 		$Revision: 18081 $
#########################################################################
CUR_REL_PATH := "utils/zauto7"

include ../../config.mk

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

CFLAGS		= -c ${DEBUGFLAG} ${C_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../../libs/lib -L${IRIS_ROOT}/libs/lib ${LPATH_X11}

LANGUAGE        = C++
EXECUTABLE	= zauto7
MAIN		= zauto7.C

INTERFACES	= zauto7ApplShell.C \
	configMenuDiag.C \
	updateMenuDiag.C \
	viewCalMenuDiag.C \
	idMenuDiag.C 

APPL_SRCS       = fit.C \
                  initLoadSave.C \
                  limits.C \
                  config.C \
                  noise.C \
                  point.C \
                  update.C \
                  nexrad.C \
                  noXWin.C
APPL_OBJS = ${APPL_SRCS:.C=.o}

CC_SRCS = $(MAIN) $(INTERFACES) $(APPL_SRCS)
CC_OBJS = $(MAIN:.C=.o) $(INTERFACES:.C=.o) $(APPL_OBJS)

LLIBS  = -lXpm -luxsig -lXm -lXt -lX11 -ldsp -lantenna \
	 -lconfig -luser -ltvsubs -lfileformats ${LTIFF} ${LJPEG} \
	-lm ${LSEARCH_BSD} -lz

MKDEPEND_CSRCS = ${CC_SRCS}

all: $(EXECUTABLE)

depend: makefile.d

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

zauto7ApplShell.o : zauto7ApplShell.C
	${CXX} ${CCFLAGS_RELAXED} $<
updateMenuDiag.o : updateMenuDiag.C
	${CXX} ${CCFLAGS_RELAXED} $<
viewCalMenuDiag.o : viewCalMenuDiag.C
	${CXX} ${CCFLAGS_RELAXED} $<
configMenuDiag.o : configMenuDiag.C
	${CXX} ${CCFLAGS_RELAXED} $<
idMenuDiag.o : idMenuDiag.C
	${CXX} ${CCFLAGS_RELAXED} $<

$(EXECUTABLE): $(CC_OBJS)
	$(CXX) $(LD_OPT) $^ $(LDFLAGS) $(LLIBS) -o $@

install: all ${IRIS_BIN} ${IRIS_APP_DEFAULTS} ${EXECUTABLE}.rf
	install -m 0775 -o ${IRIS_USER} -g ${IRIS_GROUP} -s $(EXECUTABLE) ${IRIS_BIN}
	ln -sf ./zauto7 ${IRIS_BIN}/zauto; chown ${IRIS_USER}:${IRIS_GROUP} ${IRIS_BIN}/zauto
	install -m 0664 -o ${IRIS_USER} -g ${IRIS_GROUP} \
			${EXECUTABLE}.rf $(IRIS_APP_DEFAULTS)/$(EXECUTABLE)
	install -m 0664 ${EXECUTABLE}.rf $(SYS_APP_DEFAULTS)/$(EXECUTABLE)

uninstall:
	rm -f   $(IRIS_APP_DEFAULTS)/$(EXECUTABLE) \
		$(SYS_APP_DEFAULTS)/$(EXECUTABLE)  \
		${IRIS_BIN}/zauto ${IRIS_BIN}/$(EXECUTABLE)

cleanexe:
	rm -f $(EXECUTABLE) core

cleanux:
	rm -f UxXt.c UxXt.h UxMethod.c

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

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

uninstall_src:
	rm -rf ${INST_SRC_DIR}

-include makefile.d
