Comparing 2 files in linux makefile system
Hi all,
I want to copy one file from source folder to destination folder using Makefile in Linux enviornment. I want to make sure it happens only if destination folder doesnt have updated file. Can you guide me how can i compare 2 files in makefile? |
Hi,
Welcome to LQ! And while this certainly could be achieved with make ... why don't you use a tool that's designed for that task, like for example rsync or unison? Cheers, Tink |
Hi Tinkster, Thanks for your reply.
I was seeing the usage of the tools you mentioned. But it doesnt seems applicable to my enviornment. My enviornment already has the makefile system, which we are using to build a binary. In that we require to copy certain configuration file, if there is any updation. So looking for such kind of solution. Can you tell me how we can achieve the same ? |
Quote:
You can use Code:
cmp $(SRC_FILE) $(DST_FILE) 2>/dev/null || cp -f $(SRC_FILE) $(DST_FILE) |
All times are GMT -5. The time now is 11:48 AM. |