#########################################################################
#
#       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-11-13 15:16:45 -0500 (Mon, 13 Nov 2006) $ 		$Revision: 17957 $
#########################################################################
CUR_REL_PATH := "utils/zautox"

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        = ANSI C
EXECUTABLE	= zauto6
MAIN		= zauto6.c

INTERFACES	= zautoapplshell.c \
	update.c \
	viewcal.c \
	config.c 


APPL_SRCS       = zafit.c \
                  zainitloadsave.c \
                  zalimits.c \
                  zanoise.c \
                  zapoint.c \
                  zaconfig.c \
                  zaupdate.c \
                  za_no_xwin.c
APPL_OBJS = ${APPL_SRCS:.c=.o}

C_SRCS = $(MAIN) $(INTERFACES) $(APPL_SRCS)
C_OBJS = $(MAIN:.c=.o) $(INTERFACES:.c=.o) $(APPL_OBJS)

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

MKDEPEND_CSRCS = ${C_SRCS}

all: $(EXECUTABLE) ${EXECUTABLE}.rf.tmp

depend: makefile.d

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

zautoapplshell.o : zautoapplshell.c
	${CC} ${CFLAGS_RELAXED} $<
update.o         : update.c
	${CC} ${CFLAGS_RELAXED} $<
viewcal.o        : viewcal.c
	${CC} ${CFLAGS_RELAXED} $<
config.o         : config.c
	${CC} ${CFLAGS_RELAXED} $<

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

${EXECUTABLE}.rf.tmp: config.rf viewcal.rf  zauto6.rf  zautoapplshell.rf
	cat $^ > $@

install: all ${IRIS_BIN} ${IRIS_APP_DEFAULTS}
	install -m 0775 -o ${IRIS_USER} -g ${IRIS_GROUP} -s $(EXECUTABLE) ${IRIS_BIN}
	install -m 0664 -o ${IRIS_USER} -g ${IRIS_GROUP} \
			${EXECUTABLE}.rf.tmp $(IRIS_APP_DEFAULTS)/$(EXECUTABLE)
	install -m 0664 ${EXECUTABLE}.rf.tmp $(SYS_APP_DEFAULTS)/$(EXECUTABLE)

uninstall:
	rm -f $(IRIS_APP_DEFAULTS)/$(EXECUTABLE) \
	      $(SYS_APP_DEFAULTS)/$(EXECUTABLE)   \
	      ${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
