More Sample Makefiles
#Ex. 1
CC = g++
TARGET = test
VPATH = h
OBJS = spoint.o
INCLUDES = -Ih
.s.o:
$(CC) -c $< $(INCLUDES)
.c.o:
$(CC) -c $< $(INCLUDES)
all: $(TARGET)
clean:
rm *.o
rm $(TARGET)
$(TARGET): $(OBJS)
$(CC) test.cpp $(OBJS) -o $(TARGET)
#Ex. 2
TIMEROPT = -DGETTIMEOFDAY
CC = cc
LIBS = -lperfex -lm
OBJS = relax
CFLAGS = -O3 -OPT:IEEE_arithmetic=1 -INLINE:never=assign_weights_w,init_matrix
MORECFLAGS =
all: $(OBJS)
timer.o: timer.c
$(CC) -c $(TIMEROPT) $(CFLAGS) timer.c
relax: relax.c timer.o
$(CC) -o relax $(CFLAGS) relax.c timer.o $(LIBS)
relax2: relax2.c timer.o
$(CC) -o relax2 $(CFLAGS) $(MORECFLAGS) relax2.c timer.o $(LIBS)
asm: relax.c
$(CC) -S $(CFLAGS) relax.c
clean:
/bin/rm -f *.o *.s $(OBJS)