[EMAIL PROTECTED] wrote: >> myBinary: myBinary.o $(filter-out $(wildcard myLibrary.so), myLibrary.so) >> g++ --go-go-gadget-linker >> >> With the above rule myBinary depends on myLibrary.so if it doesn't >> already exist. But if the file already exist it doesn't care if it is >> newer than myBinary. > > Perfect! Thanks! I don't claim to understand how that works, but it > does work.
The above uses two functions, filter-out and wildcard. Filter-out is used to remove strings from a variable, eg: $(filter-out hello world, hello big world) would only leave the word "big" left. Wildcard is used to search for files that exist, it is usually used something like this: $(wildcard *.c) The above might return something like "hello.c world.c". When using $(wildcard myLibrary.so) it will return myLibrary.so if the file already exist. If the file doesn't exist it will return an empty string. Using the empty string in filter-out will return the filename, when wildcard returns the filename filter-out will return an empty string. > The problem with dropping the dependency was that if I do a 'make clean' > then a 'make -j 4 all' (all is a target that depends on all the .so > files and all of the binaries), the binary may be linked before the .so > file is created, which is an error. If this is an error you might still get trouble. If you change enough files so that both the binary and the library needs to be rebuilt the binary might still be finished before the library is finished. regards Henrik -- The address in the header is only to prevent spam. My real address is: hc8(at)uthyres.com Examples of addresses which go to spammers: [EMAIL PROTECTED] [EMAIL PROTECTED] _______________________________________________ help-gnu-utils mailing list help-gnu-utils@gnu.org http://lists.gnu.org/mailman/listinfo/help-gnu-utils