include ../makevars

CFLAGS+=-I../ctapi/include

PLUGDIR=./ifd-cyberjack.bundle/Contents

SRCS= \
	ifdhandler.c

OBJS=$(SRCS:.c=.o)
OBJS+=../ctapi/libctapi-cyberjack.a


HDRS= \
	ifdhandler.h \
	pcscdefines.h

all: libso #liba

install: all
	install -o root -g root -d $(INSTALL_PREFIX)/lib/pcsc/drivers/$(PLUGDIR)/Linux
	install -o root -g root $(PLUGDIR)/ifd-cyberjack.so $(INSTALL_PREFIX)/lib/pcsc/drivers/$(PLUGDIR)/Linux/ifd-cyberjack.so
	install -o root -g root $(PLUGDIR)/Info.plist $(INSTALL_PREFIX)/lib/pcsc/drivers/$(PLUGDIR)/Info.plist
	install -o root -g root $(PLUGDIR)/PkgInfo $(INSTALL_PREFIX)/lib/pcsc/drivers/$(PLUGDIR)/PkgInfo

libso: $(OBJS)
	ld -x --shared -lusb -o $(PLUGDIR)/Linux/ifd-cyberjack.so $(OBJS) 

liba: $(OBJS)
	ar r libcyberjack_ifd.a $(OBJS) $(CTOBJS)
	-if test -s /bin/ranlib; then /bin/ranlib libcyberjack_ifd.a; \
	else if test -s /usr/bin/ranlib; then /usr/bin/ranlib libcyberjack_ifd.a; \
	else exit 0; fi; fi

clean:
	rm -f *.o *.a $(PLUGDIR)/Linux/*.so

