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

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

gmake: implicit rule help


From: Ernest
Subject: gmake: implicit rule help
Date: Tue, 22 Mar 2005 12:23:58 -0600
User-agent: Xnews/5.04.25

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

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

OBJ_SUFF is either .o or .obj depending on the platform (Unix vs. Windows).

The C/C++ source types are many: .c, .cc, .C, and .cpp.  Simply using all 
of them on the right side of the colon (%.c %.cc etc.) doesn't work, nor 
did I expect it to.

If it weren't for the desire to put the objects in a separate output dir, I 
could at least use the old style syntax:

.c${OBJ_SUFF} .cc${OBJ_SUFF} <etc>  :
        cmd1
        cmd2
        ...

But the implicit rule syntax is supposed to be able to do away with suffix 
transforms, yet the need to share commands with multiple transformation 
possibilities doesn't seem to exist with the new syntax.  Or does it?

Thanks for any tips,
Ernest


reply via email to

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