#----------------------------------------------------------------------
#                      Makefile to build libami crypt
#                 Copyright (c) 2008 American Megatrends Inc 
#-----------------------------------------------------------------------

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

#---------------------- Compute TOPDIR and include Rules file --------------------
ifndef TOPDIR
TOPDIR  := $(shell cd ../../../../../..; pwd)
endif
include $(TOPDIR)/development/rules/Rules.make.libs

CFLAGS += -I$(TOPDIR)/development/common/include/crypt

THISDIR := $(shell basename `pwd`)

# Output file
TARGET 	= $(LIBAMI_ARCHIVE_FULLPATH)	 				# Output file

#---------------------- Change according to your files ----------------------------
#$$ SRC		=  blowfish.c md5.c hashers.c
SRC		=  md5.c

DOCS		=  documentation/html documentation/man

# Define UNIXTOOLS if the target system has grep, awk, sed, etc.
BOPTS		=  -DUNIXTOOLS

# Define HAVE_DEV_URANDOM if /dev/urandom is a cryptographic source of
# pseudo-random numbers
BOPTS		+= -DHAVE_DEV_URANDOM

# Define these to specify what type of unix behaviour we want, and what
# standards we will be complying with
BOPTS		+= -D_XOPEN_SOURCE=600 -D_SVID_SOURCE=1 -D_BSD_SOURCE=1

# 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
LDEFINES	=  -D_POSIX_SAVED_IDS -DPATH_MAX=4096 -DNAME_MAX=255 -DMAX_INPUT=255
LDEFINES	+= $(BOPTS)
LINCLUDES	+= -I$(AMI_APPS_INCDIR)
LFLAGS		=  $(LINCLUDES) $(LDEFINES) $(LCHECKS) $(LSUPPRESS)


# Additional compilation options
CFLAGS		+= $(BOPTS)


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

all:   .depend $(TARGET)	# If your module exports symbols

.PHONY:$(TARGET)  

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

docs:
	-mkdir -p documentation/html
	@cat ./templateFooter.html|sed "s/__TIMESTAMP__/`date`/" > ./documentation/html/defaultFooter.html
	@doxygen 

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

extrainstall:

orginstall:  .depend $(TARGET)
	install -d $(INSTALLDIR)
	$(INSTALL) $(ONLY_IF_NEW) $(PRESERVE_SOURCE_TIMESTAMP) $(TARGET) $(INSTALLDIR)

clean:
	rm -rf *.o *~ core .depend $(TARGET) $(DOCS) *.lcd 

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


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