# 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

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

###########################################################################
#DEBUG = -DVERBOSE
###########################################################################
DEBUG = -O 
###########################################################################
###########################################################################
NSOPT = 
###########################################################################
# Allow disk backup of name service contents
#NSOPT = -DDISKBACKUP
###########################################################################

default: $(objdir) $(bindir)\
	$(objdir)/ns_lib.o \
	$(bindir)/name_service

all: $(objdir) $(bindir)\
	$(objdir)/ns_lib.o \
	$(bindir)/ns_dump \
	$(bindir)/ns_dumpall \
	$(bindir)/name_service

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

$(objdir) : 
	mkdir $(objdir)

$(bindir) : 
	mkdir $(bindir)

$(libdir) : 
	mkdir $(libdir)

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

NSOBJS = $(shareobjdir)/snipe_lite.o \
		$(shareobjdir)/msg.o $(shareobjdir)/msgbuf.o \
		$(shareobjdir)/mkpaths.o $(shareobjdir)/daemon.o

OBJS = $(objdir)/ns_lib.o $(NSOBJS)

LIBS = $(SL_LIBS)

$(objdir)/ns_lib.o	:	ns_lib.c $(incdir)/ns_lib.h
	$(CC) $(SOFLAG) $(STDINC) -c ns_lib.c $(SOPT) $(DEBUG) 
	mv ns_lib.o $(objdir)

$(bindir)/name_service		: name_service.c name_service.h 
	$(CC) $(STDINC) name_service.c -o $(bindir)/name_service $(NSOBJS) \
				$(LIBS) -g $(NSOPT)

$(bindir)/ns_dump	: ns_dump.c $(OBJS)
	$(CC) $(STDINC) ns_dump.c -o $(bindir)/ns_dump $(OBJS) $(LIBS) 

$(bindir)/ns_dumpall	: ns_dumpall.c $(OBJS)
	$(CC) $(STDINC) ns_dumpall.c -o $(bindir)/ns_dumpall $(OBJS) $(LIBS) 

clean :
	rm -f *.o $(objdir)/*.o name_service ns_dump ns_dumpall \
				$(bindir)/name_service \
				$(bindir)/ns_dump \
				$(bindir)/ns_dumpall

