Make file duplicate output?

Hi. I was wondering, I have a make file which I use to compile my c++ project in ubuntu linux and every time I compile I have to copy and paste the binary to several locations in my file system for testing.

So is there a way to tell the make file to produce the same binary several times in different directories?

regards, aatwo.
Yes, just use cp command to instruct make to copy resulting binary to different location.
Well I know about the cp command but how would I automate it?

I am essentially looking for a way to automate the copying of my binary file so I don't have to do it my self.

I thought that perhaps there would be a way to specify in the make file that I want to output the binary to multiple locations.
Then include it in the recipe
1
2
3
4
5
6
7
copies={another,yet_another,one_more}.bin
program.bin: $(objects)
    #compilation
    for i in $(copies); do ln -f program.bin $$i; done #note that they are hard links

clean:
  rm $(copies)


I have to copy and paste the binary to several locations in my file system for testing.
That doesn't sound right.
If Mohammed will not go to the mountain...
Hi. I was wondering, I have a make file which I use to compile my c++ project in ubuntu linux and every time I compile I have to copy and paste the binary to several locations in my file system for testing.


Have you considered, instead of copying it to several locations, putting a link in each of those location to wherever you have the actual built executable?

You can do it as follows:

Change directory to wherever you current have a copy, rm that copy, and softlink to the compiled one.
ln -s /yourBuildDirectory/mayebSomeSubPath/nameOfExecutable ./
Topic archived. No new replies allowed.