[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Portable makefiles - portable shell commands?
From: |
Jonathan Baccash |
Subject: |
Re: Portable makefiles - portable shell commands? |
Date: |
Sun, 3 Apr 2005 17:31:25 -0800 |
On Apr 3, 2005 5:10 AM, address@hidden
<address@hidden> wrote:
> I was wondering how GNU make can best be used to build programs on
> multiple platforms (and on each platform possibly with multiple
> compilers), like on Win32 with MSVC and OpenWatcom, on Linux with g++,
> etc.
>
> All that I'm still really concerned about is the portability of the
> shell commands that are used e.g. for the "clean" targets: I cannot
> simply get make from
> http://prdownloads.sf.net/mingw/mingw32-make-3.80.0-3.exe?download
> *and* write for example rm -f $(shell find . -name "*~") as a
> shell command for the clean target, can I?
You can use environment variable(s) like SHELL to determine if this is
a Unix-like shell, or use a command like uname to figure out what
platform you're using. Based on these findings, you can define a
function like RM := rm -f or RM := del. Then just use $(RM). Or you
can use Cygwin or MKS or some such thing that actually provides
Unix-like commands like rm.
Jon.