CSPATH = ./src BINPATH = ./bin LIBPATH = ./lib # the source files sources = bridge.cc main.cc # objects are the same as the source files with .cpp replaced with .o objects = bridge.o main.o headers = bridge.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: bridge bridge: $(objects) $(headers) $(CXX) $(OPTFLAGS) -o bridge $(objects) $(LIB_DIRS) $(LIBS) # make clean will run commands regardless of whether there is a file "clean" clean: rm -rf *.o rm -f bridge lib/%.o : %.c $(CC) $(CCFLAGS) $(CFLAGS) -c $< $(OUTPUT_OPTION) lib/%.o : %.cc $(CXX) $(CXXFLAGS) $(INCLUDE_DIRS) -c $< -o $@