# HP-UX makefile for module 'sample'

SRC       = sample.c
OBJ       = sample.o
DLL       = sample.sl

CC        = cc
LINK      = ld
RM	  = rm

# CPPFLAGS:		C preprocessor flags
#
#	-DES_DYNAMIC_LINK_USER_PRIMS	Prims in a shared library
#	-DHP720		Setup for HP-UX
#	-D_HPUX_SOURCE 	Enable K&R library compatibility
# 	-I.		es .h files
#
CPPFLAGS   = -DES_DYNAMIC_LINK_USER_PRIMS -DHP720 -D_HPUX_SOURCE -I.

# CFLAGS:		C compiler flags
#
#	-Aa		Enable ANSI extensions
#	-c		Compile only
#	-o $@		Use target as output filename
#	-O		Level 2 optimization
#	+z		Compile PIC
#
CFLAGS     = -Aa -c -o $@ -O +z

# LFLAGS:		Linker flags
#
#	-b		Create shared library
#	-o $@		Use target as output filename
#	-E		Export all defined symbols
# 	+s		Search SHLIB_PATH at runtime
#
LFLAGS     = -b -o $@  -E +s  

# LIBS:
#	-ldld		Dynamic loader library
#	-lm		Math library
#
LIBS      = -ldld -lm
ESLIBS    = -L. -lesvm

all: $(DLL)

clean:
	- $(RM) $(DLL)
	- $(RM) $(OBJ)

$(DLL): $(OBJ) 
	$(LINK) $(OBJ) $(ESLIBS) $(LIBS) $(LFLAGS)
	
$(OBJ): $(SRC)
	$(CC) $(SRC) $(CPPFLAGS) $(CFLAGS)

