4.2. Compiling the Plug-in Example

The makefile in Example 4.2, “Makefile” can compile the example.
This example assumes that the source code is stored in srchxmpl.c and that the plug-in being compiled is srchxmpl.so. Additionally, the 389-ds-base-devel package must have been installed or the header file, slapi-plugin.h, is in /usr/include/dirsrv specified in the include path. Otherwise, specify -I /path/to/slapi-plugin.h in the CFLAGS directive.

Example 4.2. Makefile

# Makefile for Directory Server plug-in examples
#
CC = gcc
LD = gcc
CFLAGS = -fPIC -I /usr/include/nspr4 -Wall
LDFLAGS = -shared -z defs -L/usr/lib64/dirsrv -lslapd
OBJS = srchxmpl.o
all: srchxmpl.so
srchxmpl.so: $(OBJS)
	$(LD) $(LDFLAGS) -o $@ $(OBJS)
.c.o:
	$(CC) $(CFLAGS) -c $<
clean:
	-rm -f $(OBJS) srchxmpl.so