move some examples to utils/ since they are not examples anymore :) (Fixes Issue 164)

This commit is contained in:
Romuald Conty 2011-09-30 11:33:31 +00:00
parent 311d12feef
commit 8c7b61eaba
34 changed files with 126 additions and 83 deletions

View file

@ -90,6 +90,7 @@ ENDIF(NOT WIN32)
ADD_SUBDIRECTORY(libnfc)
ADD_SUBDIRECTORY(include)
ADD_SUBDIRECTORY(utils)
ADD_SUBDIRECTORY(examples)
# Binary Package

View file

@ -2,7 +2,7 @@ ACLOCAL_AMFLAGS = -I m4
AM_CFLAGS = $(LIBNFC_CFLAGS)
SUBDIRS = libnfc examples include contrib cmake test
SUBDIRS = libnfc utils examples include contrib cmake test
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libnfc.pc

View file

@ -164,11 +164,11 @@ CFLAGS="$CFLAGS -Du_int8_t=uint8_t -Du_int16_t=uint16_t"
AC_CONFIG_FILES([
Doxyfile
Makefile
cmake/Makefile
cmake/modules/Makefile
contrib/Makefile
contrib/win32/Makefile
contrib/win32/sys/Makefile
cmake/Makefile
cmake/modules/Makefile
examples/Makefile
examples/pn53x-tamashell-scripts/Makefile
include/Makefile
@ -179,6 +179,7 @@ AC_CONFIG_FILES([
libnfc/chips/Makefile
libnfc/drivers/Makefile
test/Makefile
utils/Makefile
])
AC_OUTPUT

View file

@ -1,23 +1,15 @@
SET(EXAMPLES-SOURCES nfc-anticol nfc-dep-initiator nfc-dep-target nfc-emulate-forum-tag4 nfc-emulate-tag nfc-emulate-uid nfc-list nfc-poll nfc-relay nfc-relay-picc nfc-mfclassic nfc-mfultralight)
#TODO pn53x-diagnose pn53x-sam pn53x-tamashell
SET(EXAMPLES-SOURCES nfc-anticol nfc-dep-initiator nfc-dep-target nfc-emulate-tag nfc-emulate-uid nfc-poll nfc-relay pn53x-diagnose pn53x-sam pn53x-tamashell)
# XXX: Examples should not use private API!
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../libnfc)
INCLUDE_DIRECTORIES(${LIBUSB_INCLUDE_DIRS} ${PCSC_INCLUDE_DIRS})
LINK_DIRECTORIES(${LIBUSB_LIBRARY_DIRS} ${PCSC_LIBRARY_DIRS})
ADD_LIBRARY(nfc-utils nfc-utils)
# Examples
FOREACH(source ${EXAMPLES-SOURCES})
IF((${source} MATCHES "nfc-mfultralight") OR (${source} MATCHES "nfc-mfclassic"))
ADD_EXECUTABLE(${source} ${source}.c mifare)
ELSE()
ADD_EXECUTABLE(${source} ${source}.c)
ENDIF((${source} MATCHES "nfc-mfultralight") OR (${source} MATCHES "nfc-mfclassic"))
ADD_EXECUTABLE(${source} ${source}.c)
TARGET_LINK_LIBRARIES(${source} nfc)
TARGET_LINK_LIBRARIES(${source} nfc-utils)
TARGET_LINK_LIBRARIES(${source} nfcutils)
INSTALL(TARGETS ${source} RUNTIME DESTINATION bin COMPONENT examples)
ENDFOREACH(source)

View file

@ -4,17 +4,10 @@ bin_PROGRAMS = \
nfc-anticol \
nfc-dep-initiator \
nfc-dep-target \
nfc-emulate-forum-tag2 \
nfc-emulate-forum-tag4 \
nfc-emulate-tag \
nfc-emulate-uid \
nfc-list \
nfc-mfclassic \
nfc-mfsetuid \
nfc-mfultralight \
nfc-poll \
nfc-relay \
nfc-relay-picc \
pn53x-diagnose \
pn53x-sam
@ -28,93 +21,55 @@ INCLUDES= $(all_includes) $(LIBNFC_CFLAGS)
AM_CFLAGS = -I$(top_srcdir)/libnfc
noinst_HEADERS = mifare.h nfc-utils.h
noinst_LTLIBRARIES = libnfcutils.la
libnfcutils_la_SOURCES = nfc-utils.c
nfc_poll_SOURCES = nfc-poll.c
nfc_poll_LDADD = $(top_builddir)/libnfc/libnfc.la \
libnfcutils.la
$(top_builddir)/utils/libnfcutils.la
nfc_anticol_SOURCES = nfc-anticol.c
nfc_anticol_LDADD = $(top_builddir)/libnfc/libnfc.la \
libnfcutils.la
nfc_list_SOURCES = nfc-list.c
nfc_list_LDADD = $(top_builddir)/libnfc/libnfc.la \
libnfcutils.la
nfc_mfultralight_SOURCES = nfc-mfultralight.c mifare.c mifare.h
nfc_mfultralight_LDADD = $(top_builddir)/libnfc/libnfc.la
nfc_mfclassic_SOURCES = nfc-mfclassic.c mifare.c mifare.h
nfc_mfclassic_LDADD = $(top_builddir)/libnfc/libnfc.la \
libnfcutils.la
nfc_mfsetuid_SOURCES = nfc-mfsetuid.c
nfc_mfsetuid_LDADD = $(top_builddir)/libnfc/libnfc.la \
libnfcutils.la
$(top_builddir)/utils/libnfcutils.la
nfc_relay_SOURCES = nfc-relay.c
nfc_relay_LDADD = $(top_builddir)/libnfc/libnfc.la \
libnfcutils.la
nfc_relay_picc_SOURCES = nfc-relay-picc.c
nfc_relay_picc_LDADD = $(top_builddir)/libnfc/libnfc.la \
libnfcutils.la
nfc_emulate_forum_tag2_SOURCES = nfc-emulate-forum-tag2.c
nfc_emulate_forum_tag2_LDADD = $(top_builddir)/libnfc/libnfc.la \
libnfcutils.la
nfc_emulate_forum_tag4_SOURCES = nfc-emulate-forum-tag4.c
nfc_emulate_forum_tag4_LDADD = $(top_builddir)/libnfc/libnfc.la \
libnfcutils.la
$(top_builddir)/utils/libnfcutils.la
nfc_emulate_tag_SOURCES = nfc-emulate-tag.c
nfc_emulate_tag_LDADD = $(top_builddir)/libnfc/libnfc.la \
libnfcutils.la
$(top_builddir)/utils/libnfcutils.la
nfc_emulate_uid_SOURCES = nfc-emulate-uid.c
nfc_emulate_uid_LDADD = $(top_builddir)/libnfc/libnfc.la \
libnfcutils.la
$(top_builddir)/utils/libnfcutils.la
nfc_dep_target_SOURCES = nfc-dep-target.c
nfc_dep_target_LDADD = $(top_builddir)/libnfc/libnfc.la \
libnfcutils.la
$(top_builddir)/utils/libnfcutils.la
nfc_dep_initiator_SOURCES = nfc-dep-initiator.c
nfc_dep_initiator_LDADD = $(top_builddir)/libnfc/libnfc.la \
libnfcutils.la
$(top_builddir)/utils/libnfcutils.la
pn53x_diagnose_SOURCES = pn53x-diagnose.c
pn53x_diagnose_LDADD = $(top_builddir)/libnfc/libnfc.la \
libnfcutils.la
$(top_builddir)/utils/libnfcutils.la
pn53x_sam_SOURCES = pn53x-sam.c
pn53x_sam_LDADD = $(top_builddir)/libnfc/libnfc.la \
libnfcutils.la
$(top_builddir)/utils/libnfcutils.la
pn53x_tamashell_SOURCES = pn53x-tamashell.c
pn53x_tamashell_LDADD = $(top_builddir)/libnfc/libnfc.la \
libnfcutils.la
$(top_builddir)/utils/libnfcutils.la
pn53x_tamashell_LDFLAGS = @READLINE_LIBS@
dist_man_MANS = \
nfc-anticol.1 \
nfc-dep-initiator.1 \
nfc-dep-target.1 \
nfc-emulate-forum-tag4.1 \
nfc-emulate-tag.1 \
nfc-emulate-uid.1 \
nfc-list.1 \
nfc-mfclassic.1 \
nfc-mfsetuid.1 \
nfc-mfultralight.1 \
nfc-poll.1 \
nfc-relay.1 \
nfc-relay-picc.1 \
pn53x-diagnose.1 \
pn53x-sam.1 \
pn53x-tamashell.1

View file

@ -45,7 +45,7 @@
#include <nfc/nfc.h>
#include "nfc-utils.h"
#include "utils/nfc-utils.h"
#define SAK_FLAG_ATS_SUPPORTED 0x20

View file

@ -44,7 +44,7 @@
#include <nfc/nfc.h>
#include "nfc-utils.h"
#include "utils/nfc-utils.h"
#define MAX_FRAME_LEN 264

View file

@ -43,7 +43,7 @@
#include <nfc/nfc.h>
#include "nfc-utils.h"
#include "utils/nfc-utils.h"
#define MAX_FRAME_LEN 264

View file

@ -49,7 +49,7 @@
#include <nfc/nfc.h>
#include "nfc-utils.h"
#include "utils/nfc-utils.h"
#define MAX_FRAME_LEN (264)
#define SAK_ISO14443_4_COMPLIANT 0x20

View file

@ -52,7 +52,7 @@
#include <nfc/nfc.h>
#include "nfc-utils.h"
#include "utils/nfc-utils.h"
#define MAX_FRAME_LEN 264

View file

@ -47,7 +47,7 @@
#include <nfc/nfc.h>
#include <nfc/nfc-types.h>
#include "nfc-utils.h"
#include "utils/nfc-utils.h"
#define MAX_DEVICE_COUNT 16

View file

@ -45,7 +45,7 @@
#include <nfc/nfc.h>
#include "nfc-utils.h"
#include "utils/nfc-utils.h"
#define MAX_FRAME_LEN 264
#define MAX_DEVICE_COUNT 2

View file

@ -44,8 +44,8 @@
#include <nfc/nfc.h>
#include "nfc-utils.h"
#include "chips/pn53x.h"
#include "utils/nfc-utils.h"
#include "libnfc/chips/pn53x.h"
#define MAX_DEVICE_COUNT 16

View file

@ -45,8 +45,8 @@
#include <nfc/nfc.h>
#include "nfc-utils.h"
#include "chips/pn53x.h"
#include "utils/nfc-utils.h"
#include "libnfc/chips/pn53x.h"
#define MAX_FRAME_LEN 264
#define TIMEOUT 60 // secs.

View file

@ -64,9 +64,8 @@
#include <nfc/nfc.h>
#include "nfc-utils.h"
#include "chips/pn53x.h"
#include "utils/nfc-utils.h"
#include "libnfc/chips/pn53x.h"
#define MAX_FRAME_LEN 264

36
utils/CMakeLists.txt Normal file
View file

@ -0,0 +1,36 @@
SET(UTILS-SOURCES nfc-emulate-forum-tag2 nfc-emulate-forum-tag4 nfc-list nfc-relay-picc nfc-mfclassic nfc-mfultralight)
# XXX: Examples should not use private API!
#INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../libnfc)
INCLUDE_DIRECTORIES(${LIBUSB_INCLUDE_DIRS} ${PCSC_INCLUDE_DIRS})
LINK_DIRECTORIES(${LIBUSB_LIBRARY_DIRS} ${PCSC_LIBRARY_DIRS})
ADD_LIBRARY(nfcutils STATIC
nfc-utils.c
)
# Examples
FOREACH(source ${UTILS-SOURCES})
IF((${source} MATCHES "nfc-mfultralight") OR (${source} MATCHES "nfc-mfclassic"))
ADD_EXECUTABLE(${source} ${source}.c mifare)
ELSE()
ADD_EXECUTABLE(${source} ${source}.c)
ENDIF((${source} MATCHES "nfc-mfultralight") OR (${source} MATCHES "nfc-mfclassic"))
TARGET_LINK_LIBRARIES(${source} nfc)
TARGET_LINK_LIBRARIES(${source} nfcutils)
INSTALL(TARGETS ${source} RUNTIME DESTINATION bin COMPONENT utils)
ENDFOREACH(source)
#install required libraries
IF(WIN32)
INCLUDE(InstallRequiredSystemLibraries)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/FixBundle.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FixBundle.cmake @ONLY)
INSTALL(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/FixBundle.cmake)
ENDIF(WIN32)
IF(NOT WIN32)
# Manuals for the examples
FILE(GLOB manuals "${CMAKE_CURRENT_SOURCE_DIR}/*.1")
INSTALL(FILES ${manuals} DESTINATION ${SHARE_INSTALL_PREFIX}/man/man1 COMPONENT manuals)
ENDIF(NOT WIN32)

