CC = gcc
LD = gcc
CFLAGS =  -m32 -g -W #-Wall -Werror
LDFLAGS = -Wl,-rpath,/home/y/libexec/java/jre/lib/i386/server -L/home/y/libexec/java/jre/lib/i386/server -ljvm -m32 -shared -Wl,-x 
LINC = -I/home/y/libexec/java/include -I/home/y/libexec/java/include/linux
TESTS = hdfs_test
LIB_NAME = hdfs_c
SHLIB_VERSION = 1 
OBJS = hdfs.o
RM = /bin/rm -f

all: $(LIB_NAME) $(TESTS) 

$(LIB_NAME): $(OBJS)
	$(LD) $(LDFLAGS) -o lib$(LIB_NAME).so.$(SHLIB_VERSION) -Wl,-soname,lib$(LIB_NAME).so.$(SHLIB_VERSION) $(OBJS) \
	&& ln -sf lib$(LIB_NAME).so.$(SHLIB_VERSION) lib$(LIB_NAME).so

$(OBJS): hdfs.c
	$(CC) $(CFLAGS) $(LINC) -c hdfs.c

$(TESTS): hdfs_test.c
	$(CC) $(TESTS).c -L. -l$(LIB_NAME) -m32 -o $(TESTS)

clean:
	$(RM) *.o *.so* $(TESTS) *.log 

