PREFIX ?= /usr/local/bin ifeq ($(OS),Windows_NT) UNAME_S := Windows CXX = cl CXXFLAGS = -MD -EHsc OBJEXT = obj LDFLAGS = OUTPUTFLAG = -Fo else UNAME_S := $(shell uname -s) CXX ?= g++ CXXFLAGS = -std=c++14 -Wall -Wextra -pedantic -O2 -DDEBUG -DFEATURE # -g -fsanitize=address OBJEXT = o LDFLAGS ?= -lSDL2 -lSDL2_image -lSDL2_gfx -lSDL2_ttf -pthread OUTPUTFLAG = -o endif TEST_OBJECTS = test.${OBJEXT} ifeq ($(UNAME_S),Linux) TEST_OBJECTS += libsdlpp.so endif ifeq ($(UNAME_S),Darwin) TEST_OBJECTS += libsdlpp.dylib endif ifeq ($(UNAME_S),Windows) TEST_OBJECTS += sdlpp/SDL2/SDL2_framerate.c sdlpp/SDL2/SDL2_gfxPrimitives.c sdlpp/SDL2/SDL2_imageFilter.c sdlpp/SDL2/SDL2_rotozoom.c SDLLIB = libsdlpp.dll endif .PHONY: default default: test ifeq ($(UNAME_S),Windows) test: ${TEST_OBJECTS} ${SDLLIB} $(CXX) $(CXXFLAGS) -Fe"$@" ${TEST_OBJECTS} /link sdlpp\SDL2.lib sdlpp\SDL2_ttf.lib sdlpp\SDL2_image.lib libsdlpp.lib else test: ${TEST_OBJECTS} $(CXX) $(CXXFLAGS) -o $@ $^ ${LDFLAGS} -L $(shell pwd) -lsdlpp endif test.${OBJEXT}: test.cpp $(CXX) $(CXXFLAGS) -c ${OUTPUTFLAG}$@ $< libsdlpp.so: sdlpp $(MAKE) clean -C sdlpp $(MAKE) -C sdlpp cp sdlpp/libsdlpp.so . ln -sf libsdlpp.so libsdlpp.so.1 libsdlpp.dylib: sdlpp $(MAKE) clean -C sdlpp $(MAKE) -C sdlpp cp sdlpp/libsdlpp.dylib . libsdlpp.dll: ../sdlpp $(MAKE) clean -C sdlpp $(MAKE) -C sdlpp cp sdlpp/libsdlpp.dll . cp sdlpp/libsdlpp.lib . start: LD_LIBRARY_PATH=$$(pwd) ./test clean: rm -Rf *.${OBJEXT} test