1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
#-----------------------------------------------------------------------------
# Makefile for FINAL CUT
#-----------------------------------------------------------------------------
# This is where make install will install the executable
BINDIR = /usr/local/bin
# compiler parameter
CXX = g++
SRCS = $(wildcard *.cpp)
OBJS = $(SRCS:%.cpp=%)
CCXFLAGS = $(OPTIMIZE) $(PROFILE) $(DEBUG) -std=c++14
MAKEFILE = -f Makefile.gcc
LDFLAGS = -L../src -lfinal $(TERMCAP) -lcppunit -ldl
INCLUDES = -I. -I.. -I/usr/include
RM = rm -f
TERMCAP := $(shell test -n "$$(ldd {/usr,}/lib64/libncursesw.so.5 2>/dev/null | grep libtinfo)" && echo "-ltinfo" || echo "-lncurses")
ifdef DEBUG
OPTIMIZE = -O0
else
OPTIMIZE = -O3
endif
# $@ = name of the targets
# $^ = all dependency (without double entries)
.cpp:
$(CXX) $^ -o $@ $(CCXFLAGS) $(INCLUDES) $(LDFLAGS)
all: $(OBJS)
unittest:
$(MAKE) $(MAKEFILE) DEBUG="-g -D DEBUG -DUNIT_TEST -Wall -Wextra -Wpedantic"
check: test
test: unittest
$(OBJS) | sed -e "s/ OK/\x1b[32m OK\x1b[0m/g" -e "s/ failed/\x1b[31m failed\x1b[0m/g"
profile:
$(MAKE) $(MAKEFILE) PROFILE="-pg"
.PHONY: clean
clean:
$(RM) $(SRCS:%.cpp=%) *.gcno *.gcda *~
|