CSPATH = ./src BINPATH = ./bin LIBPATH = ./lib # the source files sources = graph.cc gsemaphore.cc main.cc # objects are the same as the source files with .cpp replaced with .o objects = graph.o gsemaphore.o main.o headers = graph.h gsemaphore.h AR = ar ARFLAGS = rvs CC = gcc CLINKER = gcc CXX = g++ CXXFLAGS = -O CCFLAGS = -O LIB_DIRS = LIBS = -lm -lpthread #-lefence default: all # make all will run commands regardless of whether there is a file "all" all: graph graph: $(objects) $(headers) $(CXX) $(OPTFLAGS) -o graph $(objects) $(LIB_DIRS) $(LIBS) # make clean will run commands regardless of whether there is a file "clean" clean: rm -rf *.o rm -f graph lib/%.o : %.c $(CC) $(CCFLAGS) $(CFLAGS) -c $< $(OUTPUT_OPTION) lib/%.o : %.cc $(CXX) $(CXXFLAGS) $(INCLUDE_DIRS) -c $< -o $@