Professional Web Applications Themes

Makefiles compatible with both BSD and GNU make? - FreeBSD

I got the silly idea that I want one Makefile to work with both BSD and GNU makes. Silly me. Fairly simple Makefiles work but when expanding my Makefile to include .depend generation I get tripped. BSD make automagically uses .depend if one is found. GNU make requires the file be named in an include, but the syntax of GNU include is different than BSD. As is the syntax of conditional statements. Yes, I could simply use gmake on FreeBSD and make under cygwin, but where is the fun in that? Not only no fun but nothing to be learned. ...

  1. #1

    Default Makefiles compatible with both BSD and GNU make?

    I got the silly idea that I want one Makefile to work with both BSD and
    GNU makes. Silly me. Fairly simple Makefiles work but when expanding my
    Makefile to include .depend generation I get tripped.

    BSD make automagically uses .depend if one is found. GNU make requires
    the file be named in an include, but the syntax of GNU include is
    different than BSD. As is the syntax of conditional statements.

    Yes, I could simply use gmake on FreeBSD and make under cygwin, but
    where is the fun in that? Not only no fun but nothing to be learned.

    Is there a way I can write the include of .depend that GNU make will use
    and at the same time BSD make will either ignore or do the same as GNU?

    Meanwhile I'm just accepting the fact on cygwin the only sure way to
    update is "make clean" before "make".

    --
    David Kelly N4HHE, net
    ================================================== ======================
    Whom computers would destroy, they must first drive mad.
    David Guest

  2. #2

    Default Re: Makefiles compatible with both BSD and GNU make?

    In the last episode (Mar 16), David Kelly said: 

    FreeBSD's make understands the gnu-style include syntax with no leading
    dot, even though it's undoented (grep for SYSVINCLUDE in the
    source). Automake is the usual way around compatibility issues; it has
    its own conditional syntax that it expands out when it generates the
    Makefile, and will create the appropriate dependency lines.

    --
    Dan Nelson
    com
    Dan Guest

  3. #3

    Default Re: Makefiles compatible with both BSD and GNU make?

    On Wed, Mar 16, 2005 at 02:50:17PM -0600, Dan Nelson wrote: 

    Sure enough.

    BSD make requires quotes around the filename in .include ".depend" but
    if one removes the leading dot on "include" it can't find .depend if the
    filename is still quoted.

    This works in BSD make altho its not doing anything that isn't
    automatically done:
    ..include ".depend"

    Above is apparently the same as this in GNU make and accepted by BSD:
    include .depend

    This does not work in BSD as it seems to be trying to find ".depend"
    with quotes, which doesn't exist:
    include ".depend"

    --
    David Kelly N4HHE, net
    ================================================== ======================
    Whom computers would destroy, they must first drive mad.
    David Guest

Similar Threads

  1. parsing Makefiles
    By Andrew in forum PERL Beginners
    Replies: 16
    Last Post: February 24th, 05:45 PM
  2. How do u make mac/pc compatible presentations?
    By big vern webforumsuser@macromedia.com in forum Macromedia Flash Sitedesign
    Replies: 10
    Last Post: December 5th, 06:27 PM
  3. streamlining makefiles with rules
    By Shea in forum UNIX Programming
    Replies: 7
    Last Post: November 21st, 08:17 PM
  4. Generic and platform-specific Makefiles
    By Alex in forum UNIX Programming
    Replies: 3
    Last Post: August 23rd, 06:49 AM
  5. How to make brush set compatible with PS6?
    By Lind N in forum Adobe Photoshop 7, CS, CS2 & CS3
    Replies: 1
    Last Post: July 13th, 01:45 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139