compile
module load Compilers/Intel/12
source code:
main.c
to make executable file main
gcc -o main mail.c
source codes
main.c routine1.c routine2.c
with header file
head.h
gcc -c main.c
gcc -c routine1.c
gcc -c routine2.c
gcc -o main main.o routine1.o routine2.o
Makefile
**************************************************************************
CC = gcc # icc
CLINKER = gcc # icc
#CFLAGS = -Wall -O3 -march=pentium
#CFLAGS = -i-fast -lm
LIBS = -lm
DEPEND = makedepend
SRC = main.c routine1.c routine2.c
OBJS = main.o routine1.o routine2.o
EXECS = main
default: main
all: $(EXECS)
main:$(OBJS)
$(CLINKER) $(OPTFLAGS) -o main $(OBJS) $(LIBS)
clean:
/bin/rm -f *.o *~ $(EXECS)
.c.o:
$(CC) $(CFLAGS) -c $*.c
main.o: head.h
routine1.o: head.h
routine2.o: head.h
****************************************************************************