%% Ernest <[EMAIL PROTECTED]> writes:

  e> One of the custom rules I'm writing involves the .c -> .o kind of
  e> transformation, but the command script (semi-complex,
  e> multi-platform, etc.)  needs to be the same for all source suffix
  e> types.  How do I write the equivalent of this...

  e> ${WORKDIR}/%${OBJ_SUFF} : <all possible C/C++ source types>
  e>            cmd1
  e>            cmd2
  e>            ...

The only way to do it is by writing the rule multiple times, once for
each prerequisite.  You can make this slightly more palatable by using a
define variable:

    define BUILDOBJ
        cmd1
        cmd2
        ...
    endef

    ${WORKDIR}/%${OBJ_SUFF} : %.c
            $(BUILDOBJ)
    ${WORKDIR}/%${OBJ_SUFF} : %.cc
            $(BUILDOBJ)
    ${WORKDIR}/%${OBJ_SUFF} : %.cpp
            $(BUILDOBJ)
    ${WORKDIR}/%${OBJ_SUFF} : %.C
            $(BUILDOBJ)

If you REALLY don't want to do that and you are willing to restrict
yourself to GNU make 3.80 or better, you can use eval to do it.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[EMAIL PROTECTED]>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
_______________________________________________
help-gnu-utils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gnu-utils

Reply via email to