From owner-freebsd-dtrace@FreeBSD.ORG Tue Feb 25 01:31:23 2014 Return-Path: Delivered-To: dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9CB05A0A; Tue, 25 Feb 2014 01:31:23 +0000 (UTC) Received: from mail-ig0-x235.google.com (mail-ig0-x235.google.com [IPv6:2607:f8b0:4001:c05::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 54B501E0C; Tue, 25 Feb 2014 01:31:23 +0000 (UTC) Received: by mail-ig0-f181.google.com with SMTP id y6so171434igj.2 for ; Mon, 24 Feb 2014 17:31:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=QHfDELhbtck0TOpNz03J2oU7l1mTsFSgmvaZRvHIZks=; b=KKKrUW1ECDXta8JoYgBBbdqJDCN043TDxIXNwzepBsbGVrBYteYx5MLiYnxStOvV9I 69LGA1ThtP/VXbCjHccro/bP8M3oT5SdZXQKJCSQKIq+oxp1fo3Zmymf1Tn/q0ZuPBWp 3WhVZHhFoOi3+J5oO0iT9V3Tmo0JCKnXhsOtCH4rg4Qd/rzAn2TXrf5KvHxVnOEofr6i fjx779VthKOIYAhpc4Pylv8l/WWn4RDUETXyQbecAv3pYLGBBm0x+WT2QH2qxGyYPSyo iDECksYxhJxcWjD+hebY6Jp+jCDFLcySBVIsN7fONA/ALldD6bL5iA/9PuFJHFZRP+PT fAdQ== X-Received: by 10.42.41.82 with SMTP id o18mr16601163ice.50.1393291881236; Mon, 24 Feb 2014 17:31:21 -0800 (PST) Received: from raichu (198-84-185-216.cpe.teksavvy.com. [198.84.185.216]) by mx.google.com with ESMTPSA id r6sm32261081igg.10.2014.02.24.17.31.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Feb 2014 17:31:20 -0800 (PST) Sender: Mark Johnston Date: Mon, 24 Feb 2014 20:31:15 -0500 From: markj@freebsd.org To: Mikolaj Golub Subject: Re: Improvements to bsd.dtrace.mk Message-ID: <20140225013115.GA64934@raichu> References: <20140126162712.GA11086@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140126162712.GA11086@gmail.com> User-Agent: Mutt/1.5.22 (2013-10-16) Cc: Rui Paulo , dtrace@freebsd.org X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Feb 2014 01:31:23 -0000 On Sun, Jan 26, 2014 at 06:27:13PM +0200, Mikolaj Golub wrote: > Hi, > Hi Mikolaj, > Trying to use bsd.dtrace.mk for building userland programs with > statically defined traces, I facesed the following issues: > > 1) To generate a header file (e.g. provider.h) from a dtrace file > (provider.d) you had to explicitly run `make depend'. > > 2) If a makefile included bsd.dtrace.mk and sources contained probe > macros, it would fail to build when WITH_DTRACE was not > defined. I.e. you couldn't build the same sources with and without > dtrace probes. > > 3) It failed to build if you had several provider files (several files > specified in DTRACEOBJS). > > 4) It failed if OBJDIR was not current directory. > > 5) It failed to rebuild dtrace objects if the old ones had not been > removed before, because dtrace(1) refuses to rewrite objects. Note that this behaviour is specific to FreeBSD; see: http://svnweb.freebsd.org/base?view=revision&revision=212358 I'm not sure if it's still necessary. > > 6) It was not possible to specify additional trace(1) options (e.g. > library or header directory paths). > > Here is my attempt to solve most of these issues: > > http://people.freebsd.org/~trociny/patches/bsd.dtrace.mk.3.patch > > The only issue remains is (1) -- necessity to run `make depend' to > generate probider header files. I had also to tweak dt_program.c -- > header files generation. I've been working around this by adding "all: depend" to my Makefiles, but there should be a better way to do it. What do you think of just replacing beforedepend: ${DTRACEHEADERS} with ${SRCS}: ${DTRACEHEADERS} ? It's overkill, but it seems to result in the correct behaviour for me. I spent a bit of time looking other examples of auto-generated headers in the tree, but couldn't find any. > > Note, I didn't have much practice in writing makefiles, so any > suggestions how this can be improved (or should be done properly) are > highly appreciated. It works and looks fine to me, for what that's worth. I tested with some Makefiles that I've written in the past. I'm not aware of any ports that make use of bsd.dtrace.mk. As a side comment, I'm wondering whether it should be necessary to have Makefiles explicitly include bsd.dtrace.mk. Maybe bsd.prog.mk and bsd.lib.mk could always include bsd.dtrace.mk, which will have no effect when DTRACESRCS isn't defined. Thanks, -Mark