#-----------------------------------------------------------------------------
# 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../final -lfinal
INCLUDES = -I.. -I/usr/include
RM = rm -f

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)

debug:
	$(MAKE) $(MAKEFILE) DEBUG="-g -D DEBUG -Wall -Wextra -Wpedantic"

profile:
	$(MAKE) $(MAKEFILE) PROFILE="-pg"

.PHONY: clean
clean:
	$(RM) $(SRCS:%.cpp=%) *.gcno *.gcda *~

