#-----------------------------------------------------------------------------
# File Name: makefile
# Description
# -----------
# This is the makefile for the AccessDLL project.
#
#-----------------------------------------------------------------------------
SHELL 		= /bin/sh

#-- Release Compiler Flags ---------------------------------------------------

CXXFLAGS	+= -g0 -Wall -Wno-write-strings -shared -D_GNU_SOURCE -Wno-invalid-offsetof -I. -I../../
CFLAGS		+= -g0 -Wall -Wno-int-to-pointer-cast -pedantic -Wstrict-prototypes -D_GNU_SOURCE -std=c99 -I. -I../../

#-- Required libraries -------------------------------------------------------

LIBS		 = -lm -lrt -lftdi -lstdc++

#-- Compile All --------------------------------------------------------------

.PHONEY: all
all: 	libaes_access.so

#-- Clean Up -----------------------------------------------------------------

.PHONEY: clean
clean:

	rm -f *.[bo]
	rm -f *.err
	rm -f /usr/local/lib/libaes_access*
	rm -f libaes_access.a libaes_access.so 1>/dev/null 2>&1

#-- Install ------------------------------------------------------------------

.PHONEY: install
install:

	cp libaes_access.so.1.2.0  /usr/local/lib/
	/sbin/ldconfig
	ln -sf /usr/local/lib/libaes_access.so.1.2.0 /usr/local/lib/libaes_access.so
	ln -sf /usr/local/lib/libaes_access.so.1.2.0 /usr/local/lib/libaes_access.so.1

#-- Build targets ------------------------------------------------------------

libaes_access.so:
	$(CC)  -fPIC -g -c $(CFLAGS) MapRam.c
	$(CXX) -fPIC -g -c $(CXXFLAGS) Aesimhei.cpp
	$(CXX) -fPIC -g -c $(CXXFLAGS) ../../DESEncrypt.cpp
	$(CC)  -shared -Wl,-soname,libaes_access.so.1 \
		-o libaes_access.so.1.2.0 MapRam.o Aesimhei.o DESEncrypt.o -lc
        
#------------------------------ END OF FILE ----------------------------------
