?

Log in

No account? Create an account
memcached autoconf/automake help - brad's life — LiveJournal [entries|archive|friends|userinfo]
Brad Fitzpatrick

[ website | bradfitz.com ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

memcached autoconf/automake help [Sep. 5th, 2006|03:55 pm]
Brad Fitzpatrick
[Tags|, ]

I don't want this to turn into an "Autotools sucks!" thread. I just want help....

Requirements:
  • I want "make test" to run against a binary that has assert() enabled (AM_CFLAGS not containing "-DNDEBUG").
  • I want users to have a choice to run a binary with asserts on or off. CPU vs. paranoia trade-off. Whether this is building two binaries and installing them both on the system, or letting them choose with --without-asserts or --with-asserts, I don't care.
What's the best way to do this?
Are there best practices regarding similar things? (testing with asserts on, regardless of their ultimate choice)

Here's my current Makefile.am:
bin_PROGRAMS = memcached memcached_SOURCES = memcached.c slabs.c items.c memcached.h assoc.c memcached_LDADD = @LIBOBJS@ SUBDIRS = doc DIST_DIRS = scripts EXTRA_DIST = doc scripts TODO t test: memcached prove t # Uncomment the following to save some CPU (by disabling assertions) #AM_CFLAGS=-DNDEBUG dist-hook: rm -rf $(distdir)/doc/.svn/ rm -rf $(distdir)/scripts/.svn/ rm -rf $(distdir)/t/.svn/ rm -rf $(distdir)/t/lib/.svn/
Suggestions?
LinkReply

Comments:
[User Picture]From: robbat2
2006-09-06 01:39 am (UTC)
see your email.

duplicated here for everybody else:
Index: Makefile.am
===================================================================
--- Makefile.am (revision 374)
+++ Makefile.am (working copy)
@@ -1,12 +1,17 @@
-bin_PROGRAMS = memcached
+bin_PROGRAMS = memcached memcached-debug

-memcached_SOURCES = memcached.c slabs.c items.c memcached.h assoc.c
+memcached_SOURCES = memcached.c slabs.c items.c assoc.c
+memcached_debug_SOURCES = $(memcached_SOURCES)
+memcached_CPPFLAGS = -DNDEBUG
memcached_LDADD = @LIBOBJS@
+memcached_debug_LDADD = $(memcached_LDADD)

SUBDIRS = doc
DIST_DIRS = scripts
EXTRA_DIST = doc scripts TODO t

+memcached.c: memcached.h
+
test: memcached
prove t

(Reply) (Parent) (Thread)
[User Picture]From: brad
2006-09-06 07:52 am (UTC)
Wonderful, thanks!
(Reply) (Parent) (Thread)