Professional Web Applications Themes

Makefile for multi-platform - UNIX Programming

Recently we ported our application to Linux from Solaris. I want to just use the same Makefile, which can query the platform whether Linux or Solaris from “uname” and use appropriate compiler and link the appropriate libraries. How can I do that. I don’t know if Solaris supports conditional statements with "ifeq" in its Makefile, seemed like it did not support. What is the best way to have a single makefile for multi-platform like linux, solaris....

  1. #1

    Default Makefile for multi-platform

    Recently we ported our application to Linux from Solaris. I want to
    just use the same Makefile, which can query the platform whether Linux
    or Solaris from “uname” and use appropriate compiler and
    link the appropriate libraries. How can I do that. I don’t know
    if Solaris supports conditional statements with "ifeq" in its
    Makefile, seemed like it did not support. What is the best way to have
    a single makefile for multi-platform like linux, solaris.
    anita Guest

  2. #2

    Default Re: Makefile for multi-platform

    On Mon, 1 Mar 2004, anita wrote:
     

    Those sorts of things are GNU extentions, so they're not supported
    by the version of make that ships with Solaris.
     

    One way would be to put the platform dependent stuff into variables,
    and comment out the ones that don't apply. Or have a build script
    that calls make with the appropriate variables set.

    --
    Rich Teer, SCNA, SCSA

    President,
    Rite Online Inc.

    Voice: +1 (250) 979-1638
    URL: http://www.rite-online.net
    Rich Guest

  3. #3

    Default Re: Makefile for multi-platform

    anita wrote: 

    We have a simple include file which sets macros for compiler and
    linker commands, flags and library names. If an program needs nsl
    on some platform(s), we add $(NSL) to the makefile link lines for the
    programs which need it and set NSL=-lnsl in that platform's include
    file. We compile several dozen programs on about a dozen Unix/Linux
    versions from a single makefile. Works just fine with generic make.

    --
    Clem
    "If you push something hard enough, it will fall over."
    - Fudd's first law of opposition
    Mr. Guest

  4. #4

    Default Re: Makefile for multi-platform


    com (anita) writes:
     

    Simplify your life. Use GNU make everywhere.

    -SEan
    Sean Guest

  5. #5

    Default Re: Makefile for multi-platform

    On Tue, 2 Mar 2004, Sean Burke wrote:
     

    I respectfully disagree. I think as far as posible, one should
    use the tools that are native to a platform, an din this case,
    that means using the native make (which happens to be gmake on
    Linux and make on Solaris).

    If that means that one's Makefiles have to use a lowest common
    denominator of features, so be it.

    --
    Rich Teer, SCNA, SCSA

    President,
    Rite Online Inc.

    Voice: +1 (250) 979-1638
    URL: http://www.rite-online.net
    Rich Guest

Similar Threads

  1. fonts from platform to platform problem
    By betsy wallace webforumsuser@macromedia.com in forum Macromedia Director Basics
    Replies: 1
    Last Post: November 18th, 05:31 PM
  2. platform specific module and CPANPLUS / Makefile.PL
    By Thomas Dorner in forum PERL Modules
    Replies: 2
    Last Post: September 18th, 05:10 PM
  3. multi-platform, and on Win no configure
    By why the lucky stiff in forum Ruby
    Replies: 0
    Last Post: July 14th, 08:48 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