# @(#)Makefile	1.2 19 Feb 1997
# Copyright Anton Nikolaev, 1996.
# NO WARRANTIES: use at your own risk. 

# May or may not work on your particular UNIX
# with a particular make implementation.

# Please specify:
#   your operating system;
#   which MAKE you are using.

# your home directory
HOME= /home/as1682/Project

# compiler you are using
CC= g++

# flags you are passing to your compiler
# you should change that to your preferences
#CFLAGS=	-g -Dunix -DUSE_PROTOTYPES -DANSI
CFLAGS=	-g -DGETHOSTBYNAME_R_RETVAL_AS_PTR -Wall

# flags you are passing to your linker
LFLAGS=	

# program as name - please change the one below!
PROG1= demo1 
PROG2= demo2cli 
PROG3= demo2srv

# your C source files
SOURCES= demo1.c demo2cli.c demo2srv.c gwloc.c slptool_bestmatch.c parser.c debug.c
#SOURCES= demo1.cpp gwslp_slptool.c gwslp_parser.c

# object files that have to be generated
OBJECTS= $(SOURCES:%.c=%.o)

#OBJ1= demo1.o gwslp_gwlocator.o gwslp_slptool.o gwslp_parser.o ./libslp/libslp_delattrs.o ./libslp/libslp_dereg.o ./libslp/libslp_findattrs.o ./libslp/libslp_findscopes.o ./libslp/libslp_findsrvs.o ./libslp/libslp_findsrvtypes.o ./libslp/libslp_handle.o ./libslp/libslp_knownda.o ./libslp/libslp_network.o ./libslp/libslp_parse.o ./libslp/libslp_property.o ./libslp/libslp_reg.o ./libslp/libslp_thread.o ./common/slp_buffer.o ./common/slp_linkedlist.o ./common/slp_property.o ./common/slp_xid.o ./common/slp_compare.o ./common/slp_message.o ./common/slp_utf8.o ./common/slp_xmalloc.o ./common/slp_database.o ./common/slp_network.o ./common/slp_v1message.o
OBJ1= demo1.o gwloc.o slptool_bestmatch.o parser.o debug.o ./libslp/libslp_delattrs.o ./libslp/libslp_dereg.o ./libslp/libslp_findattrs.o ./libslp/libslp_findscopes.o ./libslp/libslp_findsrvs.o ./libslp/libslp_findsrvtypes.o ./libslp/libslp_handle.o ./libslp/libslp_knownda.o ./libslp/libslp_network.o ./libslp/libslp_parse.o ./libslp/libslp_property.o ./libslp/libslp_reg.o ./libslp/libslp_thread.o ./common/slp_buffer.o ./common/slp_linkedlist.o ./common/slp_property.o ./common/slp_xid.o ./common/slp_compare.o ./common/slp_message.o ./common/slp_utf8.o ./common/slp_xmalloc.o ./common/slp_database.o ./common/slp_network.o ./common/slp_v1message.o

OBJ2= demo2cli.o gwloc.o slptool_bestmatch.o parser.o debug.o ./libslp/libslp_delattrs.o ./libslp/libslp_dereg.o ./libslp/libslp_findattrs.o ./libslp/libslp_findscopes.o ./libslp/libslp_findsrvs.o ./libslp/libslp_findsrvtypes.o ./libslp/libslp_handle.o ./libslp/libslp_knownda.o ./libslp/libslp_network.o ./libslp/libslp_parse.o ./libslp/libslp_property.o ./libslp/libslp_reg.o ./libslp/libslp_thread.o ./common/slp_buffer.o ./common/slp_linkedlist.o ./common/slp_property.o ./common/slp_xid.o ./common/slp_compare.o ./common/slp_message.o ./common/slp_utf8.o ./common/slp_xmalloc.o ./common/slp_database.o ./common/slp_network.o ./common/slp_v1message.o

OBJ3= demo2srv.o gwloc.o slptool_bestmatch.o parser.o debug.o ./libslp/libslp_delattrs.o ./libslp/libslp_dereg.o ./libslp/libslp_findattrs.o ./libslp/libslp_findscopes.o ./libslp/libslp_findsrvs.o ./libslp/libslp_findsrvtypes.o ./libslp/libslp_handle.o ./libslp/libslp_knownda.o ./libslp/libslp_network.o ./libslp/libslp_parse.o ./libslp/libslp_property.o ./libslp/libslp_reg.o ./libslp/libslp_thread.o ./common/slp_buffer.o ./common/slp_linkedlist.o ./common/slp_property.o ./common/slp_xid.o ./common/slp_compare.o ./common/slp_message.o ./common/slp_utf8.o ./common/slp_xmalloc.o ./common/slp_database.o ./common/slp_network.o ./common/slp_v1message.o

# libraries you want to use, e.g. the math library
#LIBS= -lslp -lnsl
LIBS= -lpthread -lnsl -lstdc++
#LIBS= -lnsl 

# the path to your include files
# change to match your setup
#INCPATH= -I$(HOME)/openslp-1.0.7/libslp	-I$(HOME)/openslp-1.0.7/common
INCPATH= -I$(HOME)/openslp-1.0.7/common -I$(HOME)/openslp-1.0.7/libslp

# the path to your libraries
# change that to your setup
#LIBPATH= -L$(HOME)/openslp-1.0.7/libslp -L$(HOME)/openslp-1.0.7/common
LIBPATH= -L$(HOME)/openslp-1.0.7/common -L$(HOME)/openslp-1.0.7/libslp

# the rule for how to produce object files
.c.o:
	$(CC) $(CFLAGS) $(INCPATH) -c $<

# how to link the final program
$(PROG1): $(OBJ1)
	$(CC) $(LFLAGS) -o $@ $(OBJ1) \
	$(COBJECTS) $(LIBPATH) $(INCPATH) $(LIBS)

$(PROG2): $(OBJ2)
	$(CC) $(LFLAGS) -o $@ $(OBJ2) \
	$(COBJECTS) $(LIBPATH) $(INCPATH) $(LIBS)

$(PROG3): $(OBJ3)
	$(CC) $(LFLAGS) -o $@ $(OBJ3) \
	$(COBJECTS) $(LIBPATH) $(INCPATH) $(LIBS)

#clean up the mess
clean:
	rm *.o $(PROG1) $(PROG2) $(PROG3)


