On Sat, 27 Jul 2002, Paul D. Smith wrote: [snip] > You're relying (or rather, the Xmame makefiles are relying) on > non-portable make features.
An ongoing goal of my work with Frotz (http://www.cs.csubak.edu/~dgriffi/proj/frotz/) is to make is as widely and easily portable as possible. This is why I want to be able to support *BSD make and GNU make. > See the GNU make manual section on "Missing Features and > Incompatibilities", specifically this section: > > * In some Unix `make's, implicit rule search (*note Using Implicit > Rules: Implicit Rules.) is apparently done for _all_ targets, not > just those without commands. This means you can do: > > foo.o: > cc -c foo.c > > and Unix `make' will intuit that `foo.o' depends on `foo.c'. > > We feel that such usage is broken. The prerequisite properties of > `make' are well-defined (for GNU `make', at least), and doing such > a thing simply does not fit the model. > > In short, the Xmame makefile is expecting make to perform implicit rule > searches _even if you give it an actual command script_, which is > bizarre and not portable. I see. So in what I eventually copied from someone else's Makefile makes explicit these rules? > Since you gave it a command script, GNU make does not perform implicit > rule searches, so it never finds an implicit rule saying that .o is > built from .c, and thus there is no prerequisites for the .o files > except those that you explicitly provide, and since you don't provide > any the value of $< (and $^, etc.) will be empty. > > d> Sidenote: How about implementing local variables like .ALLSRC, > d> .TARGET, and so on? (see *BSD make(1) manpage). > > I don't have a copy of this manpage. Is it available on the web? See http://man.netbsd.org for manpages for manpages for NetBSD 1.3.3, 1.4.4, 1.5.3, 1.6A, and Redhat 7.0. > d> Someone posted a while ago about pursuading the FreeBSD people to > d> implement $> (a form which is implemented in NetBSD's make(1) but > d> not recommended). > > This is trivial to work around in GNU make; if your makefiles require it > just add a: > > > = ^ > > to your makefile, or in some "portability" makefile you include with the > MAKEFILES environment variable or something. I've found a solution that satisfies both NetBSD's make and GNU make; adding the following to the end of the Makefile: .SUFFIXES: .SUFFIXES: .c .o .h .c.o: $(CC) $(FLAGS) $(CFLAGS) -o $@ -c $< I borrowed the above from Nitfol's Makefile. I'm not sure if I should bother trying to satisfy FreeBSD's make at this point right now. -- David Griffith [EMAIL PROTECTED] _______________________________________________ Help-make mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/help-make
