From owner-freebsd-dtrace@FreeBSD.ORG Tue Feb 25 19:18:38 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 4CFD675F; Tue, 25 Feb 2014 19:18:38 +0000 (UTC) Received: from mail-lb0-x22a.google.com (mail-lb0-x22a.google.com [IPv6:2a00:1450:4010:c04::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7030B1DC8; Tue, 25 Feb 2014 19:18:37 +0000 (UTC) Received: by mail-lb0-f170.google.com with SMTP id s7so743669lbd.29 for ; Tue, 25 Feb 2014 11:18:35 -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=YlGJarbF6OhQ2ZsI4p4T+O3dpPwN28N28UzeUu6lV4g=; b=uzXNUoE1zoY9itVhtTxBeiHwLaMHKEO3l97t1/GYj8dcD7qp+otZvsFVnMiqDsp4sb FVz70Gj37zc0Muq9j5wzLl2i/2Ff0q1SbGHObQMkKkU6IO/EY5vxsrxyHhaJra9AT4Wz oZ/Stx43OB4IadFEomfIXQILhmT7QZwHvZAzGjEZ84FlXIUfgiUVEMDTo1IBKrxmnki2 h9cEEbpqw92a+F4m3AAJyfnI/dem/gQiQze/wJVpdmd1OOe8yzCXh09XDWbfjslCAWIZ rYawM04PfUo6Z48+jU2gVKOX0pbm/ZB4XXxcWEMxsn5IPZ9wIuyIBQXaB343IsTeRU8S px7w== X-Received: by 10.112.158.230 with SMTP id wx6mr776642lbb.62.1393355915450; Tue, 25 Feb 2014 11:18:35 -0800 (PST) Received: from localhost ([178.150.115.244]) by mx.google.com with ESMTPSA id 10sm1329850lan.5.2014.02.25.11.18.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Feb 2014 11:18:34 -0800 (PST) Sender: Mikolaj Golub Date: Tue, 25 Feb 2014 21:18:31 +0200 From: Mikolaj Golub To: markj@freebsd.org Subject: Re: Improvements to bsd.dtrace.mk Message-ID: <20140225191830.GA4483@gmail.com> References: <20140126162712.GA11086@gmail.com> <20140225013115.GA64934@raichu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140225013115.GA64934@raichu> 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 19:18:38 -0000 On Mon, Feb 24, 2014 at 08:31:15PM -0500, markj@freebsd.org wrote: > On Sun, Jan 26, 2014 at 06:27:13PM +0200, Mikolaj Golub wrote: > > 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. Interesting. Thank you for the link! > > > > > 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. It is rather strange, because when I tried this last version recently it actually stopped work for me :-). Anyway, it still needs many improvements. > > 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. Yes, I came to the same conclusion later. I was also considering a possibility to remove bsd.dtrace.mk at all and just extend bsd.prog.mk and bsd.lib.mk. Futher, it might be better to make users specify DTRACESRCS instead of DTRACEOBJS, or just add *.d files to SRCS, as we do e.g. with *.y files. Did not have much time to experiment yet though. Thanks for the comments. -- Mikolaj Golub