  case ".$NGX_ERROR_LOG_PATH" in
      ./* | .)
      ;;
-@@ -151,6 +175,21 @@ install:	$NGX_OBJS${ngx_dirsep}nginx${ngx_binext} \
+@@ -151,6 +175,36 @@ install:	$NGX_OBJS${ngx_dirsep}nginx${ngx_binext} \
  		|| cp -R $NGX_HTML '\$(DESTDIR)$NGX_PREFIX'
  END
  
 +if [ $NGX_DTRACE = YES ]; then
 +
++    ngx_tapset_srcs="$NGX_TAPSET_SRCS"
++
++        cat << END                                            >> $NGX_MAKEFILE
++	test -d '\$(DESTDIR)$NGX_TAPSET_PREFIX' || \
++		mkdir -p '\$(DESTDIR)$NGX_TAPSET_PREFIX'
++END
++
++    for ngx_tapset_src in $ngx_tapset_srcs
++    do
++        ngx_tapset_file=`basename $ngx_tapset_src`
++
++        cat << END                                            >> $NGX_MAKEFILE
++
++	sed -e "s|NGX_SBIN_PATH|$NGX_SBIN_PATH|g" $ngx_long_cont \
++                $ngx_tapset_src > '\$(DESTDIR)$NGX_TAPSET_PREFIX/$ngx_tapset_file'
++END
++
++    done
++
 +    cat << END                                                >> $NGX_MAKEFILE
-+
-+	test -d '\$(DESTDIR)`dirname "$NGX_TAPSET_PATH"`' || \
-+		mkdir -p '\$(DESTDIR)`dirname "$NGX_TAPSET_PATH"`'
-+	cp $NGX_OBJS/nginx.stp '\$(DESTDIR)$NGX_TAPSET_PATH'
 +
 +	test -d '\$(DESTDIR)`dirname "$NGX_STAP_NGX_PATH"`' || \
 +		mkdir -p '\$(DESTDIR)`dirname "$NGX_STAP_NGX_PATH"`'

 NGX_CONF_PREFIX=`dirname $NGX_CONF_PATH`
 NGX_PID_PATH=${NGX_PID_PATH:-logs/nginx.pid}
 NGX_LOCK_PATH=${NGX_LOCK_PATH:-logs/nginx.lock}
+NGX_TAPSET_PATH=${NGX_TAPSET_PATH:-tapset/nginx.stp}
 
 if [ ".$NGX_ERROR_LOG_PATH" = ".stderr" ]; then
     NGX_ERROR_LOG_PATH=
diff --git a/auto/sources b/auto/sources
index 374ad66..70eed77 100644
--- a/auto/sources
+++ b/auto/sources
@@ -39,6 +39,11 @@ CORE_DEPS="src/core/nginx.h \

+	\$(DTRACE) -xnolibs -G -o $ngx_dtrace_obj -s $ngx_dtrace_d $ngx_objs
+END
+
+    ngx_deps="$ngx_deps$ngx_long_cont$ngx_dtrace_obj$ngx_long_cont$NGX_OBJS${ngx_dirsep}stap-nginx"
+    ngx_objs="$ngx_objs$ngx_long_cont$ngx_dtrace_obj"
+fi
+
