help-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Target Path Stripping Possible?


From: Tom Browder
Subject: Target Path Stripping Possible?
Date: Fri, 5 Jun 2009 08:50:07 -0500

(please disregard the previous msg, subj: "Autto [sic] Targets
Possible", finger fumble)

I have a "master" directory on top of a source tree with a Makefile
that works just like I want it to at the moment.

Due to a situation out of my control, users cd to a working directory
two subdirectories below.  There they currently use a hodgepodge of
awk, bash, tcsh, and Perl scripts to selectively make targets that I
have in my Makefile two directories above.  I'm trying to
create a working solution to eliminate the script kludge and replace
it by a much easier to maintain make system.

I have successfully (so far) managed to "make" things work by
duplicating targets in the user Makefile.  My user Makefile version
looks like this

===> user Makefile

MASTERDIR := ../..

% :
<tab>( cd $(MASTERDIR); $(MAKE) $@ )

<=== end user Makefile

That rule does pass any target to the subordinate Makefile which tries
to process it accordingly.

However, I have the problem that the top Makefile has executable
targets in the user directory and refers to them with the path as part
of the target.  For example:

$(RUNDIR)/tgt : $(RUNDIR)/tgt.o
<tab>g++ $(CXXFLAGS) $< -o $@

I would like to call, from the user directory:

  make tgt

and have the top Makefile translate to the $(RUNDIR)/tgt.

I have tried this rule in the top Makefile:

% : $(RUNDIR)/%

but that doesn't work.

I could write explicit rules in the user Makefile but I'm too lazy.

I could also rewrite and move the top Makefile and its supporting
structure to the working directory, but I don't want the user exposed
to its complexity due to the nature of the source tree.

I believe I can make a Perl script do what I want, but is there any
way to do it with make with the setup I have?

Thanks.

-Tom

Tom Browder
Niceville, Florida
USA




reply via email to

[Prev in Thread] Current Thread [Next in Thread]