#########################################################################
#
#       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-09-07 00:42:13 -0300 (Thu, 07 Sep 2006) $ 		$Revision: 17575 $
#########################################################################

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

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

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


zautoapplshell.o : zautoapplshell.c
	${CC} ${CFLAGS_RELAXED} zautoapplshell.c
update.o         : update.c
	${CC} ${CFLAGS_RELAXED} update.c
viewcal.o        : viewcal.c
	${CC} ${CFLAGS_RELAXED} viewcal.c
config.o         : config.c
	${CC} ${CFLAGS_RELAXED} 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


all_ :		$(EXECUTABLE)

MKDEPEND_CSRCS = ${C_SRCS}
depend: makefile.d

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

$(EXECUTABLE): $(C_OBJS)
	$(CXX) $(LD_OPT) $(C_OBJS) $(LDFLAGS) $(LLIBS) -o $(EXECUTABLE)
	@rootchown operator $(EXECUTABLE)
	@rootchmod 775 $(EXECUTABLE)
	@rootchown operator *.rf
	@rootchmod 664 *.rf

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


cleanexe:;	rm -f $(EXECUTABLE) core
cleanux:;	rm -f UxXt.c UxXt.h UxMethod.c
clean:		cleanexe cleanux
		rm -f *.o *.d *.d.bak

-include makefile.d
