#
# Copyright 2002 Sun Microsystems, Inc. All Rights Reserved
# Use of this product is subject to license terms.
#
# LINUX Makefile for Directory Server plug-in examples
#

CC = gcc
LD = gcc -shared 

LIBDIR        = ../../../../lib
INCLUDE_FLAGS = -I../include
CFLAGS        = $(INCLUDE_FLAGS) -D_REENTRANT -fPIC -Wall
LDFLAGS       = $(CFLAGS)

# We must build 32-bit objects on 64-bit machines if the installed
# libraries are 32-bit.
ifeq ($(shell uname -m),x86_64)
  ifeq ($(shell file -L $(LIBDIR)/libslapd.so | cut -d" " -f3),32-bit)
    CFLAGS      += -m32
  endif
endif

OBJS = dns.o entries.o hello.o internal.o testpwdstore.o testsaslbind.o testextendedop.o testpreop.o testpostop.o testentry.o testbind.o testgetip.o

all: libtest-plugin.so


libtest-plugin.so: $(OBJS)
	$(LD) $(LDFLAGS) -o $@ $(OBJS)

.c.o:
	$(CC) $(CFLAGS) -c $<

clean:
	-rm -f $(OBJS) libtest-plugin.so

