Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Realize makefile

Reply
Thread Tools

Realize makefile

 
 
wanglei wang
Guest
Posts: n/a
 
      10-26-2011
Such as: make file.c file to generate the executable file, make
file2.c generate executable file file2.
make a different file name on the back of the input to generate a
different executable file
 
Reply With Quote
 
 
 
 
Mark Bluemel
Guest
Posts: n/a
 
      10-26-2011
On 10/26/2011 01:59 AM, wanglei wang wrote:
> Such as: make file.c file to generate the executable file, make
> file2.c generate executable file file2.
> make a different file name on the back of the input to generate a
> different executable file


Smells like teen spirit^W^Wcoursework....
 
Reply With Quote
 
 
 
 
Nick Keighley
Guest
Posts: n/a
 
      10-26-2011
On Oct 26, 1:59*am, wanglei wang <(E-Mail Removed)> wrote:

> Such as: make file.c file to generate the executable file, make
> file2.c generate executable file file2.
> *make a different file name on the back of the input to generate a
> different executable file


I *think* you're trying to ask how to wite a makefile. This is not on-
topic to comp.lang.c. A unix programming group (even if you are using
make on something else) might suit you better.

For a makefile as simple as the one, I think, you want I'd have
thought any basic introduction to make would be good enough.
 
Reply With Quote
 
James Kuyper
Guest
Posts: n/a
 
      10-27-2011
On 10/26/2011 03:11 PM, Gordon Burditt wrote:
>> Such as: make file.c file to generate the executable file, make
>> file2.c generate executable file file2.
>> make a different file name on the back of the input to generate a
>> different executable file

>
> This isn't really about C.
>
> I find that if you have file.c and say "make file", it works
> fine *without* a Makefile.


Not if 'file.o' needs to be linked with several other object files to
make your executable.
--
James Kuyper
 
Reply With Quote
 
Jorgen Grahn
Guest
Posts: n/a
 
      10-27-2011
On Thu, 2011-10-27, James Kuyper wrote:
> On 10/26/2011 03:11 PM, Gordon Burditt wrote:
>>> Such as: make file.c file to generate the executable file, make
>>> file2.c generate executable file file2.
>>> make a different file name on the back of the input to generate a
>>> different executable file

>>
>> This isn't really about C.
>>
>> I find that if you have file.c and say "make file", it works
>> fine *without* a Makefile.

>
> Not if 'file.o' needs to be linked with several other object files to
> make your executable.


And not if you want a decent set of warnings and standards compliance
flags passed to your compiler.

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
 
Reply With Quote
 
James Kuyper
Guest
Posts: n/a
 
      10-27-2011
On 10/27/2011 04:35 PM, Jorgen Grahn wrote:
> On Thu, 2011-10-27, James Kuyper wrote:
>> On 10/26/2011 03:11 PM, Gordon Burditt wrote:

....
>>> I find that if you have file.c and say "make file", it works
>>> fine *without* a Makefile.

>>
>> Not if 'file.o' needs to be linked with several other object files to
>> make your executable.

>
> And not if you want a decent set of warnings and standards compliance
> flags passed to your compiler.


A POSIX-conforming make provided with no make file is supposed to behave
as if it were using a make file which contained the following lines
(among many others):

LDFLAGS=
CC=c99
CFLAGS=-O
..c:
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<


The default values of CC, CFLAGS, and LDFLAGS can be overridden either
by setting the corresponding environment variables, or overriding them
explicitly from the command line. Therefore, you can customize the
behavior of make without having to create a make file. CFLAGS is the
appropriate place for the compiler flags you were talking about.

Real-world make utilities are not necessarily POSIX-conforming, or if
they are, they might not be conforming in their default mode. However,
any make that's sufficiently close to standard-conforming will tell you
what it's non-standard default rules are if you type:

make -p -f /dev/null

Even when using a non-conforming make, you're likely to find it behaving
as if it were using the above rules, if all you fiddle with are the
values of CC, CFLAGS, and LDFLAGS.

Any big project built with make has to use a make file; but if you know
what the default rules are, that make file can be pretty small, and for
small projects it can often be dispensed with entirely.
 
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
To A.Friend (online criminals, they don't realize anything) oj Computer Support 1 10-20-2005 04:43 PM
how to realize WDS?? sjdy Wireless Networking 1 04-04-2005 05:05 AM
How to realize the communication of applet and ejb? 王崟 Java 0 08-23-2004 05:42 AM
Switching items between listboxes, and letting .net realize it. Ryan Ternier ASP .Net 1 07-25-2004 05:18 PM
How to realize user interfereing like CS program? Lei Guangfu ASP .Net 1 10-19-2003 06:31 AM



Advertisments