compiling multiple source files

B

broli

How can this be done in windows based C compilers like PellesC ?? Is
it possible to write a makefile or use the cc- o option as available
in unix/linux ?? does anyone know of good makefile tutorials ??


(I appologize if this is offtopic but I couldn't think of a better
place to ask this question)
 
R

Richard Heathfield

broli said:
How can this be done in windows based C compilers like PellesC ??

I couldn't find any online documentation for Pelles C, so I don't know. But
my guess would be:

(a) compile each file separately, possibly using a flag such as -c to tell
the compiler not to try to produce a final executable image;
(b) use a separate linker program to link all the object files together.
Is it possible to write a makefile

Yes, makefiles aren't compiler-dependent. A make program simply checks
dependencies and selectively executes commands. The commands you execute
can be calls to any compiler you like.
or use the cc- o option as available in unix/linux ??

Generally, yes, -o (for naming the output file) and -c (for saying "just
compile this, okay? Don't try to link it") are typically supported by
Windows (and DOS!) compilers - but this isn't mandatory, and some might
not.
does anyone know of good makefile tutorials ??

The problem here is that the language syntax of the makefile depends on the
make utility. I'm not aware of any ISO Standard governing makefiles, alas.
If I were you, I would start out by finding out which make utilities are
available for your platform, and then checking their documentation to see
which is easiest to understand before making your decision.
 
B

Bill Reid

How can this be done in windows based C compilers like PellesC ??

I know I can do it by selecting "Add To Project" from my integrated
development package "Project" menu, and specifying all the source
files, object files, and libraries that I want to comprise my target
executable.

Of course, it's not really documented or obvious what a "project"
is, because to the guys who developed my integrated development
environment a "project" may be a library, DLL, object file, a "component",
a "package", or about three or four other things, or maybe, just
maybe, an executable...but if your "target" is an executable,
adding all the source, object, and library files makes it work
pretty much like a makefile, without all the typing (just a lot
of mouse work!).

In other words, I don't know about YOUR development package,
but I suspect you have a "make" utility somewhere...for me, I can
import or export makefiles to/from the integrated development
environment, or just use a makefile as is, because the whole
software package includes "make" and a command-line
compiler/linker.
Is
it possible to write a makefile or use the cc- o option as available
in unix/linux ??

Dunno. See above.
does anyone know of good makefile tutorials ??

Hell, if people can't be bothered to properly document their
proprietary idiotic integrated development environments so
people can actually use them, what are the chances that anybody
ever bothered to explain "make" properly? Everything I ever knew
about "make" came from a Unix man page, so make of that
what you will...
(I appologize if this is offtopic but I couldn't think of a better
place to ask this question)

I wonder if there actually is a group dedicated to "make"...and
if anybody actually posts to it...but if they don't, it's still YOUR
fault for asking about it here!
 
J

jacob navia

broli said:
How can this be done in windows based C compilers like PellesC ?? Is
it possible to write a makefile or use the cc- o option as available
in unix/linux ?? does anyone know of good makefile tutorials ??


(I appologize if this is offtopic but I couldn't think of a better
place to ask this question)

Go to the "HELP" tab in the IDE
Then select it by left clicking on it
Then open the documentation about "IDE"
Then choose "Projects"

THEN: Read the docs.

If you want to use "make" without the IDE,
you should read the documentation for
"Command line tools"
then
POMAKE documentation.
 
S

santosh

Richard said:
broli said:


I couldn't find any online documentation for Pelles C, so I don't
know. But my guess would be:

(a) compile each file separately, possibly using a flag such as -c to
tell the compiler not to try to produce a final executable image;
(b) use a separate linker program to link all the object files
together.


Yes, makefiles aren't compiler-dependent. A make program simply checks
dependencies and selectively executes commands. The commands you
execute can be calls to any compiler you like.


Generally, yes, -o (for naming the output file) and -c (for saying
"just compile this, okay? Don't try to link it") are typically
supported by Windows (and DOS!) compilers - but this isn't mandatory,
and some might not.


The problem here is that the language syntax of the makefile depends
on the make utility. I'm not aware of any ISO Standard governing
makefiles, alas. If I were you, I would start out by finding out which
make utilities are available for your platform, and then checking
their documentation to see which is easiest to understand before
making your decision.

Make is covered by the POSIX standards, so the OP might well post to
comp.unix.programmer. But for a tutorial to make he should consider GNU
make's tutorial. It's pretty good to learn the basic usage.

<http://www.gnu.org/software/make/manual/make.html>
<http://www.hsrl.rutgers.edu/ug/make_help.html>
<http://www.cs.umd.edu/class/spring2002/cmsc214/Tutorial/makefile.html>
<http://www.opussoftware.com/tutorial/TutMakefile.htm>
 
D

David Thompson

#if offtopic == toolchain
broli said:

Yes, makefiles aren't compiler-dependent. A make program simply checks
dependencies and selectively executes commands. The commands you execute
can be calls to any compiler you like.
The idea and format of makefiles is not compiler-dependent, but the
contents of actual makefiles are. The actions you want executed may
differ, especially as to options, and there are even cases where the
dependencies are different. (When Fortran 90 added modules,
implementors made the reasonably obvious choice to put predigested
interface information in files for later reference, but they made
different reasonable choices as to which things to put in which files.
Users got annoyed enough there is now a de-facto standard.)

There are also _system_ differences which are not strictly compiler
differences, for example whether to 'tsort' libraries.

- formerly david.thompson1 || achar(64) || worldnet.att.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top