List Info

Thread: OT: how to get make to run a script before each build




OT: how to get make to run a script before each build
user name
2008-03-11 19:15:52
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.

Thanks,
Steve
_______________________________________________
freebsd-questionsfreebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-que
stions
To unsubscribe, send any mail to
"freebsd-questions-unsubscribefreebsd.org"

Re: OT: how to get make to run a script before each build
country flaguser name
United States
2008-03-11 19:46:13
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}
	$ $ -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.
_______________________________________________
freebsd-questionsfreebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-que
stions
To unsubscribe, send any mail to
"freebsd-questions-unsubscribefreebsd.org"

Re: OT: how to get make to run a script before each build
user name
2008-03-12 13:23:40
On Tue, Mar 11, 2008 at 5:46 PM, Mel
<fbsd.questionsrachie.is-a-geek.net> 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}
>         $ $ -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
_______________________________________________
freebsd-questionsfreebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-que
stions
To unsubscribe, send any mail to
"freebsd-questions-unsubscribefreebsd.org"

Re: OT: how to get make to run a script before each build
country flaguser name
United States
2008-03-12 14:04:57
On Wednesday 12 March 2008 19:23:40 Steve Franks wrote:
> On Tue, Mar 11, 2008 at 5:46 PM, Mel
>
> <fbsd.questionsrachie.is-a-geek.net> 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}
> >         $ $ -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.

Sorry, gmake not my cup of tea, but looks like *.h isn't
expanded.

-- 
Mel

Problem with today's modular software: they start with the
modules
    and never get to the software part.
_______________________________________________
freebsd-questionsfreebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-que
stions
To unsubscribe, send any mail to
"freebsd-questions-unsubscribefreebsd.org"

[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )