llvm-test Makefile question

Hi, I am trying to do something similar to the profiling target in the
llvm-test suite makefiles, but I'm not a gmake expert, so I am stumped
on something:

I did some copy-and-paste of the profile code in
llvm-test/Makefile.programs and got it working within
SingleSource/Benchmarks, where I can say 'make pmf' or 'make profile'
and get a build with profiling results or my own stuff. This works in
any leaf directory I've tried so far.

The problem is that other directories, like the top level, or say
MultiSource/Benchmarks/, neither 'make profile' nor 'make pmf' work.
It simply says this:

% make pmf
make: Nothing to be done for `pmf'.

Am I missing something here - shouldn't I be able to set it up so I
can build the whole suite with my option? I've attached my diff for
Makefile.programs, but I think the problem exists for profile also
without my changes. Maybe I'm just missing a detail about gmake
here...

Thanks for any help,
-mike

Makefile.programs.diff (2.14 KB)

The problem is that other directories, like the top level, or say
MultiSource/Benchmarks/, neither 'make profile' nor 'make pmf' work.
It simply says this:

% make pmf
make: Nothing to be done for `pmf'.

Try adding:

RecursiveTargets += pmf

If that doesn't work, try adding something like this:

ifdef DIRS
pmf ::
         $(VERB) for dir in ${DIRS}; do \
                 if [ ! -f $$dir/Makefile ]; \
                 then \
                         $(MKDIR) $$dir; \
                         cp $(SourceDir)/$$dir/Makefile $$dir/Makefile; \
                 fi; \
                 ($(MAKE) -C $$dir $@ $(MFLAGS)) || exit 1; \
         done
endif

-Chris

Am I missing something here - shouldn't I be able to set it up so I
can build the whole suite with my option? I've attached my diff for
Makefile.programs, but I think the problem exists for profile also
without my changes. Maybe I'm just missing a detail about gmake
here...

Thanks for any help,
-mike
--
Michael McCracken
UCSD CSE PhD Candidate
research: Michael O. McCracken
misc: http://michael-mccracken.net/blog/

-Chris