59
utils/Makefile.am Normal file
View file

@ -0,0 +1,59 @@
bin_PROGRAMS = \
nfc-emulate-forum-tag2 \
nfc-emulate-forum-tag4 \
nfc-list \
nfc-mfclassic \
nfc-mfsetuid \
nfc-mfultralight \
nfc-relay-picc
# set the include path found by configure
INCLUDES= $(all_includes) $(LIBNFC_CFLAGS)
AM_CFLAGS = -I$(top_srcdir)/libnfc
noinst_HEADERS = mifare.h nfc-utils.h
noinst_LTLIBRARIES = libnfcutils.la
libnfcutils_la_SOURCES = nfc-utils.c
nfc_emulate_forum_tag2_SOURCES = nfc-emulate-forum-tag2.c
nfc_emulate_forum_tag2_LDADD = $(top_builddir)/libnfc/libnfc.la \
libnfcutils.la
nfc_emulate_forum_tag4_SOURCES = nfc-emulate-forum-tag4.c
nfc_emulate_forum_tag4_LDADD = $(top_builddir)/libnfc/libnfc.la \
libnfcutils.la
nfc_list_SOURCES = nfc-list.c
nfc_list_LDADD = $(top_builddir)/libnfc/libnfc.la \
libnfcutils.la
nfc_mfultralight_SOURCES = nfc-mfultralight.c mifare.c mifare.h
nfc_mfultralight_LDADD = $(top_builddir)/libnfc/libnfc.la
nfc_mfclassic_SOURCES = nfc-mfclassic.c mifare.c mifare.h
nfc_mfclassic_LDADD = $(top_builddir)/libnfc/libnfc.la \
libnfcutils.la
nfc_mfsetuid_SOURCES = nfc-mfsetuid.c
nfc_mfsetuid_LDADD = $(top_builddir)/libnfc/libnfc.la \
libnfcutils.la
nfc_relay_picc_SOURCES = nfc-relay-picc.c
nfc_relay_picc_LDADD = $(top_builddir)/libnfc/libnfc.la \
libnfcutils.la
dist_man_MANS = \
nfc-emulate-forum-tag4.1 \
nfc-list.1 \
nfc-mfclassic.1 \
nfc-mfsetuid.1 \
nfc-mfultralight.1
if HAS_LOG4C
AM_CFLAGS += @log4c_CFLAGS@
LIBADD = @log4c_LIBS@
endif
EXTRA_DIST = CMakeLists.txt