# Makefile for c-toaster C++ example
#
#   yp-client/c-toaster-tls directory
#

ifdef MAC
 INSTALL_PREFIX ?= /usr/local
else
 INSTALL_PREFIX ?= /usr
endif

############### SOURCE PROFILE ##############################
PROJECT_NM=yumapro
SUBDIR_NM=yp-client
SUBDIR_CPP=

SOURCE=c-toaster-tls.c

VERSION=-std=c99
PTHREADS=-pthread
FLAGS=-D_DEFAULT_SOURCE=1 -DPTHREADS=1

ifdef DEBUG
FLAGS+=-ggdb
else
FLAGS+=-g
endif


############### TARGET PROFILE ##############################
# files located in /usr/share/yumapro
TOP_INSTALL=$(DESTDIR)$(INSTALL_PREFIX)/share/yumapro
INSTALL_TARGET=$(TOP_INSTALL)/src/$(SUBDIR_NM)

TARGET=$(TBASE)/$(SUBDIR_NM)
BIN_INST=.
REAL_INST=$(DESTDIR)$(INSTALL_PREFIX)/bin

PROG=c-toaster-tls


##################### LIBRARIES ########################

# The order of these LIBS matters!
#
# If the linker can't find external symbols you know should
# be there and you get an Unresolved External error
#   file foo : unresolved external to bar
# Then put the library that contains 'foo' BEFORE the one
# that contains 'bar'.
#

# if the target is DEBIAN or RPM package, then
# the include files are here
INC_BASE=$(DESTDIR)$(INSTALL_PREFIX)/include/$(PROJECT_NM)

LIBS=-lyumapro_ycli -lyumapro_mgr -lyumapro_ncx -lyumapro_subsys-pro -lssl -lcrypto -lssh2 -lstdc++ -lcrypt

INCLUDES=-I$(INC_BASE)/ycli -I$(INC_BASE)/mgr -I$(INC_BASE)/ncx -I$(INC_BASE)/platform -I${SYSROOT}/usr/include/libxml2/libxml -I${SYSROOT}/usr/include/libxml2

############################# MAKE RULES ##################
all: $(PROG)

clean:
	rm -f $(PROG)

superclean: clean

test:

# blank as this is just example code and the output file is stored in the example directory
install:

uninstall:

distclean: clean

# this real rule keeps make from deleting the $(OBJS) as
# intermediate files
c-toaster-tls:
	gcc $(FLAGS) $(VERSION) $(INCLUDES) $(PTHREADS) -o $(PROG) $(SOURCE) $(LIBS)

.PHONY: all clean superclean test install uninstall

# prevent the make program from choking on all the symbols
# that get generated from autogenerated make rules
.NOEXPORT:
