MAJOR ?= 1 MINOR ?= 0 RELEASE ?= 0 ifeq ($(OS),Windows_NT) UNAME_S := Windows CXX = cl CXXFLAGS = -MD -EHsc /DDLLEXPORT OBJEXT = obj RM = del else UNAME_S := $(shell uname -s) CXX ?= g++ CXXFLAGS = -std=c++14 -Wall -Wextra -pedantic -g OBJEXT = o endif ifeq ($(UNAME_S),Linux) SDLPPLIBRARY = libsdlpp.so.${MAJOR}.${MINOR}.${RELEASE} LIBRARYFLAGS = -fPIC endif ifeq ($(UNAME_S),Darwin) SDLPPLIBRARY = libsdlpp.dylib LIBRARYFLAGS = endif ifeq ($(UNAME_S),Windows) SDLPPLIBRARY = libsdlpp.dll LIBRARYFLAGS = endif OBJECTFILES = sdlpp_circlecolider.${OBJEXT} sdlpp_circlerenderer.${OBJEXT} sdlpp_collision.${OBJEXT} sdlpp_common.${OBJEXT} sdlpp_font.${OBJEXT} sdlpp_linerenderer.${OBJEXT} sdlpp_rectcolider.${OBJEXT} sdlpp_rectrenderer.${OBJEXT} sdlpp_renderer.${OBJEXT} sdlpp_renderobject.${OBJEXT} sdlpp_scene.${OBJEXT} sdlpp_textrenderer.${OBJEXT} sdlpp_texture.${OBJEXT} sdlpp_window.${OBJEXT} all: ${SDLPPLIBRARY} ifeq ($(UNAME_S),Windows) %.${OBJEXT}: %.cpp ${CXX} ${CXXFLAGS} ${LIBRARYFLAGS} /c $< /Fo"$@" else %.${OBJEXT}: %.cpp ${CXX} ${CXXFLAGS} ${LIBRARYFLAGS} -c $< -o $@ endif ifeq ($(UNAME_S),Linux) ${SDLPPLIBRARY}: ${OBJECTFILES} ${CXX} ${CXXFLAGS} -shared -Wl,-soname,libsdlpp.so.${MAJOR}\ -o ${SDLPPLIBRARY} $^ ln -sf ${SDLPPLIBRARY} libsdlpp.so ln -sf ${SDLPPLIBRARY} libsdlpp.so.${MAJOR} endif ifeq ($(UNAME_S),Darwin) ${SDLPPLIBRARY}: ${OBJECTFILES} ${CXX} ${CXXFLAGS} -dynamiclib -install_name ${SDLPPLIBRARY}\ -current_version ${MAJOR}.${MINOR} $^ -lSDL2 -lSDL2_image -lSDL2_gfx -lSDL2_ttf -o $@ endif ifeq ($(UNAME_S),Windows) ${SDLPPLIBRARY}: ${OBJECTFILES} ${CXX} /LD $^ /link SDL2.lib SDL2_ttf.lib SDL2_image.lib /OUT:$@ /IMPLIB:libsdlpp.lib endif clean: ${RM} *.so* *.${OBJEXT} *.dylib libsdlpp* .PHONY: all clean test