Browse files

MB-6373: Move object files down to their subdirectories

Change-Id: If98fcc07136b1e3ed5a1e5c8fe922b207be36a30
Reviewed-on: http://review.couchbase.org/20014
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
  • Loading branch information...
1 parent 77a3dd9 commit 098f64b60602a9296bad9c9102e14acb6e393e2b @trondn trondn committed Aug 22, 2012
Showing with 61 additions and 14 deletions.
  1. +1 −0 .gitignore
  2. +11 −13 Makefile.am
  3. +48 −0 config/ltdtrace.sh
  4. +1 −1 configure.ac
View
1 .gitignore
@@ -9,6 +9,7 @@
*.tcov
*~
.deps
+.dirstamp
/.libs/
/INSTALL
/aclocal.m4
View
24 Makefile.am
@@ -180,10 +180,10 @@ endif
if DTRACE_INSTRUMENT_OBJ
memcached_LDADD += memcached_dtrace.o
memcached_DEPENDENCIES += memcached_dtrace.o
-CLEANFILES += memcached_dtrace.o default_engine_dtrace.lo
+CLEANFILES += memcached_dtrace.o engines/default_engine/default_engine_la-dtrace.lo
-default_engine_la_LIBADD += default_engine_dtrace.lo
-default_engine_la_DEPENDENCIES += default_engine_dtrace.lo
+default_engine_la_LIBADD += engines/default_engine/default_engine_la-dtrace.lo
+default_engine_la_DEPENDENCIES += engines/default_engine/default_engine_la-dtrace.lo
endif
# ASCII support for the scrub command
@@ -268,16 +268,14 @@ memcached_dtrace.h: memcached_dtrace.d
mv mmc_dtrace.tmp memcached_dtrace.h
memcached_dtrace.o: $(memcached_OBJECTS)
- $(DTRACE) $(DTRACEFLAGS) -G -o memcached_dtrace.o -s ${srcdir}/memcached_dtrace.d $(memcached_OBJECTS)
-
-# We don't have real libtool support for dtrace (at least I
-# don't know how that works), so instead I just copy the
-# .lo file from assoc.lo and replace all references to assoc.x with
-# default_engine_dtrace.x
-DEFAULT_ENGINE_OBJS=$(default_engine_la_OBJECTS:%lo=.libs/%o)
-default_engine_dtrace.lo: $(default_engine_la_OBJECTS)
- $(DTRACE) $(DTRACEFLAGS) -G -o .libs/default_engine_la-default_engine_dtrace.o -s ${srcdir}/memcached_dtrace.d $(DEFAULT_ENGINE_OBJS)
- sed -e s,assoc,default_engine_dtrace,g default_engine_la-assoc.lo > default_engine_dtrace.lo
+ $(DTRACE) $(DTRACEFLAGS) -G -o memcached_dtrace.o \
+ -s ${srcdir}/memcached_dtrace.d $(memcached_OBJECTS)
+
+engines/default_engine/default_engine_la-dtrace.lo: $(default_engine_la_OBJECTS)
+ ${top_srcdir}/config/ltdtrace.sh \
+ $(DTRACE) $(DTRACEFLAGS) -G \
+ -o engines/default_engine/default_engine_la-dtrace.lo \
+ -s ${srcdir}/memcached_dtrace.d $(default_engine_la_OBJECTS)
DIST_DIRS = scripts
EXTRA_DIST = doc scripts t memcached_dtrace.d m4/version.m4 \
View
48 config/ltdtrace.sh
@@ -0,0 +1,48 @@
+#! /bin/sh
+# A really really simple wrapper on top of dtrace that allows me to
+# pass along the .lo files (and have it generate a .lo file) so
+# that it integrates a little bit better with automake etc.
+cmd=
+looutfile=
+outfile=
+
+for f in $*
+do
+ echo $f | grep '.lo$' > /dev/null
+ if [ $? -eq 0 ]
+ then
+ if [ "x$looutfile" = "x" ]
+ then
+ looutfile=$f
+ outfile=`basename $f`
+ outfile=.libs/`echo $outfile | sed -e 's,lo$,o,g'`
+ cmd="$cmd `dirname $f`/$outfile"
+ else
+ set -e
+ dir=`dirname $f`
+ fname=`grep ^pic_object= $f | cut -f 2 -d\'`
+ cmd="$cmd $dir/$fname"
+ set +e
+ fi
+ else
+ cmd="$cmd $f"
+ fi
+done
+
+# remove the old lo file
+rm -f $looutfile
+
+echo $cmd
+$cmd
+if [ $? -ne 0 ]
+then
+ exit $?
+fi
+
+# generate a new lo file
+ltversion=`./libtool --version | head -1`
+cat > $looutfile <<EOF
+# Generated by $ltversion
+pic_object='$outfile'
+non_pic_object=none
+EOF
View
2 configure.ac
@@ -6,7 +6,7 @@ AC_INIT(memcached, VERSION_NUMBER, memcached@googlegroups.com)
AC_CONFIG_AUX_DIR(config)
AC_CANONICAL_SYSTEM
AC_CONFIG_SRCDIR(Makefile.am)
-AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
+AM_INIT_AUTOMAKE(subdir-objects foreign)
AM_CONFIG_HEADER(config.h)
AC_CONFIG_MACRO_DIR([m4])

0 comments on commit 098f64b

Please sign in to comment.