ch1_mpi 1 PROGRAM = mpi.a
ch1_mpi 2
ch1_mpi 3 BUILD=obj
ch1_mpi 4 DIST=bin
ch1_mpi 5
ch1_mpi 6 CXX = gcc
ch1_mpi 7 OBJECTS = $(addprefix $(BUILD)/, $(patsubst %.c,%.o,$(wildcard *.c)))
ch1_mpi 8 FLAGS = -g -Wall
ch1_mpi 9 INCLUDE = -I include
ch1_mpi 10
ch1_mpi 11 .SUFFIXES: .o .c
ch1_mpi 12
ch1_mpi 13 $(BUILD)/%.o:
ch1_mpi 14 $(CXX) $(FLAGS) $(INCLUDE) -c $*.c -o $@
ch1_mpi 15
ch1_mpi 16 all: $(PROGRAM)
ch1_mpi 17
ch1_mpi 18 $(PROGRAM): $(OBJECTS)
ch1_mpi 19 ar rcs $(DIST)/$(PROGRAM) $(OBJECTS)
ch1_mpi 20 #ld -o $(DIST)/$(PROGRAM).o $(OBJECTS) -lc
ch1_mpi 21
ch1_mpi 22 clean :
ch1_mpi 23 rm -rf nul core *flymake* $(BUILD)/*.o $(DIST)/$(PROGRAM) *~ bin/*
ch1_mpi 24
ch1_mpi 25 check-syntax:
ch1_mpi 26 $(CXX) -c $(FLAGS) $(INCLUDE) -o nul -Wall -S $(CHK_SOURCES)