[Sheepdog] [accord][PATCH] Introduce Autoconf platform to this project

Yunkai Zhang qiushu.zyk at taobao.com
Wed Jan 18 15:11:03 CET 2012


I think it will be helpfull to users.

Signed-off-by: Yunkai Zhang <qiushu.zyk at taobao.com>
---
 .gitignore             |   34 +++++++++++
 .version               |    1 +
 Makefile               |   39 -------------
 Makefile.am            |   17 ++++++
 apps/Makefile          |   12 ----
 apps/Makefile.am       |    3 +
 apps/queue/Makefile    |   29 ----------
 apps/queue/Makefile.am |    9 +++
 autogen.sh             |    4 +
 conductor/Makefile     |   35 ------------
 conductor/Makefile.am  |    8 +++
 configure.ac           |  143 ++++++++++++++++++++++++++++++++++++++++++++++++
 include/Makefile       |   11 ----
 include/Makefile.am    |    6 ++
 lib/Makefile           |   10 ---
 lib/Makefile.am        |    6 ++
 libacrd/Makefile       |   57 -------------------
 libacrd/Makefile.am    |   17 ++++++
 libacrd/libacrd.pc.in  |    6 +-
 test/Makefile          |   91 ------------------------------
 test/Makefile.am       |   21 +++++++
 21 files changed, 272 insertions(+), 287 deletions(-)
 create mode 100644 .version
 delete mode 100644 Makefile
 create mode 100644 Makefile.am
 delete mode 100644 apps/Makefile
 create mode 100644 apps/Makefile.am
 delete mode 100644 apps/queue/Makefile
 create mode 100644 apps/queue/Makefile.am
 create mode 100755 autogen.sh
 delete mode 100644 conductor/Makefile
 create mode 100644 conductor/Makefile.am
 create mode 100644 configure.ac
 delete mode 100644 include/Makefile
 create mode 100644 include/Makefile.am
 delete mode 100644 lib/Makefile
 create mode 100644 lib/Makefile.am
 delete mode 100644 libacrd/Makefile
 create mode 100644 libacrd/Makefile.am
 delete mode 100644 test/Makefile
 create mode 100644 test/Makefile.am

diff --git a/.gitignore b/.gitignore
index ce92825..793ee46 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,8 @@
 *.[oda]
+*.l[oa]
 *.so
+*.deps
+*.libs
 cli
 *swp
 GPATH
@@ -23,4 +26,35 @@ test/watch_files
 valgrind.log
 test/test-report.*ml
 libacrd/libacrd.pc
+INSTALL
+Makefile.in
+aclocal.m4
+apps/Makefile.in
+apps/queue/Makefile.in
+autom4te.cache/
+autoscan.log
+conductor/.deps/
+conductor/Makefile.in
+config.log
+config.guess
+config.status
+configure
+cscope.out
+depcomp
+include/Makefile.in
+include/autoscan.log
+include/config.h
+include/config.h.in
+include/config.h.in~
+include/stamp-h1
+install-sh
+lib/Makefile.in
+libacrd/Makefile.in
+missing
+tags
+test/Makefile.in
 apps/queue/qbench
