# ZUtil//Makefile
# Makefile for ZUtil, requires GNU "make"

BINNAME := $(DIST)/libZUtil.a
ifeq ($(TARGET),debug)
	BINNAME := $(subst .a,_d.a, $(BINNAME))
endif

SRC := \
	ZAlloc.cpp \
	ZAllocWindow.cpp \
	ZBinaryFileReader.cpp \
	ZBinaryFileWriter.cpp \
	ZBinaryBufferReader.cpp \
	ZBinaryBufferWriter.cpp \
	ZConcurrency.cpp \
	ZEvent.cpp \
	ZIniReader.cpp \
	ZIniWriter.cpp \
	ZJSONReader.cpp \
	ZJSONWriter.cpp \
	ZKVTree.cpp \
	ZLog.cpp \
	ZMutex.cpp \
	ZName.cpp \
	ZRandomGenerator.cpp \
	ZReadWriteLock.cpp \
	ZRegistry.cpp \
	ZSemaphore.cpp \
	ZSimplexNoise.cpp \
	ZSimplexNoiseMap.cpp \
	ZTaskStream.cpp \
	ZThread.cpp \
	ZXMLReader.cpp \
	ZXMLWriter.cpp


OBJ := $(addprefix obj/$(ARCH)/$(TARGET)/,$(subst .cpp,.o,$(SRC)) ) 

$(shell mkdir -p obj/$(ARCH)/$(TARGET))

$(BINNAME): $(OBJ)
	$(AR) cru $@ $+
	$(RANLIB) $@

# CLEAN
clean:
	@-rm -r -f obj $(DIST)/libZUtil*.a
	

# *.cpp files to *.o files
obj/$(ARCH)/$(TARGET)/%.o: %.cpp
	@echo CXX $@
	@$(CXX) $(CXXFLAGS) -c $*.cpp -o obj/$(ARCH)/$(TARGET)/$*.o
