From owner-freebsd-questions@FreeBSD.ORG Wed Mar 12 18:23:41 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B4F951065679 for ; Wed, 12 Mar 2008 18:23:41 +0000 (UTC) (envelope-from bahamasfranks@gmail.com) Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.171]) by mx1.freebsd.org (Postfix) with ESMTP id 8BBF28FC15 for ; Wed, 12 Mar 2008 18:23:41 +0000 (UTC) (envelope-from bahamasfranks@gmail.com) Received: by wf-out-1314.google.com with SMTP id 25so3004875wfa.7 for ; Wed, 12 Mar 2008 11:23:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; bh=bPAXIJ8eC4DHJ0GvTJSTqH71eXP1/KnZHqRMn+D3oLk=; b=XdFtewkAOO6tnv0CFVOj4rlihwwxGyVUfPbhnLUALb86rYOEkUXiQmH0ryQDtevwfHi+Aake6DaHu3DhcQ8Ee1R23PVfsGmonjBVoKyhrDWkRhM4woxcUEwA2p/79x3cnrujpBYusoqSEcAKGCfkITLqsy83nTLJBccDNmVijUI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=ptfmN0tUqV9eB3zb9lL0xnjAsL6Btk6IR2QyzMdoRhr23GSgrBHt/ZcMCB46qmx5Htyeg3qVhSaNudOFFDkPyVUWJ29fHDcK9qQSekxUq91e0YwO5h9JIRd9Nlspg/v/OQct0/dcMZjh+R2qA1ax8/txMQTvCTv3hL4TuvscWbo= Received: by 10.142.101.17 with SMTP id y17mr3773379wfb.20.1205346220946; Wed, 12 Mar 2008 11:23:40 -0700 (PDT) Received: by 10.142.237.12 with HTTP; Wed, 12 Mar 2008 11:23:40 -0700 (PDT) Message-ID: <539c60b90803121123p1c4e670bx4a7b5348413f8634@mail.gmail.com> Date: Wed, 12 Mar 2008 11:23:40 -0700 From: "Steve Franks" Sender: bahamasfranks@gmail.com To: Mel In-Reply-To: <200803120146.14003.fbsd.questions@rachie.is-a-geek.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <539c60b90803111715g5fbbdd0cg4ce817ef72a8161d@mail.gmail.com> <200803120146.14003.fbsd.questions@rachie.is-a-geek.net> X-Google-Sender-Auth: 388b730c94f094c9 Cc: freebsd-questions@freebsd.org Subject: Re: OT: how to get make to run a script before each build X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: stevefranks@ieee.org List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Mar 2008 18:23:42 -0000 On Tue, Mar 11, 2008 at 5:46 PM, Mel wrote: > > On Wednesday 12 March 2008 01:15:52 Steve Franks wrote: > > I'd like to keep track of how many times I've run make for a given > > source. I'm sure someone knows how to get make to run a script before > > doing anything else, but using the regular build rules (aka. only if a > > source file has changed). Of course typing any permutation of this > > question into google gives me 10^life of universe in microseconds > > hits. > > mysource.c.o: > count=`cat /var/db/makecounter.${.IMPSRC}` > count=$$(($$count+1)) > echo $$count >/var/db/makecounter.${.IMPSRC} > ${CC} ${CFLAGS} -c ${.IMPSRC} > > or something to that effect, key being, change/override the compilation rule > for your specific or all files. > Default single/double suffix rules are in /usr/share/mk/sys.mk. > -- > Mel > > Problem with today's modular software: they start with the modules > and never get to the software part. > Ah! Sorry, I was asking for the make rule, not the script. Which is to say, what am I doing wrong here: %.elf: $(TARGET)BuildNum $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM) $(LIBS) ... #increment build number $(TARGET)BuildNum: %$(TARGET)BuildNum : *.h *.hpp *.c *.cpp btracer $(TARGET) gives: gmake: *** No rule to make target `*.h', needed by `MainBuildNum'. Stop. Thanks, Steve