Sample Makefile
The sample Makefile (makefile.ex) is updated with the rules and information about building 64-bit clients.
The sample Makefile lists the 64-bit compilers or linkers to be used along with the relevant flags to be passed. It also lists the 64-bit libraries, needed to build the customized LDAP clients.
The following sample shows the makefile for
64-bit Linux®:
#----------------------------------------------------------------------
#
# ABSTRACT: makefile to generate the example LDAP client programs
#
# Licensed Materials - Property of IBM
#
# 5724-J39
#
# (C) Copyright IBM Corp. 1997, 2007 All Rights Reserved
#
# US Government Users Restricted Rights - Use, duplication or
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
#
#----------------------------------------------------------------------
# Copyright (c) 1994 Regents of the University of Michigan.
# All rights reserved.
#
# Redistribution and use in source and binary forms are permitted
# provided that this notice is preserved and that due credit is given
# to the University of Michigan at Ann Arbor. The name of the University
# may not be used to endorse or promote products derived from this
# software without specific prior written permission. This software
# is provided ``as is'' without express or implied warranty.
#----------------------------------------------------------------------
#
# This makefile will build the example programs whose source is contained
# in this directory. The four programs generated are:
# ldapsearch
# ldapmodify
# ldapadd (a hard-link to ldapmodify)
# ldapmodrdn
# ldapdelete
# ldapchangepwd
# ldapexop
# In addition to being the examples of use of the LDAP client api, these
# programs are useful command line utilities. See the README file for
# more details.
#
# default definitions for Unix utilities (may be changed here)
CC = gcc
RM = rm -f
HARDLN = ln
MKDIR = mkdir -p
# The following variable indicates the architecture of the output binaries
# on using this Makefile.
BITS = 64
#############################################################################
## General compiler options ##
#############################################################################
DEFINES = -DLINUX -D_GCC3
#Note: Append the path to appropriate LDAP headers if not already present
#in the include list.
INCLUDES = -I/opt/ibm/ldap/V6.4/include -I../include -I/usr/include
#############################################################################
## Options for building 32-bit targets on AMD64 Linux
#############################################################################
#-----------------------------------------------------------------
# Use the following definition to link the sample programs with
# the shared LDAP library dynamically.
# CLIENT_LIBS = -lidsldif -libmldap -libmldapdbg -lidsldapiconv
# LIBS = -L/opt/ibm/ldap/V6.4/lib -L/usr/lib -lpthread -ldl
#-----------------------------------------------------------------
# Or use this definition to link the LDAP library statically:
# CLIENT_LIBS = -libmldapstatic -lidsldifstatic
# LIBS = -L/opt/ibm/ldap/V6.4/lib -L../lib -L/usr/lib -lpthread -ldl
#-----------------------------------------------------------------
# LFLAGS = -Wl,-rpath,/opt/ibm/ldap/V6.4/lib $(LIBS) $(CLIENT_LIBS)
# CFLAGS = $(INCLUDES) $(DEFINES) -m32
#############################################################################
## Options for building 64 bit targets on AMD64 Linux
#############################################################################
#----------------------------------------------------------------
# Use the following definition to link the sample programs with
# the shared LDAP library dynamically
CLIENT_LIBS = -lidsldif -libmldap -libmldapdbg -lidsldapiconv
LIBS = -L/opt/ibm/ldap/V6.4/lib64 -L/usr/lib64 -lpthread -ldl
#----------------------------------------------------------------
# Or use this definition to link the LDAP library statically
# CLIENT_LIBS = -libmldapstatic -lidsldifstatic
# LIBS = -L/opt/ibm/ldap/V6.4/lib64 -L../lib64 -L/usr/lib64 -lpthread -ldl
#----------------------------------------------------------------
LFLAGS = -Wl,-rpath,/opt/ibm/ldap/V6.4/lib64 $(LIBS) $(CLIENT_LIBS)
CFLAGS = $(INCLUDES) $(DEFINES)
#############################################################################
## Targets ##
#############################################################################
all: ldapsearch ldapmodify ldapdelete ldapmodrdn ldapadd ldapchangepwd ldapexop
ldapsearch:
$(MKDIR) $(BITS)
$(CC) $(CFLAGS) -o $(BITS)/$@ ldapsearch.c $(LFLAGS)
ldapmodify:
$(MKDIR) $(BITS)
$(CC) $(CFLAGS) -o $(BITS)/$@ ldapmodify.c $(LFLAGS)
ldapdelete:
$(MKDIR) $(BITS)
$(CC) $(CFLAGS) -o $(BITS)/$@ ldapdelete.c $(LFLAGS)
ldapmodrdn:
$(MKDIR) $(BITS)
$(CC) $(CFLAGS) -o $(BITS)/$@ ldapmodrdn.c $(LFLAGS)
ldapchangepwd:
$(MKDIR) $(BITS)
$(CC) $(CFLAGS) -o $(BITS)/$@ ldapchangepwd.c $(LFLAGS)
ldapexop:
$(MKDIR) $(BITS)
$(CC) $(CFLAGS) -o $(BITS)/$@ ldapexop.c $(LFLAGS)
ldapadd: ldapmodify
$(RM) $(BITS)/$@
$(HARDLN) $(BITS)/ldapmodify $(BITS)/ldapadd
clean:
$(RM) *.o core a.out $(BITS)/*.o $(BITS)/core $(BITS)/a.out $(BITS)/ldapsearch \
$(BITS)/ldapmodify $(BITS)/ldapdelete \
$(BITS)/ldapmodrdn $(BITS)/ldapadd $(BITS)/ldapchangepwd $(BITS)/ldapexopThe following example shows a sample makefile for
64-bit Windows operating
system:
#
#
#----------------------------------------------------------------------
#
# ABSTRACT: makefile to generate the example LDAP client programs
#
# Licensed Materials - Property of IBM
#
# 5724-J39
#
# (C) Copyright IBM Corp. 1997, 2007 All Rights Reserved
#
# US Government Users Restricted Rights - Use, duplication or
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
#
#----------------------------------------------------------------------
# Copyright (c) 1994 Regents of the University of Michigan.
# All rights reserved.
#
# Redistribution and use in source and binary forms are permitted
# provided that this notice is preserved and that due credit is given
# to the University of Michigan at Ann Arbor. The name of the University
# may not be used to endorse or promote products derived from this
# software without specific prior written permission. This software
# is provided ``as is'' without express or implied warranty.
#----------------------------------------------------------------------
#
# This makefile will build the example programs whose source is contained
# in this directory. The four programs generated are:
# ldapsearch
# ldapmodify
# ldapadd (a hard-link to ldapmodify)
# ldapmodrdn
# ldapdelete
# ldapchangepwd
# ldapexop
# In addition to being the examples of use of the LDAP client api, these
# programs are useful command line utilities. See the LDAP Programming
# Reference for more details.
#
# default definitions for client utilities (may be changed here)
CC = $(SDKROOT)\bin\win64\x86\AMD64\cl.exe
LD = $(SDKROOT)\bin\win64\x86\AMD64\link.exe
RM = del /f
HARDLN = copy
MKDIR = md
# Specify the directory where the C SDK is installed. In our case the Feb 2003
# version of the VC SDK was used.
SDKROOT = C:\sdk\ms\2003_sp1
# Specify the directory where ISDS 6.4 clients are installed
INSTALLROOT = C:\Progra~1\IBM\ldap\V6.4
# The following variable indicates the architecture of the output binaries
# on using this Makefile.
BITS = 64
#############################################################################
## General compiler options ##
#############################################################################
DEFINES = /DNDEBUG /DWIN32 /D_CONSOLE /D_MBCS /DNT
INCLUDES = /I$(INSTALLROOT)\include /I../include /I$(SDKROOT)\include\crt
/I$(SDKROOT)\include\crt\sys /I$(SDKROOT)\include
CFLAGS = /nologo /MD /EHsc /Od $(INCLUDES) $(DEFINES) /Fo$(BITS)/
#############################################################################
## Options for building 64-bit targets for Windows (AMD64) ##
#############################################################################
LIBS = kernel32.lib uuid.lib msvcrt.lib oldnames.lib Wsock32.lib
AdvAPI32.lib bufferoverflowu.lib
#----------------------------------------------------------------------
# Use the following definition to link the sample programs with
# the LDAP shared library.
CLIENT_LIBS = libidsldap.lib libibmldapdbg.lib libidsldifstatic.lib
LDIR = /LIBPATH:$(INSTALLROOT)\lib64 /LIBPATH:$(SDKROOT)\Lib\AMD64
#----------------------------------------------------------------------
# Use the following definition to link the sample programs statically.
#CLIENT_LIBS = libibmldapdbgstatic.lib libidsldapstatic.lib libidsldifstatic.lib
#LDIR = /LIBPATH:$(INSTALLROOT)\lib64 /LIBPATH:..\lib64 /LIBPATH:$(SDKROOT)\Lib\AMD64
#----------------------------------------------------------------------
LFLAGS = /nologo /subsystem:console /incremental:no \
$(LDIR) $(LIBS) $(CLIENT_LIBS)
# Note : In case the libraries aren't picked up using the above syntax, modify
# the env. variable PATH & LIB to point to the path of the requisite libraries.
#
#############################################################################
## Targets ##
#############################################################################
all: ldapsearch.exe ldapmodify.exe ldapdelete.exe ldapmodrdn.exe
ldapadd.exe ldapchangepwd.exe ldapexop.exe
ldapsearch.exe: $(BITS)/ldapsearch.obj $(BITS)/getopt.obj
-@ $(MKDIR) $(BITS)
$(CC) $(CFLAGS) /c getopt.c
$(CC) $(CFLAGS) /c ldapsearch.c
$(LD) $(LFLAGS) /out:$(BITS)/$@ $**
$(RM) $(BITS)\*.obj $(BITS)\*.exp $(BITS)\*.lib
ldapmodify.exe: $(BITS)/ldapmodify.obj $(BITS)/getopt.obj
-@ $(MKDIR) $(BITS)
$(CC) $(CFLAGS) /c getopt.c
$(CC) $(CFLAGS) /c ldapmodify.c
$(LD) $(LFLAGS) /out:$(BITS)/$@ $**
$(RM) $(BITS)\*.obj $(BITS)\*.exp $(BITS)\*.lib
ldapdelete.exe: $(BITS)/ldapdelete.obj $(BITS)/getopt.obj
-@ $(MKDIR) $(BITS)
$(CC) $(CFLAGS) /c getopt.c
$(CC) $(CFLAGS) /c ldapdelete.c
$(LD) $(LFLAGS) /out:$(BITS)/$@ $**
$(RM) $(BITS)\*.obj $(BITS)\*.exp $(BITS)\*.lib
ldapmodrdn.exe: $(BITS)/ldapmodrdn.obj $(BITS)/getopt.obj
-@ $(MKDIR) $(BITS)
$(CC) $(CFLAGS) /c getopt.c
$(CC) $(CFLAGS) /c ldapmodrdn.c
$(LD) $(LFLAGS) /out:$(BITS)/$@ $**
$(RM) $(BITS)\*.obj $(BITS)\*.exp $(BITS)\*.lib
ldapchangepwd.exe: $(BITS)/ldapchangepwd.obj $(BITS)/getopt.obj
-@ $(MKDIR) $(BITS)
$(CC) $(CFLAGS) /c getopt.c
$(CC) $(CFLAGS) /c ldapchangepwd.c
$(LD) $(LFLAGS) /out:$(BITS)/$@ $**
$(RM) $(BITS)\*.obj $(BITS)\*.exp $(BITS)\*.lib
ldapexop.exe: $(BITS)/ldapexop.obj $(BITS)/getopt.obj
-@ $(MKDIR) $(BITS)
$(CC) $(CFLAGS) /c getopt.c
$(CC) $(CFLAGS) /c ldapexop.c
$(LD) $(LFLAGS) /out:$(BITS)/$@ $**
$(RM) $(BITS)\*.obj $(BITS)\*.exp $(BITS)\*.lib
ldapadd.exe: ldapmodify.exe
-@ del /f $(BITS)/$@
$(HARDLN) $(BITS)\ldapmodify.exe $(BITS)\ldapadd.exe
clean:
$(RM) *.obj *.exe *.exp *.lib $(BITS)\*.obj $(BITS)\*.exe $(BITS)\*.exp
$(BITS)\*.lib
$(BITS)/getopt.obj: getopt.c
$(BITS)/ldapsearch.obj: ldapsearch.c
$(BITS)/ldapmodify.obj: ldapmodify.c
$(BITS)/ldapdelete.obj: ldapdelete.c
$(BITS)/ldapmodrdn.obj: ldapmodrdn.c
$(BITS)/ldapchangepwd.obj: ldapchangepwd.c
$(BITS)/ldapexop.obj: ldapexop.cYou can find the sample Makefile (makefile.ex) in ldap_home/examples.