LOTUS = /opt/ibm/lotus

# set TARGET to the name of the executable to create
TARGET = libdsapilogin.so

# set SOURCES to the list of C source files in this program
SOURCES = dsapilogin.c

# set HEADERS to the list of C include files in this program
HEADERS =

# set OBJECTS to the list of object files that must be linked
OBJECTS = dsapilogin.o

# Link this program with the bootstrap code notes0.o because
# this program is structured as a NotesMain.
#BOOTOBJS = $(LOTUS)/notesapi/lib/linux/notes0.o $(LOTUS)/notesapi/lib/linux/notesai0.o

# CC defines the compiler.
CC = gcc

# Set CCOPTS - the compiler options.
#CCOPTS = -c -mcpu=i486
# You may use -g flag for debugging:
CCOPTS = -c -m32 -march=i486

# set NOTESDIR to specify where to search for the Notes library file
#NOTESDIR = $(Notes_ExecDirectory)
NOTESDIR = /opt/ibm/lotus/notes/latest/linux

# Set LINKOPTS - the linker options passed to CC when linking.
# -o $(TARGET) causes compiler to create target rather than a.out
LINKOPTS = -o $(TARGET) -shared -fpic -Wl,-R$(NOTESDIR)

# Notes API header files require UNIX to be defined.
#DEFINES =  -DUNIX -DLINUX -DLINUX86 -DW -DW32 -DDTRACE -DPTHREAD_KERNEL -D_REENTRANT -DUSE_THREADSAFE_INTERFACES -D_POSIX_THREAD_SAFE_FUNCTIONS  -DHANDLE_IS_32BITS -DHAS_IOCP -DHAS_BOOL -DHAS_DLOPEN -DUSE_PTHREAD_INTERFACES -DLARGE64_FILES -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE   -DPRODUCTION_VERSION -DOVERRIDEDEBUG  -fPIC
DEFINES = -DUNIX -DLINUX  -DHANDLE_IS_32BITS

# set INCDIR to specify where to search for include files
INCDIR = $(LOTUS)/notesapi/include

# set LIBS to list all the libraries ld should link with.
#LIBS = -lnotes -lm -lnsl -lc -ldl -lpthread -lresolv -m32
LIBS = -lnotes  -lpthread -lc -m32 -lm -lnsl -lresolv -ldl

# the executable depends on the objects.
#$(CC) $(LINKOPTS) $(OBJECTS) $(BOOTOBJS) -L$(NOTESDIR) -Wl,-rpath-link $(NOTESDIR) $(LIBS)
$(TARGET): $(OBJECTS)
	$(CC) $(LINKOPTS) $(OBJECTS) $(BOOTOBJS) -L$(NOTESDIR) $(LIBS)

# the object files depend on the corresponding source files
.c.o:
	$(CC) $(CCOPTS) $(DEFINES) -I$(INCDIR) $(SOURCES)

clean:
	rm libdsapilogin.so dsapilogin.o

install:
	cp $(TARGET) $(NOTESDIR)