help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Portability of % match


From: Paul D. Smith
Subject: Re: Portability of % match
Date: Mon, 31 Mar 2003 17:45:08 -0500

%% Bill Moseley <address@hidden> writes:

  bm> I use this style on Linux and Solaris machines.
  bm> target = file.out

  bm> all: $(target)

  bm> %.out: %.in
  bm>         @echo "creating $@ from $<"

  bm> But on FreeBSD 4.8-RC I get:

  bm> make: don't know how to make file.out. Stop

  bm> Is there a more portable way to write that?

Pattern rules are not truly portable: they are not defined in the POSIX
standard for example.

If you want a makefile that's portable between many variants of make you
need to use suffix rules:

  .SUFFIXES: .in .out
  .in.out:
        @echo "creating $@ from $<"


Of course, a better way to go is to just require the use of GNU make:
requiring a portable make is infinitely simpler than writing portable
makefiles.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

[Prev in Thread] Current Thread [Next in Thread]