+config.sub
+libtool
+ltmain.sh
+m4/
diff --git a/.version b/.version
new file mode 100644
index 0000000..8acdd82
--- /dev/null
+++ b/.version
@@ -0,0 +1 @@
+0.0.1
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 79c6796..0000000
--- a/Makefile
+++ /dev/null
@@ -1,39 +0,0 @@
-VERSION ?= 0.0.1
-
-PREFIX ?= /usr
-
-export VERSION PREFIX
-
-.PHONY:all
-all:
-	$(MAKE) -C libacrd
-	$(MAKE) -C conductor
-	$(MAKE) -C test
-	$(MAKE) -C apps
-
-.PHONY:clean
-clean:
-	$(MAKE) -C libacrd clean
-	$(MAKE) -C conductor clean
-	$(MAKE) -C test clean
-	$(MAKE) -C apps clean
-	$(MAKE) -C lib clean
-
-.PHONY:install
-install:
-	$(MAKE) -C libacrd install
-	$(MAKE) -C conductor install
-	$(MAKE) -C include install
-
-.PHONY:apps
-apps:
-	$(MAKE) -C apps
-
-.PHONY:test
-test:
-	$(MAKE) -C libacrd
-	$(MAKE) -C test test
-
-.PHONY:check
-check: test
-	$(MAKE) -C test check
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..ff0ffbd
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,17 @@
+AUTOMAKE_OPTIONS	= foreign
+
+EXTRA_DIST		= autogen.sh .version
+
+MAINTAINERCLEANFILES    = Makefile.in aclocal.m4 configure depcomp \
+                          config.guess config.sub missing install-sh \
+                          autoheader automake autoconf libtool libtoolize \
+                          ltmain.sh compile autoscan.log
+
+ACLOCAL_AMFLAGS		= -I m4
+
+dist_doc_DATA 		= TODO README
+
+SUBDIRS			= lib libacrd conductor test apps include
+
+maintainer-clean-local:
+	$(AM_V_GEN)rm -rf m4
diff --git a/apps/Makefile b/apps/Makefile
deleted file mode 100644
index c7f3f91..0000000
--- a/apps/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-.PHONY:all
-all:
-	$(MAKE) -C queue
-
-.PHONY:clean
-clean:
-	$(MAKE) -C queue clean
-
-.PHONY:queue
-queue:
-	$(MAKE) -C queue
-
diff --git a/apps/Makefile.am b/apps/Makefile.am
new file mode 100644
index 0000000..17a432c
--- /dev/null
+++ b/apps/Makefile.am
@@ -0,0 +1,3 @@
+MAINTAINERCLEANFILES    = Makefile.in
+
+SUBDIRS			= queue
diff --git a/apps/queue/Makefile b/apps/queue/Makefile
deleted file mode 100644
index a0e494c..0000000
--- a/apps/queue/Makefile
+++ /dev/null
@@ -1,29 +0,0 @@
-sbindir ?= $(PREFIX)/sbin
-
-CFLAGS += -g -O3 -Wall -Wstrict-prototypes -I../../include
-CFLAGS += -D_GNU_SOURCE -DNDEBUG
-LIBS += -L../../libacrd -lpthread -lacrd
-
-PROGRAMS = qbench
-QUEUE_OBJS = queue.o
-QUEUE_DEP = $(ACCORD_OBJS:.o=.d)
-
-.PHONY:all
-all: $(PROGRAMS)
-
-qbench: $(QUEUE_OBJS)
-	$(CC) $(CFLAGS) $^ -o $@ $(LIBS)
-
--include $(ACCORD_DEP)
-
-%.o: %.c
-	$(CC) -c $(CFLAGS) $*.c -o $*.o
-	@$(CC) -MM $(CFLAGS) -MF $*.d -MT $*.o $*.c
-
-.PHONY:clean
-clean:
-	rm -f *.[od] $(PROGRAMS)
-
-# support for GNU Flymake
-check-syntax:
-	$(CC) $(CFLAGS) -fsyntax-only $(CHK_SOURCES)
diff --git a/apps/queue/Makefile.am b/apps/queue/Makefile.am
new file mode 100644
index 0000000..7a8d068
--- /dev/null
+++ b/apps/queue/Makefile.am
@@ -0,0 +1,9 @@
+MAINTAINERCLEANFILES	= Makefile.in
+
+EXTRA_DIST		= adler32.c
+
+bin_PROGRAMS 		= qbench
+qbench_SOURCES		= queue.c
+qbench_CPPFLAGS		= -D_GNU_SOURCE -DNDEBUG
+qbench_LDADD		= ../../libacrd/libacrd.la
+qbench_LDFLAGS		= -lpthread
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..3c5e1d9
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+# Run this to generate all the initial makefiles, etc.
+mkdir -p m4
+autoreconf -i -v && echo Now run ./configure and make
diff --git a/conductor/Makefile b/conductor/Makefile
deleted file mode 100644
index d4cc692..0000000
--- a/conductor/Makefile
+++ /dev/null
@@ -1,35 +0,0 @@
-sbindir ?= $(PREFIX)/sbin
-
-CFLAGS += -g -O3 -Wall -Wstrict-prototypes -I../include
-CFLAGS += -D_GNU_SOURCE -DNDEBUG
-LIBS += -lpthread -ldb -lcpg
-
-PROGRAMS = conductor
-ACCORD_OBJS = store.o conductor.o acrdnet.o acrdops.o logger.o \
-	../lib/event.o ../lib/net.o ../lib/work.o ../lib/coroutine.o
-ACCORD_DEP = $(ACCORD_OBJS:.o=.d)
-
-.PHONY:all
-all: $(PROGRAMS)
-
-conductor: $(ACCORD_OBJS)
-	$(CC) $^ -o $@ $(LIBS)
-
--include $(ACCORD_DEP)
-
-%.o: %.c
-	$(CC) -c $(CFLAGS) $*.c -o $*.o
-	@$(CC) -MM $(CFLAGS) -MF $*.d -MT $*.o $*.c
-
-.PHONY:clean
-clean:
-	rm -f *.[od] $(PROGRAMS)
-
-.PHONY:install
-install: $(PROGRAMS)
-	install -d -m 755 $(DESTDIR)$(sbindir)
-	install -m 755 $(PROGRAMS) $(DESTDIR)$(sbindir)
-
-# support for GNU Flymake
-check-syntax:
-	$(CC) $(CFLAGS) -fsyntax-only $(CHK_SOURCES)
diff --git a/conductor/Makefile.am b/conductor/Makefile.am
new file mode 100644
index 0000000..b12ddc5
--- /dev/null
+++ b/conductor/Makefile.am
@@ -0,0 +1,8 @@
+MAINTAINERCLEANFILES	= Makefile.in
+
+bin_PROGRAMS 		= conductor
+conductor_SOURCES 	= store.c conductor.c acrdnet.c acrdops.c logger.c \
+			  acrd_priv.h logger.h store.h
+conductor_CPPFLAGS	= -D_GNU_SOURCE -DNDEBUG
+conductor_LDADD		= ../lib/libutil.la
+conductor_LDFLAGS	= -lpthread -ldb -lcpg
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..0f2c634
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,143 @@
+#                                               -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ([2.61])
+AC_INIT([accord], m4_esyscmd([echo -n $(cat .version)]), [sheepdog at lists.wpkg.org])
+AC_CONFIG_SRCDIR([apps/queue/adler32.c])
+AC_CONFIG_HEADERS([include/config.h])
+AM_INIT_AUTOMAKE([-Wno-portability dist-xz color-tests parallel-tests])
+AC_CONFIG_MACRO_DIR([m4])
+LT_INIT
+
+# Checks for programs.
+AC_PROG_CC
+AC_PROG_LIBTOOL
+
+# Checks for libraries.
+AC_CHECK_LIB([pthread], [pthread_create])
+
+# Checks for header files.
+AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h memory.h netdb.h \
+		netinet/in.h stdint.h stdlib.h string.h sys/socket.h \
+		sys/time.h syslog.h unistd.h])
+
+#Check for BerkeleyDB header files.
+AC_CHECK_HEADERS([db.h], [],
+		 [AC_MSG_ERROR([db.h not found,
+		  please install BerkeleyDB (libdb) 4.8 or later])])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_C_INLINE
+AC_TYPE_INT32_T
+AC_TYPE_INT64_T
+AC_TYPE_PID_T
+AC_TYPE_SIZE_T
+AC_TYPE_UINT16_T
+AC_TYPE_UINT32_T
+AC_TYPE_UINT64_T
+AC_TYPE_UINT8_T
+
+# Checks for library functions.
+AC_FUNC_FORK
+AC_FUNC_MALLOC
+AC_FUNC_REALLOC
+AC_CHECK_FUNCS([dup2 gethostname gettimeofday memset mkdir select socket strcasecmp strdup strerror])
+
+AC_CONFIG_FILES([Makefile
+                 apps/Makefile
+                 apps/queue/Makefile
+                 conductor/Makefile
+                 include/Makefile
+                 lib/Makefile
+                 libacrd/Makefile
+                 libacrd/libacrd.pc
+                 test/Makefile])
+
+#*FLAGS handling
+ENV_CFLAGS="$CFLAGS"
+ENV_CPPFLAGS="$CPPFLAGS"
+ENV_LDFLAGS="$LDFLAGS"
+
+#local defines
+PACKAGE_FEATURES=""
+
+OPT_CFLAGS="-O3"
+
+EXTRA_WARNING="-Wall -Wstrict-prototypes"
+
+#local options
+AC_ARG_ENABLE([ansi],
+        [  --enable-ansi           : force to build with ANSI standards. ],
+        [ default="no" ])
+
+AC_ARG_ENABLE([fatal-warnings],
+        [  --enable-fatal-warnings : enable fatal warnings. ],
+        [ default="no" ])
+
+AC_ARG_ENABLE([debug],
+        [  --enable-debug          : enable debug build. ],
+        [ default="no" ])
+
+# debug build stuff
+if test "x${enable_debug}" = xyes; then
+        AC_DEFINE_UNQUOTED([DEBUG], [1], [Compiling Debugging code])
+        OPT_CFLAGS="-O0"
+        if test "x${GCC}" = xyes; then
+                GDB_FLAGS="-ggdb3"
+        else
+                GDB_FLAGS="-g"
+        fi
+        PACKAGE_FEATURES="$PACKAGE_FEATURES debug"
+fi
+
+# --- ansi ---
+if test "x${enable_ansi}" = xyes && \
+                cc_supports_flag -std=iso9899:199409 ; then
+        AC_MSG_NOTICE([Enabling ANSI Compatibility])
+        ANSI_CPPFLAGS="-ansi -D_GNU_SOURCE -DANSI_ONLY"
+        PACKAGE_FEATURES="$PACKAGE_FEATURES ansi"
+else
+        ANSI_CPPFLAGS=""
+fi
+
+# --- fatal warnings ---
+if test "x${enable_fatal_warnings}" = xyes && \
+                cc_supports_flag -Werror ; then
+        AC_MSG_NOTICE([Enabling Fatal Warnings (-Werror)])
+        WERROR_CFLAGS="-Werror"
+        PACKAGE_FEATURES="$PACKAGE_FEATURES fatal-warnings"
+else
+        WERROR_CFLAGS=""
+fi
+
+CFLAGS="$ENV_CFLAGS $OPT_CFLAGS $GDB_FLAGS $EXTRA_WARNING $WERROR_CFLAGS"
+CPPFLAGS="$ENV_CPPFLAGS $ANSI_CPPFLAGS"
+LDFLAGS="$ENV_LDFLAGS $COVERAGE_LDFLAGS"
+
+AC_OUTPUT
+
+AC_MSG_RESULT([])
+AC_MSG_RESULT([$PACKAGE configuration:])
+AC_MSG_RESULT([  Version                  = ${VERSION}])
+AC_MSG_RESULT([  Prefix                   = ${prefix}])
+AC_MSG_RESULT([  Executables              = ${sbindir}])
+AC_MSG_RESULT([  Man pages                = ${mandir}])
+AC_MSG_RESULT([  Doc dir                  = ${docdir}])
+AC_MSG_RESULT([  Libraries                = ${libdir}])
+AC_MSG_RESULT([  Header files             = ${includedir}])
+AC_MSG_RESULT([  Arch-independent files   = ${datadir}])
+AC_MSG_RESULT([  State information        = ${localstatedir}])
+AC_MSG_RESULT([  System configuration     = ${sysconfdir}])
+AC_MSG_RESULT([  Features                 =${PACKAGE_FEATURES}])
+AC_MSG_RESULT([])
+AC_MSG_RESULT([$PACKAGE build info:])
+AC_MSG_RESULT([  Optimization             = ${OPT_CFLAGS}])
+AC_MSG_RESULT([  Debug options            = ${GDB_CFLAGS}])
+AC_MSG_RESULT([  Extra compiler warnings  = ${EXTRA_WARNING}])
+AC_MSG_RESULT([  Env. defined CFLAG       = ${ENV_CFLAGS}])
+AC_MSG_RESULT([  Env. defined CPPFLAGS    = ${ENV_CPPFLAGS}])
+AC_MSG_RESULT([  Env. defined LDFLAGS     = ${ENV_LDFLAGS}])
+AC_MSG_RESULT([  Fatal War.   CFLAGS      = ${WERROR_CFLAGS}])
+AC_MSG_RESULT([  Final        CFLAGS      = ${CFLAGS}])
+AC_MSG_RESULT([  Final        CPPFLAGS    = ${CPPFLAGS}])
+AC_MSG_RESULT([  Final        LDFLAGS     = ${LDFLAGS}])
diff --git a/include/Makefile b/include/Makefile
deleted file mode 100644
index 2e50dcd..0000000
--- a/include/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-includedir ?= $(PREFIX)/include
-
-HEADERS = accord.h accord_proto.h
-
-.PHONY:all
-all:
-
-.PHONY:install
-install: $(HEADERS)
-	install -d -m 755 $(DESTDIR)$(includedir)
-	install -m 644 $(HEADERS) $(DESTDIR)$(includedir)
diff --git a/include/Makefile.am b/include/Makefile.am
new file mode 100644
index 0000000..150b2bc
--- /dev/null
+++ b/include/Makefile.am
@@ -0,0 +1,6 @@
+MAINTAINERCLEANFILES    = Makefile.in config.h.in
+
+instdir			= $(includedir)
+inst_HEADERS		= accord.h accord_proto.h
+
+noinst_HEADERS		= coroutine.h event.h list.h net.h util.h work.h
diff --git a/lib/Makefile b/lib/Makefile
deleted file mode 100644
index b701ed9..0000000
--- a/lib/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-CFLAGS += -g -O3 -Wall -Wstrict-prototypes -I../include
-CFLAGS += -D_GNU_SOURCE -DNDEBUG
-
-.PHONY:clean
-clean:
-	rm -f *.[od]
-
-# support for GNU Flymake
-check-syntax:
-	$(CC) $(CFLAGS) -fsyntax-only $(CHK_SOURCES)
diff --git a/lib/Makefile.am b/lib/Makefile.am
new file mode 100644
index 0000000..912e5e6
--- /dev/null
+++ b/lib/Makefile.am
@@ -0,0 +1,6 @@
+MAINTAINERCLEANFILES 	= Makefile.in
+
+noinst_LTLIBRARIES	= libutil.la
+
+libutil_la_SOURCES	= coroutine.c event.c net.c work.c
+libutil_la_CPPFLAGS	= -D_GNU_SOURCE -DNDEBUG
diff --git a/libacrd/Makefile b/libacrd/Makefile
deleted file mode 100644
index 6338c02..0000000
--- a/libacrd/Makefile
+++ /dev/null
@@ -1,57 +0,0 @@
-libdir ?= $(PREFIX)/lib
-
-CFLAGS += -g -O3 -Wall -Wstrict-prototypes -I../include
-CFLAGS += -D_GNU_SOURCE -DNDEBUG -fPIC
-
-LIBRARIES = libacrd.a libacrd.so
-LIBACRD_OBJS = libacrd.o ../lib/net.o ../lib/work.o ../lib/coroutine.o
-LIBACRD_DEP = $(LIBACRD_OBJS:.o=.d)
-LIBACRD_VERSION = libacrd.map
-
-PCFILES = libacrd.pc
-
-ARFLAGS = cru
-RANLIB = ranlib
-
-.PHONY:all
-all: $(LIBRARIES)
-
-libacrd.a: $(LIBACRD_OBJS)
-	$(AR) $(ARFLAGS) $@ $^
-	$(RANLIB) $@
-
-libacrd.so: $(LIBACRD_OBJS)
-	$(CC) -shared $^ -o $@ -Wl,-version-script=$(LIBACRD_VERSION)
-
-libacrd.pc: libacrd.pc.in Makefile
-	rm -f $@-t $@
-	sed \
-		-e 's#@''PREFIX@#$(PREFIX)#g' \
-		-e 's#@''LIBDIR@#$(libdir)#g' \
-		-e 's#@''VERSION@#$(VERSION)#g' \
-	    $< > $@-t
-	chmod a-w $@-t
-	mv $@-t $@
-
--include $(LIBACRD_DEP)
-
-%.o: %.c
-	$(CC) -c $(CFLAGS) $*.c -o $*.o
-	@$(CC) -MM $(CFLAGS) -MF $*.d -MT $*.o $*.c
-
-.PHONY:clean
-clean:
-	echo $(ARFLAGS)
-	echo $(RANLIB)
-	rm -f *.[od] $(LIBRARIES) $(PCFILES)
-
-.PHONY:install
-install: $(LIBRARIES) $(PCFILES)
-	install -d -m 755 $(DESTDIR)$(libdir)
-	install -m 644 $(LIBRARIES) $(DESTDIR)$(libdir)
-	install -d -m 755 $(DESTDIR)$(libdir)/pkgconfig
-	install -m 644 $(PCFILES) $(DESTDIR)$(libdir)/pkgconfig
-
-# support for GNU Flymake
-check-syntax:
-	$(CC) $(CFLAGS) -fsyntax-only $(CHK_SOURCES)
diff --git a/libacrd/Makefile.am b/libacrd/Makefile.am
new file mode 100644
index 0000000..ff10cbb
--- /dev/null
+++ b/libacrd/Makefile.am
@@ -0,0 +1,17 @@
+MAINTAINERCLEANFILES 	= Makefile.in libacrd.pc
+
+EXTRA_DIST		= libacrd.map
+
+#library version infomation
+current 	= 1
+revision 	= 0
+age		= 0
+
+lib_LTLIBRARIES         = libacrd.la
+
+libacrd_la_SOURCES	= libacrd.c ../lib/net.c ../lib/work.c ../lib/coroutine.c
+libacrd_la_CPPFLAGS	= -D_GNU_SOURCE -DNDEBUG -fPIC -I../include
+libacrd_la_LDFLAGS	= -version-info ${current}:${revision}:${age} -Wl,--version-script=libacrd.map
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libacrd.pc
diff --git a/libacrd/libacrd.pc.in b/libacrd/libacrd.pc.in
index 4e07509..ae1d586 100644
--- a/libacrd/libacrd.pc.in
+++ b/libacrd/libacrd.pc.in
@@ -1,10 +1,10 @@
-prefix=@PREFIX@
+prefix=@prefix@
 exec_prefix=${prefix}
