Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Makefile question

Reply
Thread Tools

Makefile question

 
 
Carson
Guest
Posts: n/a
 
      07-04-2005
Hi,

I have a problem with Makefile.

I have a piece of c code, which is stored in my unix account. I wrote
a Makefile for that particular compilation (using gcc), and it works
fine.

But sometimes, I need to compile the code in windows, therefore I
downloaded mingw32 to compile the code. However, I need to manually
change the variable of CC in my makefile from CC=gcc to CC=ming32-gcc.

Is there any way for the Makefile to detect which OS it is
(win/linux/sunos) so that it will switch the CC accordingly?

Thank you,

Carson

 
Reply With Quote
 
 
 
 
Rouben Rostamian
Guest
Posts: n/a
 
      07-04-2005
In article <(E-Mail Removed) .com>,
Carson <(E-Mail Removed)> wrote:
>
> I have a piece of c code, which is stored in my unix account. I wrote
>a Makefile for that particular compilation (using gcc), and it works
>fine.
>
> But sometimes, I need to compile the code in windows, therefore I
>downloaded mingw32 to compile the code. However, I need to manually
>change the variable of CC in my makefile from CC=gcc to CC=ming32-gcc.
>
> Is there any way for the Makefile to detect which OS it is
>(win/linux/sunos) so that it will switch the CC accordingly?


This is not really a C question. You may get better advice
in comp.unix.programmer and in a Microsoft-related group
for Windows.

<OFF TOPIC>

Here is an off-topic answer to get you going, but consult
those other groups if you need further help.

"make" recognizes the environment variables CC and CFLAGS.
Therefore don't define then within the Makefile; define them
as environment variables.

Alternatively, you may specify them on the command
line, as in "make CC=gcc CFLAGS=-Wall".

With GNU make, the "ifeq" conditional may be of some use.
Look up the manual.

</OFF TOPIC>

--
Rouben Rostamian

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Makefile question. xz C++ 8 01-14-2008 10:00 PM
a question in makefile jut_bit_zx@eyou.com C++ 2 12-19-2006 02:10 PM
Python in Makefile Question Dan Bishop Python 4 02-11-2005 02:41 PM
Question about simple gmake Makefile jose luis fernandez diaz C++ 1 04-29-2004 03:17 PM
Makefile question Matthias Pieroth C++ 3 03-05-2004 04:43 AM



Advertisments