#
#  tavvva_ppdrv - ioctl based parallel port driving library
#                 (no direct I/O access!!!)
#
#  Copyright (C) 2013 Jaromir Capik <tavvva@email.cz>
#
#  This program 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.
#
#  This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
#

LIB_NAME = tavvva_ppdrv
SONAME_MAJOR = 1
SONAME_MINOR = 1

CC = gcc
AR = ar

.PHONY: all
all: shared static


.PHONY: shared
shared: ${LIB_NAME}.o
	${CC} ${CFLAGS} -shared -Wl,-soname,lib${LIB_NAME}.so.${SONAME_MAJOR} -o lib${LIB_NAME}.so.${SONAME_MAJOR}.${SONAME_MINOR} ${LIB_NAME}.o

.PHONY: static
static: ${LIB_NAME}.o
	${AR} rcs lib${LIB_NAME}.a ${LIB_NAME}.o

.PHONY: clean
clean :
	rm -f lib${LIB_NAME}.so.*
	rm -f lib${LIB_NAME}.a
	rm -f ${LIB_NAME}.o

${LIB_NAME}.o: ${LIB_NAME}.c ${LIB_NAME}.h
	${CC} ${CFLAGS} -c ${LIB_NAME}.c -o ${LIB_NAME}.o -fPIC
