ARCH=@ARCH@

SRCS= \
  alpha.cpp \
  clusterfit.cpp \
  colourblock.cpp \
  colourfit.cpp \
  colourset.cpp \
  maths.cpp \
  rangefit.cpp \
  singlecolourfit.cpp \
  squish.cpp

CXXFLAGS           += -I.
CXXFLAGS_FOR_BUILD += -I.
LIB                 = libsquish.a
NATIVE_LIB          = libsquish-native.so
CLEAN_FILES        += $(NATIVE_LIB)

ifeq ($(findstring Darwin,$(shell uname -s)),Darwin)
  CXXFLAGS_FOR_BUILD += @DARWIN_NATIVE_ARCH@
endif

all: $(LIB)

# TexturePacker links to libsquish and needs to run on build system, so make a native flavor.
$(NATIVE_LIB): $(SRCS)
ifeq ($(findstring Darwin,$(shell uname -s)),Darwin)
	$(CXX_FOR_BUILD) $(CXXFLAGS_FOR_BUILD) $(SRCS) -dynamiclib -install_name `pwd`/$(NATIVE_LIB) -o $@
else
	$(CXX_FOR_BUILD) $(CXXFLAGS_FOR_BUILD) $(SRCS) -shared -fPIC -Wl,-soname,`pwd`/$(NATIVE_LIB) -o $@
endif

include ../../Makefile.include
-include $(patsubst %.cpp,%.P,$(patsubst %.c,%.P,$(SRCS)))