# First to include the conf info depending on the compilers we need etc
# i.e. all options starting with IC_

include ../../conf/system/makeopts-SNIPE_LITE

# For any arch type options
# i.e. anything else like, IMA_ARCH, system call flags etc

include ../../conf/system/makeopts-$(HARNESS_ARCH)

#
# The rest should now be a little puddie kat.
#

# Final build options conf file.
# Yep, how many do we need :)

include ../../conf/makeopts-HARNESS

COMPILE_OPT = $(INTER_OPTS) $(BUILD_OPTS) $(MPI_OPTS)

###########################################################################

# Now for the compilation directories

include ../../conf/system/makeopts-dirs

###########################################################################

###########################################################################

all: $(objdir) \
	$(bindir) \
	$(bindir)/test_all \
	$(bindir)/bmtest \
	$(bindir)/infompi 

###########################################################################

$(objdir) : 
	mkdir $(objdir)

$(bindir) : 
	mkdir $(bindir)

$(libdir) : 
	mkdir $(libdir)

###########################################################################

#Internal objs (when testing components directly and not libraries)
IOBJS = $(hobjdir)/dlo3.o \
	$(hobjdir)/plist.o \
	$(hobjdir)/envs.o \
        $(hobjdir)/names.o \
        $(hobjdir)/id.o \
	$(hobjdir)/http.o \
        $(shareobjdir)/msg.o \
	$(shareobjdir)/msgbuf.o \
	$(shareobjdir)/memory.o \
	$(shareobjdir)/snipe_lite.o \
	$(shareobjdir)/mkpaths.o \
	$(svcobjdir)/ns_lib.o

HLIB = $(libdir)/hlib.a

LIBS = $(SL_LIBS) $(DL_LIBS) 

# This is the combo library tester (as a user would see)

# this is a demo build a plugin tester
$(bindir)/test_all		: test_all.c $(HLIB)
	$(CC) $(SPECFLAGS) $(STDINC) test_all.c -o $(bindir)/test_all $(LIBS) $(HLIB)

$(bindir)/bmtest : bmtest.c $(libdir)/libftmpi.a $(HDRS)
	$(CC) $(STDINC) bmtest.c -o $(objdir)/bmtest $(SOPT) -L$(libdir) -lftmpi $(LIBS) $(DEBUG)
	mv $(objdir)/bmtest $(bindir)

$(bindir)/infompi : infompi.c $(libdir)/libftmpi.a $(HDRS)
	$(CC) $(STDINC) infompi.c -o $(objdir)/infompi $(SOPT) -L$(libdir) -lftmpi $(LIBS) 
	mv $(objdir)/infompi $(bindir)


clean :
	rm -f *.o $(objdir)/*.o $(bindir)/test_all $(bindir)/bmtest $(bindir)/infompi

cleaner :
	rm -f *.o */*.o *~ 

