sources = $(wildcard src/*.cpp)
objects = $(sources:.cpp=.o)
static_libs = lib/macos/libftd2xx.a
libs = -lpthread

CXXFLAGS = -std=c++11

UNAME := $(shell uname)
# Assume target is Mac OS if build host is Mac OS; any other host targets Linux
ifeq ($(UNAME), Darwin)
	libs += -lobjc -framework IOKit -framework CoreFoundation
else
	libs += -lrt
endif

all: loader

loader: $(objects)
	$(CXX) $(LDFLAGS) -o $@ $^ $(static_libs) $(libs)

.PHONY: clean

clean:
	rm -rf loader $(objects)
