From 6aae96e1e1410686a5d0f4d845a2ddf125ba4e4f Mon Sep 17 00:00:00 2001
From: Romuald Conty <romuald@libnfc.org>
Date: Tue, 6 Oct 2009 08:32:50 +0000
Subject: [PATCH] Move examples into src/examples subdirectory. Change examples
 names to nfc-* (or nfcip-*).

---
 configure.ac                                  |  1 +
 src/Makefile.am                               | 34 +-----------------
 src/examples/Makefile.am                      | 35 +++++++++++++++++++
 src/{ => examples}/mifaretag.h                |  0
 src/{ => examples}/mifareultag.h              |  0
 src/{ => examples}/nfc-anticol.1              |  0
 src/{anticol.c => examples/nfc-anticol.c}     |  0
 src/{ => examples}/nfc-emulate.1              |  0
 src/{emulate.c => examples/nfc-emulate.c}     |  0
 src/{ => examples}/nfc-list.1                 |  0
 src/{list.c => examples/nfc-list.c}           |  0
 src/{ => examples}/nfc-mftool.1               |  0
 src/{mftool.c => examples/nfc-mftool.c}       |  0
 src/{mfultool.c => examples/nfc-mfultool.c}   |  0
 src/{ => examples}/nfc-relay.1                |  0
 src/{relay.c => examples/nfc-relay.c}         |  0
 .../nfcip-initiator.c}                        |  0
 src/{target.c => examples/nfcip-target.c}     |  0
 18 files changed, 37 insertions(+), 33 deletions(-)
 create mode 100644 src/examples/Makefile.am
 rename src/{ => examples}/mifaretag.h (100%)
 rename src/{ => examples}/mifareultag.h (100%)
 rename src/{ => examples}/nfc-anticol.1 (100%)
 rename src/{anticol.c => examples/nfc-anticol.c} (100%)
 rename src/{ => examples}/nfc-emulate.1 (100%)
 rename src/{emulate.c => examples/nfc-emulate.c} (100%)
 rename src/{ => examples}/nfc-list.1 (100%)
 rename src/{list.c => examples/nfc-list.c} (100%)
 rename src/{ => examples}/nfc-mftool.1 (100%)
 rename src/{mftool.c => examples/nfc-mftool.c} (100%)
 rename src/{mfultool.c => examples/nfc-mfultool.c} (100%)
 rename src/{ => examples}/nfc-relay.1 (100%)
 rename src/{relay.c => examples/nfc-relay.c} (100%)
 rename src/{initiator.c => examples/nfcip-initiator.c} (100%)
 rename src/{target.c => examples/nfcip-target.c} (100%)

diff --git a/configure.ac b/configure.ac
index e3df80e..7d3e134 100644
--- a/configure.ac
+++ b/configure.ac
@@ -149,6 +149,7 @@ fi
 AC_CONFIG_FILES([
 		Makefile
 		src/Makefile
+		src/examples/Makefile
 		libnfc.pc
 		])
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 47a50bf..985ef96 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,15 +1,11 @@
-enable_pcsc_lite = @enable_pcsc_lite@
-
-bin_PROGRAMS = nfc-anticol nfc-list nfc-mftool nfc-mfultool nfc-relay nfc-emulate nfcip-target nfcip-initiator
+SUBDIRS = . examples
 
 # set the include path found by configure
 INCLUDES= $(all_includes)
 
 nfc_devices_headers = dev_arygon.h
-nfc_examples_headers = mifaretag.h mifareultag.h
 nfcinclude_HEADERS = libnfc.h bitutils.h defines.h types.h rs232.h devices.h messages.h
 nfcinclude_HEADERS += $(nfc_devices_headers)
-nfcinclude_HEADERS += $(nfc_examples_headers)
 nfcincludedir = $(includedir)/libnfc
 
 lib_LTLIBRARIES = libnfc.la
@@ -31,31 +27,3 @@ if LIBUSB_ENABLED
   libnfc_la_LIBADD  += @LIBUSB_LIBS@
 endif
 
