#------- Comment/uncomment the following line to enable/disable debugging-------
DEBUG = n

#--------------------------Versions for the library ----------------------------
LIB_VER_MAJOR = 1
LIB_VER_MINOR = 1.3

#-------------------------- Name of the object file ----------------------------
TARGET = zlib.a

#----------------------------- Name of the library------------------------------
COMMON_LIBNAME = libzlib.so

#----------------------------- lint Dump File -------------------------------
LINT_DUMP=libzlib


#------------------------------- Source File -----------------------------------
SRC		=  interface.c adler32.c compress.c crc32.c gzio.c uncompr.c deflate.c trees.c \
       zutil.c inflate.c infblock.c inftrees.c infcodes.c infutil.c inffast.c 

CFLAGS += -O3 -DHAVE_UNISTD_H -DUSE_MMAP
CFLAGS	+= -I$(TOPDIR)/development/common/include/adviser

#--------------WARNING : Donot Modify anything below this line ----------------

#-------------------------------------------------------------------------------
# These are unix (linux) standards for naming shared libraries.
# Stick to these conventions for naming. For details refer 
# Linux HOWTO http://www.tldp.org/HOWTO/Program-Library-HOWTO/introduction.html 
#-------------------------------------------------------------------------------
LINKERNAME = $(COMMON_LIBNAME)
SONAME     = $(COMMON_LIBNAME).$(LIB_VER_MAJOR)
REALNAME   = $(COMMON_LIBNAME).$(LIB_VER_MAJOR).$(LIB_VER_MINOR)
ARCHIVE_NAME = $(TARGET)

#---------------------- Compute TOPDIR and include Rules file ------------------
ifndef TOPDIR
TOPDIR  := $(shell cd ../../../../../..; pwd)
endif
include $(TOPDIR)/development/rules/Rules.make.libs
#----------------------------- Splint arguments.  Lots of them -----------------
LCHECKS		=  -warnunixlib +unixlib +checks +strict +showsummary -booltype boolean
LSUPPRESS	=  -sys-dir-errors -ifblock -elseifcomplete
LSUPPRESS	+= -exportfcn -exporttype -exportconst -protoparamname -fielduse
LFLAGS		=  $(LCHECKS) $(LSUPPRESS) $(LDEFINES) -dump $(LINT_DUMP)

#--------------------------------- All Rules -----------------------------------
all:  .depend  $(LINKERNAME)

.depend dep:
	$(CC) $(CFLAGS) -M  *.c > $@

$(ARCHIVE_NAME): $(SRC:.c=.o)
	$(AR) $(ARFLAGS) $@ $^

$(LINKERNAME):$(REALNAME)
	ln -sf $(REALNAME) $(LINKERNAME)


$(REALNAME):$(ARCHIVE_NAME)
	$(CC) -shared -Wl,-soname,$(SONAME) -o $(REALNAME) \
	-Wl,--whole-archive $(ARCHIVE_NAME) -Wl,--no-whole-archive -lc

extrainstall:

clean:
	rm -f *.o *~ core .depend $(TARGET) *.lcd
	rm -f $(LINKERNAME) $(COMMON_LIBNAME) $(REALNAME)

lint:
	$(LINT) $(LFLAGS) $(SRC)

ifeq (.depend,$(wildcard .depend))
include .depend
endif
#----------------------------------------------------------------------------------------
