[PLUG] Case-insensitivity and GNU make

Paul Heinlein heinlein at madboa.com
Thu May 11 21:33:29 UTC 2006


My personal web site contains a few technical articles, the sources 
for which are marked up in DocBook.

The top level directory looks like this:

   CVS/               index.html              sendmail-auth/
   Makefile           index.xml               sendmail-genericstable/
   apache-fp/         ldap-aliases/           soho-bind/
   apache-google/     open-letter-microsoft/  sort-addr/
   dhcp-failover/     openssl/                specs/
   dig/               pine-macosx/            trac-centos/
   exim4-ssl-client/  pine-ssl/               utf8/
   gpg-quickstart/    rcs/

Revision control is provided by CVS -- hence the CVS directory -- but 
I have an article stored in a directory called "rcs"; it contains a 
Makefile and an XML source doc (and current, an HTML target doc):

   CVS/   Makefile   index.html   index.xml

I recently moved my main workstation to an Intel-based Mac mini, so I 
rsync-ed my projects tree from my Linux box to the Mac. I've had 
occasion to build files in the subdirectories of the source tree 
listed above, but until today I hadn't had to run make in the 
top-level directory. Oops:

   [heinlein]$ make
   co  RCS/index.html index.html
   co: RCS/index.html:1: missing 'head' keyword
   co aborted
   make: *** [index.html] Error 1

To make a long story short, GNU make has an implicit rule that looks 
for %,v or RCS/% or RCS/%,v. If it finds one of those, it will try to 
checkout the file before executing the target commands. You can get a 
list of all the implicit rules by asking nicely:

   make -p -f/dev/null 2>&1 | less

The Mac's filesystem is case-insensitive, so it interpreted the 
presence of the "rcs" directory just the same as "RCS" -- so it tried 
to checkout rcs/index.html. Since that's not a real RCS file, it 
failed.

Ugh. Silly Macintosh.

There are a couple solutions:

1. Turn off all explicit rules from the command line:

    make -r

2. In the Makefile redefine the offending rule(s) as no-ops. This
    is the tack I chose:

    # override gnu make's auto-checkout feature. bad mojo here...
    %:: %,v
    %:: RCS/%,v
    %:: RCS/%

    # rest of makefile ...

-- 
Paul Heinlein <> heinlein at madboa.com <> www.madboa.com






More information about the PLUG mailing list