| Author |
make: making the binary name dependent on the source file name.
|
|
| Ido Yehieli 2008-01-03, 7:32 am |
| Hi,
I have several source files in a directory (which are different
versions of the same program), and I want gnu make to compile each of
them and name the resulting binaries according to the source name.
for example, if i write:
====Begin Makefile====
somefile: somefile.*.o
cc $? -o $@
====end of Makefile====
it will compile all my files but will of course only produce one
binary(somefile). I want it to produce a binary named somefile.* for
every somefile.*.c source file i have.
-Ido.
| |
| Ralf Fassel 2008-01-03, 1:23 pm |
| * Ido Yehieli <Ido.Yehieli@gmail.com>
| I have several source files in a directory (which are different
| versions of the same program), and I want gnu make to compile each of
| them and name the resulting binaries according to the source name.
% cat Makefile
all: somefile.*
% gmake all
HTH
R'
| |
| Ido Yehieli 2008-01-03, 1:23 pm |
| On Jan 3, 3:32 pm, Ralf Fassel <ralf...@gmx.de> wrote:
> * Ido Yehieli <Ido.Yehi...@gmail.com>
> | I have several source files in a directory (which are different
> | versions of the same program), and I want gnu make to compile each of
> | them and name the resulting binaries according to the source name.
>
> % cat Makefile
> all: somefile.*
> % gmake all
>
> HTH
> R'
make: Nothing to be done for `all'.
-ido
| |
| Ralf Fassel 2008-01-03, 7:23 pm |
| * Ido Yehieli <Ido.Yehieli@gmail.com>
| make: Nothing to be done for `all'.
Yup. You need to have the executables already present for that recipe
to work :-/
Replace the recipe with
all: $(basename $(wildcard somefile.*.c))
This collects all somefile.*.c files, strips off the suffix and tries
to build the resulting targets (for .c, the corresponding rule is
built-in).
HTH
R'
|
|
|
|