CC = /usr/bin/g++
CFLAGS = -c -Wall -ansi
DLL = libhelloLibrary
SUFFIX = d

ifeq (debug,$(CONFIG))
    CFLAGS += -O2 -DNDEBUG
    SUFFIX = d
else
    CFLAGS += -g -D_DEBUG
    SUFFIX = 
endif

INCPATH = -I../../include
SRCDIR = ../../src/helloLibrary
BINDIR = ../../bin
INC := $(wildcard *.h) $(wildcard *.inl)
INC := $(notdir $(INC))
SRC := $(wildcard $(SRCDIR)/*.cpp)
SRC := $(notdir $(SRC))
OBJDIR := $(CONFIG)
OBJ := $(SRC:%.cpp=$(OBJDIR)/%.o)

all : $(DLL)

$(OBJDIR)/%.o : $(SRCDIR)/%.cpp
	$(CC) -o $@ $(INCPATH) $(CFLAGS) $< 

clean :
	rm -f $(OBJDIR)/*.o

$(DLL) : $(OBJ)
	$(CC) -fdiagnostics-show-option -o $(BINDIR)/$(DLL)$(SUFFIX).so -shared $(OBJDIR)/*.o 2> $(BINDIR)/build.log
#	ld -o $(BINDIR)/$(DLL)$(SUFFIX).so -shared $(OBJDIR)/*.o