#################################################################################
#
# makefile.linux - Makefile for compiling and linking the offline GC GemStone
#                  6.x user action library.
#
# $GEMSTONE must be set to reference a 6.x GEMSTONE directory tree, 
# **not** a GemStone64 tree.
#
# Note: Caller must set CC and LD environment variables.  For example:
#
# export CC=/usr/local/bin/g++
# export LD=/usr/local/bin/g++
#
# $Id: makefile.linux,v 1.1 2007-09-14 22:41:16 normg Exp $
#
#################################################################################

CC_FLAGS = -c -O2 -m32 -pthread -fno-strict-aliasing -D_REENTRANT -D_GNU_SOURCE -fpic
LD_FLAGS = -Wl,-Bsymbolic -shared -Wl,-h$@ -melf_i386
LD_LIBS =  -Wl,-Bdynamic -lpthread -lcrypt -ldl -lrt -lc -lm
TARGET_DIR = ./linux

$(TARGET_DIR)/offlinegc6x.so: $(TARGET_DIR)/offlinegc6x.o
	$(CC) $(LD_FLAGS) -o $(TARGET_DIR)/libofflinegc6x.so $(TARGET_DIR)/offlinegc6x.o $(GEMSTONE)/lib/gciualib.o $(LD_LIBS)

$(TARGET_DIR)/offlinegc6x.o: offlinegc6x.cc
	mkdir -p $(TARGET_DIR)
	$(CC) $(CC_FLAGS) -o$(TARGET_DIR)/offlinegc6x.o -I$(GEMSTONE)/include offlinegc6x.cc
