# Folders
SRCDIR := ..
BUILDDIR := .
TARGETDIR := .

CC := clang++ -arch x86_64

# Targets
EXECUTABLE := PageNormalizer
TARGET := ./$(EXECUTABLE)

# Code Lists
SRCEXT := cpp
SOURCES := $(shell find $(SRCDIR) -type f -name *.$(SRCEXT))
OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.o))

# Shared Compiler Flags
CFLAGS := -c -Dcimg_display=0
INC := -I..
LIB := -lm -ljpeg

INCDIRS := 
INCLIST := 
BUILDLIST := 

CFLAGS += -std=c++11 -stdlib=libc++ -O2

$(TARGET): $(OBJECTS)
	@echo "Linking..."
	@echo "  Linking $(TARGET)"; $(CC) $^ -o $(TARGET) $(LIB)

$(BUILDDIR)/%.o: $(SRCDIR)/%.$(SRCEXT)
	@echo "Compiling $<..."; $(CC) $(CFLAGS) $(INC) -c -o $@ $<

