From 2b76328c788cb590872587ab3e86c502e3244f32 Mon Sep 17 00:00:00 2001 From: Romain Tartiere Date: Fri, 8 Jan 2010 13:40:39 +0000 Subject: [PATCH] Unbreak example and add autotool stuff to help building. --- configure.ac | 2 +- examples/Makefile.am | 7 +++++++ examples/mifare-classic-format.c | 7 +++---- 3 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 examples/Makefile.am diff --git a/configure.ac b/configure.ac index 2c6ece1..7c5c2db 100644 --- a/configure.ac +++ b/configure.ac @@ -41,5 +41,5 @@ PKG_CHECK_MODULES([LIBNFC], [libnfc], [], [AC_MSG_ERROR([libnfc is mandatory.])] PKG_CONFIG_REQUIRES="libnfc" AC_SUBST([PKG_CONFIG_REQUIRES]) -AC_OUTPUT([Makefile libfreefare/Makefile libfreefare.pc]) +AC_OUTPUT([Makefile examples/Makefile libfreefare/Makefile libfreefare.pc]) diff --git a/examples/Makefile.am b/examples/Makefile.am new file mode 100644 index 0000000..7b51e90 --- /dev/null +++ b/examples/Makefile.am @@ -0,0 +1,7 @@ +AM_CFLAGS = -I. @LIBNFC_CFLAGS@ +AM_LDFLAGS = @LIBNFC_LIBS@ + +bin_PROGRAMS = mifare-classic-format + +mifare_classic_format_SOURCES = mifare-classic-format.c +mifare_classic_format_LDADD = -lnfc $(top_builddir)/libfreefare/libfreefare.la diff --git a/examples/mifare-classic-format.c b/examples/mifare-classic-format.c index 2fb30ec..689e96b 100644 --- a/examples/mifare-classic-format.c +++ b/examples/mifare-classic-format.c @@ -4,17 +4,16 @@ #include -#include -#include +#include -#define DEBUG 1 +#define DEBUG // Useful macros #ifdef DEBUG // #define DBG(x, args...) printf("DBG %s:%d: " x "\n", __FILE__, __LINE__,## args ) #define DBG(x, ...) fprintf(stderr, "DBG %s:%d: " x "\n", __FILE__, __LINE__, ## __VA_ARGS__ ) #else - #define DBG(...) {} + #define DBG(...) do {} while (0) #endif static nfc_device_t *device = NULL;