help-make
[Top][All Lists]
Advanced

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

more matching power than "%" for pattern rules


From: Richard J. Duncan
Subject: more matching power than "%" for pattern rules
Date: Sun, 8 Oct 2000 18:17:45 -0500 (CDT)

Good evening,

I'm trying to make a build system for some of our C++ template classes
that rebuilds each .cc file 8 different times, once for each integral
type (byte, short, long, unsigned long, float, etc). So what ends up
happening is it builds
  
  mmat_00.long.int32.o  <-- mmat_00.cc

and when it compiles it sets a C++ preprocessor macro to be "long,
int32". All the guts work through calling a shell script that uses
sed, for example,

 echo mmat_00.long.int32 | my_script.sh source_name

returns mmat_00.cc, the sourcefile name. TOBJS is the fully expanded
list of object files with the 8 unique type identifiers appended, and
TSRCS is the list of source files (which don't have the type
identifiers).

I have everything working except dependencies. Here is my rule:

$(TOBJS): %.o : <need something here>
        $(ISIP_CPLUS_COMPILER) $(I_FLAGS) $(CPLUS_FLAGS) $(C_FLAGS) -o $*.o 
`echo $* | $(MTEMPLATE_PARSER) source_name` -DISIP_TEMPLATE_TARGET="`echo $* | 
$(MTEMPLATE_PARSER) template_args`"

I'd like for the dependency to be the individual source file. I've
tried these two variations:

$(TOBJS): %.o : `echo % | $(MTEMPLATE_PARSER) source_name`

and

$(TOBJS): %.o : $(shell echo % | $(MTEMPLATE_PARSER) source_name)

The first attempt doesn't even parse, I get an error that it can't
find the dependency "`echo $*...`".

The parses into mmat_00.long.int32.cc for mmat_00.long.int32.o, which
means it seems to circumvent the shell script. Or perhaps it is parsed
into nothing and there is an implicit rule being used to generate the
.cc name? If I remove all dependencies from the list I get no .cc file
listed. Until I find a better solution I am just listing all .cc files
as the dependency, but the obvious downside is that everything gets
recompiled if a single file changes.

So is there any way to get a shell command executed on the dependency
list? Or to do a more powerful search than a single "%" character that
must be exactly the same in two files with no other variations?

I'm running GNU Make version 3.78.1 on Solaris x86 2.7, if that makes
a difference.

Thanks in advance for any help,

-Rick

+-------------------------------------------<address@hidden>-+
| Richard Jennings Duncan                 http://www.isip.msstate.edu |
| Graduate Research Assistant    Institute for Signal and Info. Proc. |
| Mississippi State University                       Computer Science |
+---------------------------------------------------------------------+









reply via email to

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