-nfc_anticol_SOURCES = anticol.c
-nfc_anticol_LDADD = libnfc.la
-
-nfc_list_SOURCES = list.c
-nfc_list_LDADD = libnfc.la
-
-nfc_mfultool_SOURCES = mfultool.c
-nfc_mfultool_LDADD = libnfc.la
-
-nfc_mftool_SOURCES = mftool.c
-nfc_mftool_LDADD = libnfc.la
-
-nfc_relay_SOURCES = relay.c
-nfc_relay_LDADD = libnfc.la
-
-nfc_emulate_SOURCES = emulate.c
-nfc_emulate_LDADD = libnfc.la
-
-nfcip_target_SOURCES = target.c
-nfcip_target_LDADD = libnfc.la
-
-nfcip_initiator_SOURCES = initiator.c
-nfcip_initiator_LDADD = libnfc.la
-
-dist_man_MANS = nfc-anticol.1 nfc-emulate.1 nfc-list.1 nfc-mftool.1 nfc-relay.1
-#dist_man_MANS = $(man_MANS)
-#EXTRA_DIST = $(man_MANS)
-
diff --git a/src/examples/Makefile.am b/src/examples/Makefile.am
new file mode 100644
index 0000000..de6d8f9
--- /dev/null
+++ b/src/examples/Makefile.am
@@ -0,0 +1,35 @@
+bin_PROGRAMS = nfc-anticol nfc-list nfc-mftool nfc-mfultool nfc-relay nfc-emulate nfcip-target nfcip-initiator
+
+# set the include path found by configure
+INCLUDES= $(all_includes)
+
+AM_CFLAGS = -I$(top_srcdir)/src
+
+nfc_anticol_SOURCES = nfc-anticol.c
+nfc_anticol_LDADD = $(top_builddir)/src/libnfc.la
+
+nfc_list_SOURCES = nfc-list.c
+nfc_list_LDADD = $(top_builddir)/src/libnfc.la
+
+nfc_mfultool_SOURCES = nfc-mfultool.c mifareultag.h
+nfc_mfultool_LDADD = $(top_builddir)/src/libnfc.la
+
+nfc_mftool_SOURCES = nfc-mftool.c mifaretag.h
+nfc_mftool_LDADD = $(top_builddir)/src/libnfc.la
+
+nfc_relay_SOURCES = nfc-relay.c
+nfc_relay_LDADD = $(top_builddir)/src/libnfc.la
+
+nfc_emulate_SOURCES = nfc-emulate.c
+nfc_emulate_LDADD = $(top_builddir)/src/libnfc.la
+
+nfcip_target_SOURCES = nfcip-target.c
+nfcip_target_LDADD = $(top_builddir)/src/libnfc.la
+
+nfcip_initiator_SOURCES = nfcip-initiator.c
+nfcip_initiator_LDADD = $(top_builddir)/src/libnfc.la
+
+dist_man_MANS = nfc-anticol.1 nfc-emulate.1 nfc-list.1 nfc-mftool.1 nfc-relay.1
+#dist_man_MANS = $(man_MANS)
+#EXTRA_DIST = $(man_MANS)
+
diff --git a/src/mifaretag.h b/src/examples/mifaretag.h
similarity index 100%
rename from src/mifaretag.h
rename to src/examples/mifaretag.h
diff --git a/src/mifareultag.h b/src/examples/mifareultag.h
similarity index 100%
rename from src/mifareultag.h
rename to src/examples/mifareultag.h
diff --git a/src/nfc-anticol.1 b/src/examples/nfc-anticol.1
similarity index 100%
rename from src/nfc-anticol.1
rename to src/examples/nfc-anticol.1
diff --git a/src/anticol.c b/src/examples/nfc-anticol.c
similarity index 100%
rename from src/anticol.c
rename to src/examples/nfc-anticol.c
diff --git a/src/nfc-emulate.1 b/src/examples/nfc-emulate.1
similarity index 100%
rename from src/nfc-emulate.1
rename to src/examples/nfc-emulate.1
diff --git a/src/emulate.c b/src/examples/nfc-emulate.c
similarity index 100%
rename from src/emulate.c
rename to src/examples/nfc-emulate.c
diff --git a/src/nfc-list.1 b/src/examples/nfc-list.1
similarity index 100%
rename from src/nfc-list.1
rename to src/examples/nfc-list.1
diff --git a/src/list.c b/src/examples/nfc-list.c
similarity index 100%
rename from src/list.c
rename to src/examples/nfc-list.c
diff --git a/src/nfc-mftool.1 b/src/examples/nfc-mftool.1
similarity index 100%
rename from src/nfc-mftool.1
rename to src/examples/nfc-mftool.1
diff --git a/src/mftool.c b/src/examples/nfc-mftool.c
similarity index 100%
rename from src/mftool.c
rename to src/examples/nfc-mftool.c
diff --git a/src/mfultool.c b/src/examples/nfc-mfultool.c
similarity index 100%
rename from src/mfultool.c
rename to src/examples/nfc-mfultool.c
diff --git a/src/nfc-relay.1 b/src/examples/nfc-relay.1
similarity index 100%
rename from src/nfc-relay.1
rename to src/examples/nfc-relay.1
diff --git a/src/relay.c b/src/examples/nfc-relay.c
similarity index 100%
rename from src/relay.c
rename to src/examples/nfc-relay.c
diff --git a/src/initiator.c b/src/examples/nfcip-initiator.c
similarity index 100%
rename from src/initiator.c
rename to src/examples/nfcip-initiator.c
diff --git a/src/target.c b/src/examples/nfcip-target.c
similarity index 100%
rename from src/target.c
rename to src/examples/nfcip-target.c