I want to write a pattern rule in Gnu make that will make e.g. file foo/XXX/XXX.o depend on file bar/XXX.c. That is, it "expands" to

foo/abc/abc.o: bar/abc.c

foo/def/def.o: bar/def.c

foo/ghi/ghi.o: ghi/ghi.c

After studying the documentation, I've come to the belief that the string and filename manipulation facilities in Gnu make do not make this possible because it is impossible to remove one variable part from a string when there are other variable parts in the string.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.