%% Sebastien Seulin <[EMAIL PROTECTED]> writes: ss> I would like to write a generic rule like this ss> %.o : %.c $(shell mypg %.c) ss> $(CC) $(XFLAGS) $(LDFLAGS) -o $@ $< ss> where mypg is a program that list all dependencies of a source file. ss> It doesn't work as %.c is not understood in $(shell mypg %.c)
It doesn't work because targets and prerequisite lines are expanded (including both variables and functions) immediately as the makefile is read in, but implicit rule patterns like %.c aren't expanded until make is running and matches the implicit rule. So, that shell function is being expanded with the static argument "mypg %.c", not the expansion of %.c. See the GNU make manual section 'How 'make' Reads a Makefile'. If you're trying to handle dependency tracking, see my web site below for a good way to do it. -- ------------------------------------------------------------------------------- Paul D. Smith <[EMAIL PROTECTED]> Find some GNU make tips at: http://www.gnu.org http://www.paulandlesley.org/gmake/ "Please remain calm...I may be mad, but I am a professional." --Mad Scientist _______________________________________________ Help-make mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/help-make
