make
You should create a Makefile and use make to compile your
code. information about how make works can be obtained from a
number of sources, including:
- A locally developed tutorial
by David Jones.
- Ben Y. Yoshino of the University of Hawai`i,
College of Engineering, Computer Facility also wrote a
very nice tutorial.
- Then, of course, there is always the man page (type man
make at the UNIX prompt).
- Finally, you can find out about all of the gory details
if you want on these info
pages.
To help you out, there is a sample Makefile
you can copy and modify. The Makefile includes the following
lines:
- CC=
gcc
CFLAGS= -g -ansi
-Wall
LDFLAGS= -g
LINKER= gcc
- The CC line indicates that the Gnu C
compiler, called gcc, should be used. If
you instead would want to use Sun's C compiler, which is
called cc, then you would have to change gcc
to cc.
- The CFLAGS line has three flags that are passed
to the compiler:
- -g indicates that debugging information
should be included with the compiled code so that
you can use the debugger with it.
- -ansi indicates that all ANSI
C-compatible programs compile properly
- -Wall indicates that you want to see all
warning messages.
- The LDFLAGS line indicates to the linker that
debugging information should be included.
- The LINKER line indicates that gcc should be
used to link together the program.
If you intend to use cc as the compiler, then
you must change the above Makefile lines to:
- CC=
cc
CFLAGS= -g
LDFLAGS= -g
LINKER= cc