########################################################################
# 
#    	MAKEFILE FOR STAND-ALONE UX CODE APPLICATION.
#
#       EXECUTABLE      is the name of the executable to be created 
#       MAIN            is the .o 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. 
#
#  	$Date: 2005-11-16 14:21:07 $ 		$Revision: 1.2 $
# 
# 051111        last modif
#########################################################################


include ../../../local/default.mk

MAIN		= XFilter.o
INTERFACES	= 	MainFilt.o \
	WaveShell.o \
	WaveBShell.o \
	HelpFShell.o \
	AskShell.o \
	ModelShell.o \
	FilterCreate.o \
	BruzualModel.o \
	ChooseList.o \
	BlackBody.o \
	CloudyModel.o \
	NewsShell.o \
	LeaksShell.o 

EXEC		= filter
EXECUTABLE	= ../../exec/$(EXEC).exe




APPL_OBJ_T=     conv_photon.o   \
                read.o          read_trans.o    \
                lec_data.o      set_range.o     \
                init_model.o    set_model.o     \
                def_inst.o      set_grism.o     \
                do_convo.o      do_trans.o      \
                save_mod.o      load_mod.o      \
                interpol.o      \
                random.o        \
                s_eso.o
APPL_OBJ_F=     do_creafilter.o \
                set_creafilter.o

APPL_OBJ_B=     dummy_bruzual_cloudy.o

APPL_OBJ_A=     message.o       init_filter.o   \
                read_ccdchar.o  misc.o          list.o  \
                save_filt.o     load_filt.o        \
                save_curve.o    load_curve.o    \
                between.o

APPL_DB =       search.o read_filtchar.o        aglgraph.o
 
APPL_OBJ_BB=    create_bbody.o  set_bbody.o     do_bbody.o popup_flx.o

APPL_OBJS=      $(APPL_OBJ_A) $(APPL_OBJ_B) $(APPL_OBJ_BB)  \
                $(APPL_OBJ_F) $(APPL_OBJ_T) $(APPL_DB)

UX_DIR		= ../../GraphLib/libsrc/$(UIMX)

LINC		= ../../incl
GINC            = ../incl

UX_LIBPATH	= -L../../lib

X_CFLAGS	=
MOTIF_CFLAGS	=

CFLAGS		+= $(C_OPT) $(DEBUG) $(GUI_OPT) \
		  -I$(LINC) -I$(INC) -I$(GINC) -I$(UX_DIR)/include \
		  $(X_CFLAGS) $(MOTIF_CFLAGS) -DXOPEN_CATALOG \
		  $(XMINC)    $(X11INC)

# The following object files are provided to work around a motif bug.
# They are not necessarily needed to compile your application.
LIBPATH		= $(X11_LIBPATH) $(MOTIF_LIBPATH)
XLIB		= $(LIBPATH) $(X_LIBS) $(XOPEN_LIBS)

LLIB            = $(UX_LIBPATH) -luimx -lcom -L$(LIBDIR)  \
		  -lxcon -lgmidas -lmidas
LIBS		= $(LIBDIR)/libxcon.a \
		  $(LIBDIR)/libmidas.a

OBJS = $(MAIN) $(INTERFACES) $(APPL_OBJS)  

all: $(EXECUTABLE) 

$(EXECUTABLE): $(OBJS) $(LIBS)
	$(LDCC) $(OBJS) $(LLIB) $(XLIB) $(MLIB) $(SLIB) -o $(EXECUTABLE)
	$(STRIP) $(EXECUTABLE)
	@echo "done"

clean:
	$(RM) $(OBJS)

clean_exec:
	$(RM) $(EXECUTABLE)


tmp_makefile: makefile
	sed -e 's/^MAIN.*//' \
	    -e 's/^INTERFACES.*//' \
	    -e 's/^CMAIN/MAIN/' \
	    -e 's/^CINTERFACES/INTERFACES/' \
	    -e 's/\([^^]\)\.o/\1\.o/g'  \
	    -e 's/^all: tmp_makefile/all:/' makefile > tmp_makefile
	rm -f makefile
	mv tmp_makefile makefile







