diff options
author | laforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede> | 2008-01-26 19:23:54 +0000 |
---|---|---|
committer | laforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede> | 2008-01-26 19:23:54 +0000 |
commit | 685d1c4a5a48426c0aee0724528b1195bcef3c38 (patch) | |
tree | e018e8343165e86a4eeea9ec160f6816a80b0a27 | |
parent | 5fed5fd6d775183e8416d5e5c9f3fae3742be038 (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
-rw-r--r-- | Makefile.am | 18 | ||||
-rw-r--r-- | Makefile.flags.am | 18 | ||||
-rw-r--r-- | configure.in | 9 | ||||
-rw-r--r-- | etc/Makefile.am | 1 | ||||
-rw-r--r-- | etc/udev/Makefile.am | 1 | ||||
-rw-r--r-- | include/Makefile.am | 1 | ||||
-rw-r--r-- | include/librfid/Makefile.am | 1 | ||||
-rw-r--r-- | include/librfid/rfid_reader.h | 1 | ||||
-rw-r--r-- | src/Makefile.am | 39 | ||||
-rw-r--r-- | src/rfid_reader.c | 6 | ||||
-rw-r--r-- | utils/Makefile.am | 7 | ||||
-rw-r--r-- | win32/Makefile.am | 3 |
12 files changed, 66 insertions, 39 deletions
diff --git a/Makefile.am b/Makefile.am index e7d31c6..0d087f4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,24 +1,18 @@ AUTOMAKE_OPTIONS = foreign dist-bzip2 1.6 -SUBDIRS = etc include src - -DEFAULT_AM_CFLAGS = -std=gnu99 +include $(top_srcdir)/Makefile.flags.am -if ENABLE_WIN32 -SUBDIRS += win32 -LINKOPTS = -mno-cygwin -AM_CFLAGS = $(DEFAULT_AM_CFLAGS) -mno-cygwin -else -LINKOPTS = -lusb -AM_CFLAGS = $(DEFAULT_AM_CFLAGS) -endif +SUBDIRS = etc include src if ENABLE_FIRMWARE -AM_CFLAGS += -DLIBRFID_FIRMWARE else SUBDIRS += utils endif +if ENABLE_WIN32 +SUBDIRS += win32 +endif + EXTRA_DIST = LICENSING librfid.spec openct-cm5121-librfid.patch $(OBJECTS): libtool diff --git a/Makefile.flags.am b/Makefile.flags.am new file mode 100644 index 0000000..c6c4844 --- /dev/null +++ b/Makefile.flags.am @@ -0,0 +1,18 @@ +LIBVERSION= 0:0:0 + +AM_CFLAGS = -std=gnu99 +INCLUDES = $(all_includes) -I$(top_srcdir)/include + +if ENABLE_WIN32 +AM_LDFLAGS = -mno-cygwin +AM_CFLAGS += -mno-cygwin +else +if HAVE_LIBUSB +AM_LDFLAGS = -lusb +AM_CFLAGS += -DHAVE_LIBUSB +endif +endif + +if ENABLE_FIRMWARE +AM_CFLAGS += -DLIBRFID_FIRMWARE +endif diff --git a/configure.in b/configure.in index e65cdbd..3199c1b 100644 --- a/configure.in +++ b/configure.in @@ -37,6 +37,11 @@ AC_ARG_ENABLE(openct, [ENABLE_OPENCT="${enableval}"], [ENABLE_OPENCT="no"]) +AC_ARG_ENABLE(spidev, + [ --enable-spidev Enable spidev reader], + [ENABLE_SPIDEV=1], [ENABLE_SPIDEV=0]) +AM_CONDITIONAL(ENABLE_SPIDEV, test "$ENABLE_SPIDEV" == "1") + OPENCT_MSG=no if test "x${ENABLE_OPENCT}" = "xyes"; then PKG_CHECK_MODULES(OPENCT, [libopenct], [ @@ -63,8 +68,8 @@ AM_CONDITIONAL(ENABLE_STATIC, test "$ENABLE_STATIC" == "1") AC_ARG_WITH() -AC_CHECK_LIB(usb, usb_close,,) -AM_CONDITIONAL(HAVE_LIBUSB, test "x$have_libusb" = "xyes") +AC_CHECK_LIB(usb, usb_close, [HAVE_LIBUSB=1], [HAVE_LIBUSB=0]) +AM_CONDITIONAL(HAVE_LIBUSB, test "$HAVE_LIBUSB" == "1") dnl Output the makefile AC_OUTPUT(Makefile etc/Makefile etc/udev/Makefile src/Makefile include/Makefile include/librfid/Makefile utils/Makefile src/librfid.pc win32/Makefile) diff --git a/etc/Makefile.am b/etc/Makefile.am index 9f94de1..92618ac 100644 --- a/etc/Makefile.am +++ b/etc/Makefile.am @@ -1,2 +1,3 @@ +include $(top_srcdir)/Makefile.flags.am SUBDIRS = udev diff --git a/etc/udev/Makefile.am b/etc/udev/Makefile.am index 215cd34..e266e50 100644 --- a/etc/udev/Makefile.am +++ b/etc/udev/Makefile.am @@ -1,2 +1,3 @@ +include $(top_srcdir)/Makefile.flags.am EXTRA_DIST = librfid.rules diff --git a/include/Makefile.am b/include/Makefile.am index dfaa277..d78be8d 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,2 +1,3 @@ +include $(top_srcdir)/Makefile.flags.am SUBDIRS = librfid diff --git a/include/librfid/Makefile.am b/include/librfid/Makefile.am index 9af455b..63c997c 100644 --- a/include/librfid/Makefile.am +++ b/include/librfid/Makefile.am @@ -1,3 +1,4 @@ +include $(top_srcdir)/Makefile.flags.am pkginclude_HEADERS = rfid.h rfid_scan.h rfid_asic.h rfid_asic_rc632.h \ rfid_layer2.h rfid_layer2_iso14443a.h \ diff --git a/include/librfid/rfid_reader.h b/include/librfid/rfid_reader.h index af2f4be..21b740d 100644 --- a/include/librfid/rfid_reader.h +++ b/include/librfid/rfid_reader.h @@ -67,6 +67,7 @@ enum rfid_reader_id { RFID_READER_CM5121, RFID_READER_PEGODA, RFID_READER_OPENPCD, + RFID_READER_SPIDEV, }; struct rfid_reader_handle { 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 * diff --git a/utils/Makefile.am b/utils/Makefile.am index cd4adbc..3cdf089 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -1,7 +1,4 @@ -INCLUDES = $(all_includes) -I$(top_srcdir)/include - -if ENABLE_FIRMWARE -else +include $(top_srcdir)/Makefile.flags.am man_MANS = librfid-tool.1 mifare-tool.1 librfid-send_script.1 @@ -26,5 +23,3 @@ librfid_send_script_LDFLAGS = $(LINKOPTS) librfid_tool_LDFLAGS = $(LINKOPTS) mifare_tool_LDFLAGS = $(LINKOPTS) endif - -endif diff --git a/win32/Makefile.am b/win32/Makefile.am index f565f1f..0821168 100644 --- a/win32/Makefile.am +++ b/win32/Makefile.am @@ -1,9 +1,8 @@ -LIBVERSION= 0:0:0 +include $(top_srcdir)/Makefile.flags.am noinst_HEADERS = openpcd.h noinst_DATA = openpcd.dll -INCLUDES = -I$(top_srcdir)/include LIBRFID_DIR = $(top_builddir)/src/.libs/ CLEANFILES = $(noinst_DATA) |