summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlaforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede>2008-01-26 19:23:54 +0000
committerlaforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede>2008-01-26 19:23:54 +0000
commit685d1c4a5a48426c0aee0724528b1195bcef3c38 (patch)
treee018e8343165e86a4eeea9ec160f6816a80b0a27 /src
parent5fed5fd6d775183e8416d5e5c9f3fae3742be038 (diff)
* Add spidev reader driver
* restructure automake usage, introduce shared Makefile.flags.am git-svn-id: https://svn.gnumonks.org/trunk/librfid@2047 e0336214-984f-0b4b-a45f-81c69e1f0ede
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am39
-rw-r--r--src/rfid_reader.c6
2 files changed, 28 insertions, 17 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index b3c1c24..1e132db 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,12 +1,15 @@
-LIBVERSION= 0:0:0
+include $(top_srcdir)/Makefile.flags.am
+
+AM_CFLAGS += -D__LIBRFID__
+INCLUDES += @OPENCT_CFLAGS@
if ENABLE_FIRMWARE
-INCLUDES_FIRMWARE = -I$(FIRMWARE_PATH)/include -I$(FIRMWARE_PATH)/src -I$(GNUARM_PATH)/arm-elf/include
-AM_CFLAGS_FIRMWARE = -DLIBRFID_FIRMWARE -DLIBRFID_STATIC -D__MS_types__
+INCLUDES += -I$(FIRMWARE_PATH)/include -I$(FIRMWARE_PATH)/src -I$(GNUARM_PATH)/arm-elf/include
+AM_CFLAGS += -DLIBRFID_FIRMWARE -DLIBRFID_STATIC -D__MS_types__
endif
if ENABLE_STATIC
-AM_CFLAGS_STATIC = -DLIBRFID_STATIC
+AM_CFLAGS += -DLIBRFID_STATIC
endif
noinst_HEADERS=rfid_iso14443_common.h rc632.h libusb_dyn.h usleep.h
@@ -15,38 +18,40 @@ CORE=rfid.c rfid_layer2.c rfid_protocol.c rfid_reader.c rfid_scan.c
L2=rfid_layer2_iso14443a.c rfid_layer2_iso14443b.c rfid_layer2_iso15693.c rfid_iso14443_common.c
PROTO=rfid_proto_tcl.c rfid_proto_mifare_ul.c rfid_proto_mifare_classic.c
ASIC=rfid_asic_rc632.c
-READER=rfid_reader_openpcd.c
MISC=rfid_access_mifare_classic.c
if ENABLE_WIN32
WIN32=usleep.c libusb_dyn.c
AM_LDLAGS_WIN32=-mno-cygwin -lwinmm
AM_CFLAGS_WIN32=-mno-cygwin
+librfid_la_LIBADD = -lwinmm
+endif
+
+if HAVE_LIBUSB
+READER_OPENPCD=rfid_reader_openpcd.c
+AM_CFLAGS += -DENABLE_OPENPCD
+endif
+
+if ENABLE_SPIDEV
+READER_SPIDEV=rfid_reader_spidev.c
+AM_CFLAGS += -DENABLE_SPIDEV
endif
if ENABLE_CCID
READER_CM5121=rfid_reader_cm5121.c ccid/rfid_reader_cm5121_ccid_direct.c ccid/ccid-driver.c
-AM_CFLAGS_CM5121= -DENABLE_CM5121
+AM_CFLAGS += -DENABLE_CM5121
endif
if HAVE_OPENCT
READER_CM5121=rfid_reader_cm5121.c rfid_reader_cm5121_openct.c
-AM_CFLAGS_CM5121= -DENABLE_CM5121
+AM_CFLAGS += -DENABLE_CM5121
endif
-INCLUDES = $(all_includes) -I$(top_srcdir)/include $(INCLUDES_FIRMWARE) \
- $(INCLUDES_STATIC) @OPENCT_CFLAGS@
-AM_CFLAGS = -std=gnu99 -D__LIBRFID__ $(AM_CFLAGS_FIRMWARE) $(AM_CFLAGS_STATIC) \
- $(AM_CFLAGS_CM5121) $(AM_CFLAGS_WIN32)
lib_LTLIBRARIES = librfid.la
librfid_la_LDFLAGS = -Wc,-nostartfiles -version-info $(LIBVERSION) $(AM_LDFLAGS_WIN32) @OPENCT_LIBS@
-librfid_la_SOURCES = $(CORE) $(L2) $(PROTO) $(ASIC) $(MISC) \
- $(READER) $(READER_CM5121) $(WIN32)
-
-if ENABLE_WIN32
-librfid_la_LIBADD = -lwinmm
-endif
+librfid_la_SOURCES = $(CORE) $(L2) $(PROTO) $(ASIC) $(MISC) $(WIN32) \
+ $(READER_OPENPCD) $(READER_CM5121) $(READER_SPIDEV)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = librfid.pc
diff --git a/src/rfid_reader.c b/src/rfid_reader.c
index e0f0d3d..39a4a07 100644
--- a/src/rfid_reader.c
+++ b/src/rfid_reader.c
@@ -24,12 +24,18 @@
#include <librfid/rfid_reader.h>
#include <librfid/rfid_reader_cm5121.h>
#include <librfid/rfid_reader_openpcd.h>
+#include <librfid/rfid_reader_spidev.h>
static const struct rfid_reader *rfid_readers[] = {
+#ifdef HAVE_LIBUSB
#ifdef ENABLE_CM5121
[RFID_READER_CM5121] = &rfid_reader_cm5121,
#endif
[RFID_READER_OPENPCD] = &rfid_reader_openpcd,
+#endif
+#ifdef ENABLE_SPIDEV
+ [RFID_READER_SPIDEV] = &rfid_reader_spidev,
+#endif
};
struct rfid_reader_handle *
personal git repositories of Harald Welte. Your mileage may vary