Merge the includes-revamp branch into trunk.

This commit is contained in:
Romain Tartiere 2009-12-01 14:23:00 +00:00
parent b29860a93c
commit 2b8232b9ab
42 changed files with 63 additions and 57 deletions

View file

@ -38,6 +38,8 @@ AC_TYPE_UINT32_T
AC_TYPE_UINT64_T AC_TYPE_UINT64_T
AC_TYPE_INT32_T AC_TYPE_INT32_T
LIBNFC_CFLAGS='-I$(top_srcdir)/src/lib -I$(top_builddir)/src/include -I$(top_srcdir)/src/include'
AC_SUBST(LIBNFC_CFLAGS)
# Debug support (default:no) # Debug support (default:no)
AC_ARG_ENABLE([debug],AS_HELP_STRING([--enable-debug],[Enable debug output]),[enable_debug=$enableval],[enable_debug="no"]) AC_ARG_ENABLE([debug],AS_HELP_STRING([--enable-debug],[Enable debug output]),[enable_debug=$enableval],[enable_debug="no"])
@ -197,6 +199,8 @@ fi
AC_CONFIG_FILES([ AC_CONFIG_FILES([
Makefile Makefile
src/include/Makefile
src/include/nfc/Makefile
src/lib/chips/Makefile src/lib/chips/Makefile
src/lib/buses/Makefile src/lib/buses/Makefile
src/lib/drivers/Makefile src/lib/drivers/Makefile

View file

@ -17,7 +17,8 @@ IF(MSVC)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../win32/stdint) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../win32/stdint)
ENDIF(MSVC) ENDIF(MSVC)
INCLUDE_DIRECTORIES(${LIBUSB_INCLUDE_DIRS} ${PCSC_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${LIBUSB_INCLUDE_DIRS} ${PCSC_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/include)
ADD_SUBDIRECTORY(lib) ADD_SUBDIRECTORY(lib)
ADD_SUBDIRECTORY(examples) ADD_SUBDIRECTORY(examples)
ADD_SUBDIRECTORY(include)

View file

@ -1,2 +1,5 @@
SUBDIRS = lib examples
INCLUDES = $(LIBNFC_CFLAGS)
SUBDIRS = lib examples include

View file

@ -12,6 +12,10 @@ FOREACH(source ${EXAMPLES-SOURCES})
INSTALL(TARGETS ${source} RUNTIME DESTINATION bin COMPONENT examples) INSTALL(TARGETS ${source} RUNTIME DESTINATION bin COMPONENT examples)
ENDFOREACH(source) ENDFOREACH(source)
# Headers
FILE(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
INSTALL(FILES ${headers} DESTINATION ${INCLUDE_INSTALL_DIR}/nfc COMPONENT headers)
# Manuals for the examples # Manuals for the examples
FILE(GLOB manuals "${CMAKE_CURRENT_SOURCE_DIR}/*.1") FILE(GLOB manuals "${CMAKE_CURRENT_SOURCE_DIR}/*.1")
INSTALL(FILES ${manuals} DESTINATION ${SHARE_INSTALL_PREFIX}/man/man1 COMPONENT manuals) INSTALL(FILES ${manuals} DESTINATION ${SHARE_INSTALL_PREFIX}/man/man1 COMPONENT manuals)

View file

@ -1,7 +1,7 @@
bin_PROGRAMS = nfc-anticol nfc-list nfc-mfclassic nfc-mfultralight nfc-relay nfc-emulate nfcip-target nfcip-initiator bin_PROGRAMS = nfc-anticol nfc-list nfc-mfclassic nfc-mfultralight nfc-relay nfc-emulate nfcip-target nfcip-initiator
# set the include path found by configure # set the include path found by configure
INCLUDES= $(all_includes) INCLUDES= $(all_includes) $(LIBNFC_CFLAGS)
nfcinclude_HEADERS = mifaretag.h mifareultag.h nfcinclude_HEADERS = mifaretag.h mifareultag.h
nfcincludedir = $(includedir)/nfc nfcincludedir = $(includedir)/nfc

View file

@ -28,9 +28,9 @@
#include <stdbool.h> #include <stdbool.h>
#include <string.h> #include <string.h>
#include <nfc.h> #include <nfc/nfc.h>
#include "nfc-messages.h" #include <nfc/nfc-messages.h>
#include "bitutils.h" #include "bitutils.h"
#define SAK_FLAG_ATS_SUPPORTED 0x20 #define SAK_FLAG_ATS_SUPPORTED 0x20

View file

@ -27,9 +27,9 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <nfc.h> #include <nfc/nfc.h>
#include "nfc-messages.h" #include <nfc/nfc-messages.h>
#include "bitutils.h" #include "bitutils.h"
#define MAX_FRAME_LEN 264 #define MAX_FRAME_LEN 264

View file

@ -27,9 +27,9 @@
#include <string.h> #include <string.h>
#include <nfc.h> #include <nfc/nfc.h>
#include "nfc-messages.h" #include <nfc/nfc-messages.h>
#include "bitutils.h" #include "bitutils.h"
#define MAX_DEVICE_COUNT 16 #define MAX_DEVICE_COUNT 16

View file

@ -30,7 +30,7 @@
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <nfc.h> #include <nfc/nfc.h>
#include "mifaretag.h" #include "mifaretag.h"
#include "bitutils.h" #include "bitutils.h"

View file

@ -30,7 +30,7 @@
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <nfc.h> #include <nfc/nfc.h>
#include "mifareultag.h" #include "mifareultag.h"
#include "bitutils.h" #include "bitutils.h"

View file

@ -27,9 +27,9 @@
#include <string.h> #include <string.h>
#include <signal.h> #include <signal.h>
#include <nfc.h> #include <nfc/nfc.h>
#include "nfc-messages.h" #include <nfc/nfc-messages.h>
#include "bitutils.h" #include "bitutils.h"
#define MAX_FRAME_LEN 264 #define MAX_FRAME_LEN 264

View file

@ -23,7 +23,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <nfc.h> #include <nfc/nfc.h>
#define MAX_FRAME_LEN 264 #define MAX_FRAME_LEN 264

View file

@ -22,7 +22,7 @@
*/ */
#include <stdio.h> #include <stdio.h>
#include <nfc.h> #include <nfc/nfc.h>
#define MAX_FRAME_LEN 264 #define MAX_FRAME_LEN 264

3
src/include/Makefile.am Normal file
View file

@ -0,0 +1,3 @@
SUBDIRS = nfc

View file

@ -0,0 +1,4 @@
nfcinclude_HEADERS = nfc.h nfc-types.h nfc-messages.h
nfcincludedir = $(includedir)/nfc

View file

@ -33,6 +33,7 @@
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdio.h>
typedef uint8_t byte_t; typedef uint8_t byte_t;

View file

@ -30,7 +30,7 @@
#include <stdbool.h> #include <stdbool.h>
#include "nfc-types.h" #include <nfc/nfc-types.h>
#ifdef __cplusplus #ifdef __cplusplus
#define NFCAPI extern "C" { #define NFCAPI extern "C" {

View file

@ -34,7 +34,7 @@ SET(LIBRARY_SOURCES nfc bitutils ${DRIVERS_SOURCES} ${BUSES_SOURCES} ${CHIPS_SOU
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
ADD_LIBRARY(nfc SHARED ${LIBRARY_SOURCES}) ADD_LIBRARY(nfc SHARED ${LIBRARY_SOURCES})
TARGET_LINK_LIBRARIES(nfc ${LIBUSB_LIBRARIES} ${PCSC_LIBRARIES}) TARGET_LINK_LIBRARIES(nfc ${LIBUSB_LIBRARIES} ${PCSC_LIBRARIES})
SET_TARGET_PROPERTIES(nfc PROPERTIES SOVERSION 0 VERSION 0.0.0) SET_TARGET_PROPERTIES(nfc PROPERTIES SOVERSION 0)
IF(MSVC) IF(MSVC)
# On Windows the shared (runtime) library should be either in the same # On Windows the shared (runtime) library should be either in the same
@ -47,15 +47,3 @@ ELSE(MSVC)
INSTALL(TARGETS nfc LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries) INSTALL(TARGETS nfc LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries)
ENDIF(MSVC) ENDIF(MSVC)
# Headers
FILE(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
INSTALL(FILES ${headers} DESTINATION ${INCLUDE_INSTALL_DIR}/libnfc COMPONENT headers)
IF(MSVC)
# On Windows we also install the stdint headers, without it programs using it
# can't compile (like if we want to compile the included examples "out of
# tree")
#FILE(GLOB stdint "${CMAKE_CURRENT_SOURCE_DIR}/msvc/*.h")
#INSTALL(FILES ${stdint} DESTINATION ${INCLUDE_INSTALL_DIR}/libnfc COMPONENT headers)
ENDIF(MSVC)

View file

@ -1,10 +1,7 @@
SUBDIRS = chips buses drivers . SUBDIRS = chips buses drivers .
# set the include path found by configure # set the include path found by configure
INCLUDES= $(all_includes) INCLUDES= $(all_includes) $(LIBNFC_CFLAGS)
nfcinclude_HEADERS = nfc.h nfc-types.h nfc-messages.h chips.h buses.h drivers.h bitutils.h
nfcincludedir = $(includedir)/nfc
lib_LTLIBRARIES = libnfc.la lib_LTLIBRARIES = libnfc.la
libnfc_la_SOURCES = nfc.c bitutils.c libnfc_la_SOURCES = nfc.c bitutils.c
@ -25,3 +22,4 @@ if LIBUSB_ENABLED
libnfc_la_LIBADD += @LIBUSB_LIBS@ libnfc_la_LIBADD += @LIBUSB_LIBS@
endif endif
EXTRA_DIST = chips.h buses.h drivers.h bitutils.h

View file

@ -26,7 +26,7 @@
#include <stdint.h> #include <stdint.h>
#include "nfc-types.h" #include <nfc/nfc-types.h>
byte_t oddparity(const byte_t bt); byte_t oddparity(const byte_t bt);
void oddparity_byte_ts(const byte_t* pbtData, const size_t szLen, byte_t* pbtPar); void oddparity_byte_ts(const byte_t* pbtData, const size_t szLen, byte_t* pbtPar);

View file

@ -21,5 +21,5 @@
* @brief * @brief
*/ */
#include "nfc-types.h" #include <nfc/nfc-types.h>

View file

@ -1,6 +1,6 @@
# set the include path found by configure # set the include path found by configure
INCLUDES= $(all_includes) INCLUDES= $(all_includes) $(LIBNFC_CFLAGS)
noinst_HEADERS = uart.h noinst_HEADERS = uart.h
noinst_LTLIBRARIES = libnfcbuses.la noinst_LTLIBRARIES = libnfcbuses.la

View file

@ -28,7 +28,7 @@ http://www.teuniz.net/RS-232/index.html
#include "uart.h" #include "uart.h"
#include "nfc-messages.h" #include <nfc/nfc-messages.h>
// Test if we are dealing with unix operating systems // Test if we are dealing with unix operating systems
#ifndef _WIN32 #ifndef _WIN32

View file

@ -29,7 +29,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "nfc-types.h" #include <nfc/nfc-types.h>
// Handle platform specific includes // Handle platform specific includes
#ifndef _WIN32 #ifndef _WIN32

View file

@ -24,7 +24,7 @@
#ifndef __NFC_CHIPS_H__ #ifndef __NFC_CHIPS_H__
#define __NFC_CHIPS_H__ #define __NFC_CHIPS_H__
#include "nfc-types.h" #include <nfc/nfc-types.h>
#include "chips/pn53x.h" #include "chips/pn53x.h"

View file

@ -1,6 +1,6 @@
# set the include path found by configure # set the include path found by configure
INCLUDES= $(all_includes) INCLUDES= $(all_includes) $(LIBNFC_CFLAGS)
noinst_HEADERS = pn53x.h noinst_HEADERS = pn53x.h
noinst_LTLIBRARIES = libnfcchips.la noinst_LTLIBRARIES = libnfcchips.la

View file

@ -26,7 +26,7 @@
#include "pn53x.h" #include "pn53x.h"
#include "bitutils.h" #include "../bitutils.h"
// PN53X configuration // PN53X configuration
const byte_t pncmd_get_firmware_version [ 2] = { 0xD4,0x02 }; const byte_t pncmd_get_firmware_version [ 2] = { 0xD4,0x02 };

View file

@ -24,7 +24,7 @@
#ifndef __NFC_CHIPS_PN53X_H__ #ifndef __NFC_CHIPS_PN53X_H__
#define __NFC_CHIPS_PN53X_H__ #define __NFC_CHIPS_PN53X_H__
#include "nfc-types.h" #include <nfc/nfc-types.h>
#define MAX_FRAME_LEN 264 #define MAX_FRAME_LEN 264

View file

@ -24,7 +24,7 @@
#ifndef __NFC_DRIVERS_H__ #ifndef __NFC_DRIVERS_H__
#define __NFC_DRIVERS_H__ #define __NFC_DRIVERS_H__
#include "nfc-types.h" #include <nfc/nfc-types.h>
#ifdef HAVE_PCSC_LITE #ifdef HAVE_PCSC_LITE
#include "drivers/acr122.h" #include "drivers/acr122.h"

View file

@ -1,5 +1,5 @@
# set the include path found by configure # set the include path found by configure
INCLUDES= $(all_includes) INCLUDES= $(all_includes) $(LIBNFC_CFLAGS)
noinst_HEADERS = arygon.h pn532_uart.h noinst_HEADERS = arygon.h pn532_uart.h
noinst_LTLIBRARIES = libnfcdrivers.la noinst_LTLIBRARIES = libnfcdrivers.la

View file

@ -38,7 +38,7 @@
#endif #endif
#include "nfc-messages.h" #include <nfc/nfc-messages.h>
// WINDOWS: #define IOCTL_CCID_ESCAPE_SCARD_CTL_CODE SCARD_CTL_CODE(3500) // WINDOWS: #define IOCTL_CCID_ESCAPE_SCARD_CTL_CODE SCARD_CTL_CODE(3500)
#define IOCTL_CCID_ESCAPE_SCARD_CTL_CODE (((0x31) << 16) | ((3500) << 2)) #define IOCTL_CCID_ESCAPE_SCARD_CTL_CODE (((0x31) << 16) | ((3500) << 2))

View file

@ -28,7 +28,7 @@
#include <stdbool.h> #include <stdbool.h>
#include "nfc-types.h" #include <nfc/nfc-types.h>
#define ACR122_DRIVER_NAME "ACR122" #define ACR122_DRIVER_NAME "ACR122"

View file

@ -25,12 +25,12 @@
#include "arygon.h" #include "arygon.h"
#include "nfc-messages.h" #include <nfc/nfc-messages.h>
#include "../drivers.h" #include "../drivers.h"
#include "../bitutils.h" #include "../bitutils.h"
// Bus // Bus
#include "uart.h" #include "../buses/uart.h"
#ifdef _WIN32 #ifdef _WIN32
#define SERIAL_STRING "COM" #define SERIAL_STRING "COM"

View file

@ -24,7 +24,7 @@
#ifndef __NFC_DRIVER_ARYGON_H__ #ifndef __NFC_DRIVER_ARYGON_H__
#define __NFC_DRIVER_ARYGON_H__ #define __NFC_DRIVER_ARYGON_H__
#include "nfc-types.h" #include <nfc/nfc-types.h>
#define ARYGON_DRIVER_NAME "ARYGON" #define ARYGON_DRIVER_NAME "ARYGON"

View file

@ -35,7 +35,7 @@ Thanks to d18c7db and Okko for example code
#include "pn531_usb.h" #include "pn531_usb.h"
#include "../drivers.h" #include "../drivers.h"
#include "nfc-messages.h" #include <nfc/nfc-messages.h>
#include "../bitutils.h" #include "../bitutils.h"
#define BUFFER_LENGTH 256 #define BUFFER_LENGTH 256

View file

@ -27,7 +27,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "nfc-types.h" #include <nfc/nfc-types.h>
#define PN531_USB_DRIVER_NAME "PN531_USB" #define PN531_USB_DRIVER_NAME "PN531_USB"

View file

@ -25,7 +25,7 @@
#include "pn532_uart.h" #include "pn532_uart.h"
#include "nfc-messages.h" #include <nfc/nfc-messages.h>
#include "../drivers.h" #include "../drivers.h"
#include "../bitutils.h" #include "../bitutils.h"

View file

@ -24,7 +24,7 @@
#ifndef __NFC_DRIVER_PN532_UART_H__ #ifndef __NFC_DRIVER_PN532_UART_H__
#define __NFC_DRIVER_PN532_UART_H__ #define __NFC_DRIVER_PN532_UART_H__
#include "nfc-types.h" #include <nfc/nfc-types.h>
#define PN532_UART_DRIVER_NAME "PN532_UART" #define PN532_UART_DRIVER_NAME "PN532_UART"

View file

@ -33,7 +33,7 @@ Thanks to d18c7db and Okko for example code
#include "pn533_usb.h" #include "pn533_usb.h"
#include "../drivers.h" #include "../drivers.h"
#include "nfc-messages.h" #include <nfc/nfc-messages.h>
#define BUFFER_LENGTH 256 #define BUFFER_LENGTH 256
#define USB_TIMEOUT 30000 #define USB_TIMEOUT 30000

View file

@ -24,7 +24,7 @@
#ifndef __NFC_DRIVER_PN533_USB_H__ #ifndef __NFC_DRIVER_PN533_USB_H__
#define __NFC_DRIVER_PN533_USB_H__ #define __NFC_DRIVER_PN533_USB_H__
#include "nfc-types.h" #include <nfc/nfc-types.h>
#define PN533_USB_DRIVER_NAME "PN533_USB" #define PN533_USB_DRIVER_NAME "PN533_USB"

View file

@ -26,12 +26,12 @@
#include <stddef.h> #include <stddef.h>
#include <string.h> #include <string.h>
#include "nfc.h" #include <nfc/nfc.h>
#include "chips.h" #include "chips.h"
#include "drivers.h" #include "drivers.h"
#include "nfc-messages.h" #include <nfc/nfc-messages.h>
#include "../../config.h" #include "../../config.h"