-libdir=@LIBDIR@
+libdir=@libdir@
 includedir=${prefix}/include
 
 Name: libacrd
-Version: @VERSION@
+Version: @PACKAGE_VERSION@
 Description: libacrd
 Requires:
 Libs: -L${libdir} -lacrd
diff --git a/test/Makefile b/test/Makefile
deleted file mode 100644
index 14aedc8..0000000
--- a/test/Makefile
+++ /dev/null
@@ -1,91 +0,0 @@
-CFLAGS += -g -O3 -Wall -Wstrict-prototypes -I../include
-CFLAGS += -D_GNU_SOURCE
-CFLAGS += $(shell pkg-config --cflags glib-2.0)
-LIBS += -lpthread
-
-TESTS = test-io test-aio test-txn test-watch test-concurrent test-coroutine
-TEST_XML_FILE = test-report.xml
-TEST_HTML_FILE = test-report.html
-TEST_LIBS += $(shell pkg-config --libs glib-2.0)
-
-PROGRAMS = acrdbench watch_nodes watch_files
-BDRBENCH_OBJS = acrdbench.o
-BDRBENCH_DEP = $(BDRBENCH_OBJS:.o=.d)
-WATCH_NODES_OBJS = watch_nodes.o
-WATCH_NODES_DEP = $(TEST_OBJS:.o=.d)
-WATCH_FILES_OBJS = watch_files.o
-WATCH_FILES_DEP = $(TEST_OBJS:.o=.d)
-
-TEST_IO_OBJS = test-io.o
-TEST_IO_DEP = $(TEST_IO_OBJS:.o=.d)
-TEST_AIO_OBJS = test-aio.o
-TEST_AIO_DEP = $(TEST_TXN_OBJS:.o=.d)
-TEST_TXN_OBJS = test-txn.o
-TEST_TXN_DEP = $(TEST_TXN_OBJS:.o=.d)
-TEST_WATCH_OBJS = test-watch.o
-TEST_WATCH_DEP = $(TEST_WATCH_OBJS:.o=.d)
-TEST_CONCURRENT_OBJS = test-concurrent.o
-TEST_CONCURRENT_DEP = $(TEST_CONCURRENT_OBJS:.o=.d)
-TEST_COROUTINE_OBJS = test-coroutine.o ../lib/coroutine.o
-TEST_COROUTINE_DEP = $(TEST_COROUTINE_OBJS:.o=.d)
-
-.PHONY:all
-all: $(PROGRAMS)
-
-acrdbench: $(BDRBENCH_OBJS) ../libacrd/libacrd.a
-	$(CC) $^ -o $@ $(LIBS)
-
-watch_nodes: $(WATCH_NODES_OBJS) ../libacrd/libacrd.a
-	$(CC) $^ -o $@ $(LIBS)
-
-watch_files: $(WATCH_FILES_OBJS) ../libacrd/libacrd.a
-	$(CC) $^ -o $@ $(LIBS)
-
-test-io: $(TEST_IO_OBJS) ../libacrd/libacrd.a
-	$(CC) $^ -o $@ $(LIBS) $(TEST_LIBS)
-
-test-aio: $(TEST_AIO_OBJS) ../libacrd/libacrd.a
-	$(CC) $^ -o $@ $(LIBS) $(TEST_LIBS)
-
-test-txn: $(TEST_TXN_OBJS) ../libacrd/libacrd.a
-	$(CC) $^ -o $@ $(LIBS) $(TEST_LIBS)
-
-test-watch: $(TEST_WATCH_OBJS) ../libacrd/libacrd.a
-	$(CC) $^ -o $@ $(LIBS) $(TEST_LIBS)
-
-test-concurrent: $(TEST_CONCURRENT_OBJS) ../libacrd/libacrd.a
-	$(CC) $^ -o $@ $(LIBS) $(TEST_LIBS)
-
-test-coroutine: $(TEST_COROUTINE_OBJS) ../libacrd/libacrd.a
-	$(CC) $^ -o $@ $(LIBS) $(TEST_LIBS)
-
--include $(TEST_DEP)
--include $(BDRBENCH_DEP)
--include $(WATCH_NODES_DEP)
--include $(WATCH_FILES_DEP)
--include $(TEST_IO_DEP)
--include $(TEST_AIO_DEP)
--include $(TEST_TXN_DEP)
--include $(TEST_WATCH_DEP)
--include $(TEST_CONCURRENT_DEP)
--include $(TEST_COROUTINE_DEP)
-
-%.o: %.c
-	$(CC) -c $(CFLAGS) $*.c -o $*.o
-	@$(CC) -MM $(CFLAGS) -MF $*.d -MT $*.o $*.c
-
-.PHONY:clean
-clean:
-	rm -f *.[od] $(PROGRAMS) $(TEST_XML_FILE)
-
-.PHONY:test
-test: $(TESTS)
-
-.PHONY:check
-check:
-	gtester -k -o $(TEST_XML_FILE) $(TESTS); \
-		gtester-report $(TEST_XML_FILE) > $(TEST_HTML_FILE)
-
-# support for GNU Flymake
-check-syntax:
-	$(CC) $(CFLAGS) -fsyntax-only $(CHK_SOURCES)
diff --git a/test/Makefile.am b/test/Makefile.am
new file mode 100644
index 0000000..941f11e
--- /dev/null
+++ b/test/Makefile.am
@@ -0,0 +1,21 @@
+TEST_XML_FILE 	= test-report.xml
+TEST_HTML_FILE 	= test-report.html
+
+CLEANFILES		= $(TEST_XML_FILE) $(TEST_HTML_FILE)
+MAINTAINERCLEANFILES	= Makefile.in
+
+AM_CPPFLAGS		= -D_GNU_SOURCE -DNDEBUG $(shell pkg-config --cflags glib-2.0)
+AM_LDFLAGS		= -lpthread $(shell pkg-config --libs glib-2.0)
+
+LIBS			= ../libacrd/libacrd.la ../lib/libutil.la
+
+noinst_PROGRAMS 	= acrdbench watch_nodes watch_files
+acrdbench_SOURCES	= acrdbench.c
+watch_nodes_SOURCES	= watch_nodes.c
+watch_files_SOURCES	= watch_files.c
+
+check_PROGRAMS		= test-io test-aio test-txn test-watch test-concurrent test-coroutine
+
+check:
+	gtester -k -o $(TEST_XML_FILE) $(check_PROGRAMS); \
+		gtester-report $(TEST_XML_FILE) > $(TEST_HTML_FILE)
-- 
1.7.7.5




More information about the sheepdog mailing list