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


#---------------------- Generic Library variables -----------------------------
# Versions for the library
LIB_VER_MAJOR	= 1
LIB_VER_MINOR	= 0

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

#---------------------- Change according to your files ------------------------
# Add the necessary direcoties here
#$$ SUBDIRS +=crypt crypto dbgout exterrno flashlib fwinfo hostname iniparser 
#$$ SUBDIRS +=nwcfg serverinfo sol ubenv unix validate
#$$ SUBDIRS +=adviser_cfg racsessioninfo vmedia_cfg
#$$ SUBDIRS +=ntp netports
#$$ SUBDIRS +=ldapconf timezone
SUBDIRS = crypt

LIBCRYPTO =$(TARGETDIR)/usr/lib/libcrypto.so
##these are unix (linux) standards for naming shared libraries.
#Stick to these conventions for naming
##Linux HOWTO http://www.tldp.org/HOWTO/Program-Library-HOWTO/introduction.html 
#for details
#LIB_LINKERNAME = $(AMIAPPS_COMMON_LIBNAME)
#LIB_SONAME = $(AMIAPPS_COMMON_LIBNAME).$(LIBAMI_VER_MAJOR)    
#LIB_REALNAME = $(AMIAPPS_COMMON_LIBNAME).$(LIBAMI_VER_MAJOR).$(LIBAMI_VER_MINOR)    
#----------------------------------------------------------------------------------

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

all: $(LIB_LINKERNAME) install


$(LIB_LINKERNAME):$(LIB_REALNAME)
	ln -sf $(LIB_REALNAME) $(LIB_LINKERNAME)


$(LIB_REALNAME):$(LIB_ARCHIVE_NAME)
	$(CC) -shared   -Wl,-soname,$(LIB_SONAME) -o $(LIB_REALNAME) \
	-Wl,--whole-archive $(LIB_ARCHIVE_NAME) -Wl,--no-whole-archive $(LIBINI) -lc $(LIBCRYPTO)


$(LIB_ARCHIVE_NAME):subdirs
	sleep 1
	touch $(LIB_ARCHIVE_NAME)


subdirs:
	for n in $(SUBDIRS); \
	do ($(MAKE) -C $$n all ) || exit 1; \
	done

extrainstall:
	for n in $(SUBDIRS); do $(MAKE) -C $$n extrainstall; done

clean:
	for n in $(SUBDIRS); do $(MAKE) -C $$n clean; done
	rm -rf $(LIB_ARCHIVE_NAME)  
	rm -rf $(LIB_REALNAME)  
	rm -rf $(LIB_LINKERNAME) 

lint:
	for n in $(SUBDIRS); do $(MAKE) -C $$n lint; done
