#	This file is part of Jenux.
#
#    Jenux is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    Jenux is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with Jenux.  If not, see <http://www.gnu.org/licenses/>.
#
#	Module			: Makefile
#	Description		: Makefile for building libPIF.so
#	Compiler		: gcc 4.8.5++
#	Email			: matsuzawa.jei@nifty.com
#	Maintenance		:
#		May 25.'17	Released as GPL software officially
#

CC = g++
OBJ = CPif.o CPrt.o CSerial.o CEif.o CTDU.o CLog.o

SO = libPIF.so.4.0.0
SONAME = libPIF.so.4
LIBNAME = libPIF.so
IDIR = ../../../include
IDIR1 = ../../../include -I/usr/include/c++/7/i686-redhat-linux/ -I/usr/include/c++/7/

$(SO) 	:	$(OBJ) $(LIB) Makefile
			$(CC) -shared -Wl,-soname,$(SONAME) -o $(SO) $(OBJ) -lpthread -lc
			
			cp $(SO) /usr/lib
			ln -sf /usr/lib/$(SO) /usr/lib/$(SONAME) 
			ln -sf /usr/lib/$(SONAME) /usr/lib/$(LIBNAME) 

.C.o	:	
			#$(CC) -std=c++0x -fPIC -O3 -w -c -g -I$(IDIR1) $<
			$(CC) -std=c++11 -fPIC -O3 -w -c -g -I$(IDIR1) $<

clean:
			rm -f $(SO) 
			rm -f *.o
#
#	must be done as root
#
install:
			cp $(SO) /usr/lib
			ln -sf /usr/lib/$(SO) /usr/lib/$(SONAME) 
			ln -sf /usr/lib/$(SONAME) /usr/lib/$(LIBNAME) 

$(OBJ)	:	$(IDIR)/pif/*.h 
