Makefile 1.28 KB
all: test

LIBS := -lpthread -lrt

EXECUTABLES := test

SRCS += \
src/Consumer.cpp \
src/DataBlock.cpp \
src/MemoryManager.cpp \
src/Producer.cpp \
src/Synchronizer.cpp \
src/shm.cpp \
src/wrflock_init.cpp \
src/wrflock_destroy.cpp \
src/wrflock_acquire.cpp \
src/wrflock_release.cpp \
src/wrflock_wait.cpp \
test.cpp

OBJS += \
build/Consumer.o \
build/DataBlock.o \
build/MemoryManager.o \
build/Producer.o \
build/Synchronizer.o \
build/shm.o \
build/wrflock_init.o \
build/wrflock_destroy.o \
build/wrflock_acquire.o \
build/wrflock_release.o \
build/wrflock_wait.o \
build/test.o

DEPS += \
build/Consumer.d \
build/DataBlock.d \
build/MemoryManager.d \
build/Producer.d \
build/Synchronizer.d \
build/shm.d \
build/wrflock_init.d \
build/wrflock_destroy.d \
build/wrflock_acquire.d \
build/wrflock_release.d \
build/wrflock_wait.d \
build/test.d

-include $(DEPS)

test: $(OBJS)
	g++ -std=c++11 -o $@ $(OBJS) $(LIBS)

build/%.o: src/%.cpp
	@mkdir -p build
	g++ -std=c++11 -DNDEBUG -O3 -Isrc -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"

build/%.o: %.cpp
	@mkdir -p build
	g++ -std=c++11 -DNDEBUG -O3 -Isrc -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
clean:
	-rm $(EXECUTABLES) $(OBJS) $(DEPS) 
	-rmdir build

.PHONY: all clean dependents