#########################################################################
#
#       MAKEFILE FOR STAND-ALONE XT CODE APPLICATION.  
#
#       RUNWAYS      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-10-31 16:27:28 -0500 (Tue, 31 Oct 2006) $ 		$Revision: 17922 $
#########################################################################
CUR_REL_PATH := "utils/llwas"

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../../libs/lib -L${IRIS_ROOT}/libs/lib ${LPATH_X11}

LANGUAGE        = C++
RUNWAYS	= runways
MAIN		= runways.C

INTERFACES	= runwaysApplShell.C 


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

MISC_CC_SRCS    = LoadSetup.C
MISC_CC_OBJS    = ${MISC_CC_SRCS:.C=.o}


RUNWAYS_CC_SRCS = $(MAIN) $(INTERFACES) $(APPL_SRCS) $(MISC_CC_SRCS)
RUNWAYS_CC_OBJS = $(MAIN:.C=.o) $(INTERFACES:.C=.o) \
                $(APPL_OBJS) $(MISC_CC_OBJS)

LLWAS_EXE =     tdwr_llwas_int    
LLWAS_CC_SRCS = tdwr_llwas_int.C LoadSetup.C Output.C Process.C
LLWAS_CC_OBJS = ${LLWAS_CC_SRCS:.C=.o}

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

MKDEPEND_CSRCS = ${RUNWAYS_CC_SRCS} ${LLWAS_CC_SRCS}

all: $(RUNWAYS) $(LLWAS_EXE)

depend: makefile.d

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

runwaysApplShell.o   : runwaysApplShell.C
	${CXX} ${CCFLAGS_RELAXED} runwaysApplShell.C

$(RUNWAYS): $(RUNWAYS_CC_OBJS)
	$(CXX) $(LD_OPT) $^ $(LDFLAGS) $(LLIBS) -o $@

$(LLWAS_EXE):  $(LLWAS_CC_OBJS)
	${CXX} ${LD_OPT} $^ $(LDFLAGS) \
		-lmisc -lconfig -ldspi -lhimath -luser -lm ${LSEARCH_BSD} -o $@

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

uninstall:
	rm -f $(IRIS_APP_DEFAULTS)/$(RUNWAYS) \
	      $(SYS_APP_DEFAULTS)/$(RUNWAYS)  \
	      ${IRIS_BIN}/$(RUNWAYS) ${IRIS_BIN}/$(LLWAS_EXE)

cleanexe:
	rm -f $(RUNWAYS) $(LLWAS_EXE) core

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

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

uninstall_src:
	rm -rf ${INST_SRC_DIR}

-include makefile.d
