Question on Make

utzoo!decvax!harpo!eagle!mhtsa!alice!npoiv!houxm!pgf utzoo!decvax!harpo!eagle!mhtsa!alice!npoiv!houxm!pgf
Thu Apr 21 12:03:59 AEST 1983



	I beg to differ on the subject of .DEFAULT, and make a query of
	my own.

	The comment was made that the set of rules:

		.DEFAULT:
			cp $*.joe $*.sam

		file1.sam: file1.joe

	could be used to create file1.sam from file1.joe.  This is not the
	case.  The .DEFAULT rule is used to create a file which cannot
	be found, and for which no explicit or implicit rule exists.  Thus
	the .DEFAULT rule would be used to create file1.joe if it did not
	exist in the current directory.  The dependency listed above for
	file1.sam and file1.joe simply has a null rule associated with it.
	Make says to itself "I guess I must not have to do anything to get
	file1.sam from file1.joe-- either the user doesn't care or he knows
	more about what he wants than I do."  

	The .DEFAULT rule can be used to force a get(1) from another directory
	if you don't keep your s.source.c files in your working directory.


		source.o: source.c

		.DEFAULT:
			get $(SRCDIR)/s.$<

	The .c.o rule will create source.o after (possibly) the .DEFAULT
	rule is used to create source.c.
	What I can't figure out how to do is similar to that, but I want
	to have the SCCS files (in $(SRCDIR)) be the *only* copy of
	the source around.  What I want to write is:

		source.o: $(SRCDIR)/s.source.c

	but somehow prepending $(SRCDIR) to the dependent causes make to lose
	the .c~.o relationship between them, and it won't use that rule.
	Specifying the rule explicitly for each source file would work, but
	seems silly for 300 source files.

	Any help would be greatly appreciated.
				Paul Fox, BTL Holmdel (201)949-6412
				  (houxm!pgf)



More information about the Comp.unix.wizards mailing list