47 lines
1.2 KiB
Makefile
47 lines
1.2 KiB
Makefile
CXX ?= g++
|
|
CPPFLAGS = -std=c++14 -Wall -Wextra -pedantic
|
|
|
|
MAJOR ?= 1
|
|
MINOR ?= 0
|
|
RELEASE ?= 0
|
|
|
|
ifeq ($(OS),Windows_NT)
|
|
UNAME_S := Windows
|
|
else
|
|
UNAME_S := $(shell uname -s)
|
|
endif
|
|
|
|
ifeq ($(UNAME_S),Linux)
|
|
SDLPPLIBRARY = libsdlpp.so.${MAJOR}.${MINOR}.${RELEASE}
|
|
LIBRARYFLAGS = -fPIC
|
|
endif
|
|
ifeq ($(UNAME_S),Darwin)
|
|
SDLPPLIBRARY = libsdlpp.dylib
|
|
LIBRARYFLAGS =
|
|
endif
|
|
|
|
OBJECTFILES = sdlpp_circlecolider.o sdlpp_circlerenderer.o sdlpp_collision.o sdlpp_common.o sdlpp_font.o sdlpp_linerenderer.o sdlpp_rectcolider.o sdlpp_rectrenderer.o sdlpp_renderer.o sdlpp_renderobject.o sdlpp_scene.o sdlpp_textrenderer.o sdlpp_texture.o sdlpp_window.o
|
|
|
|
all: ${SDLPPLIBRARY}
|
|
|
|
%.o: %.cpp
|
|
${CXX} ${CPPFLAGS} ${LIBRARYFLAGS} -c $< -o $@
|
|
|
|
ifeq ($(UNAME_S),Linux)
|
|
${SDLPPLIBRARY}: ${OBJECTFILES}
|
|
${CXX} ${CPPFLAGS} -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} ${CPPFLAGS} -dynamiclib -install_name ${SDLPPLIBRARY}\
|
|
-current_version ${MAJOR}.${MINOR} $^ -lSDL2 -lSDL2_image -lSDL2_gfx -lSDL2_ttf -o $@
|
|
endif
|
|
|
|
clean:
|
|
${RM} *.so* *.o *.dylib
|
|
|
|
.PHONY: all clean test
|