game/sdlpp/Makefile

47 lines
1.2 KiB
Makefile
Raw Normal View History

2020-11-21 19:57:40 +00:00
CXX ?= g++
CPPFLAGS = -std=c++14 -Wall -Wextra -pedantic
MAJOR ?= 1
MINOR ?= 0
RELEASE ?= 0
2020-11-22 20:58:37 +00:00
ifeq ($(OS),Windows_NT)
UNAME_S := Windows
else
UNAME_S := $(shell uname -s)
endif
ifeq ($(UNAME_S),Linux)
2020-11-21 19:57:40 +00:00
SDLPPLIBRARY = libsdlpp.so.${MAJOR}.${MINOR}.${RELEASE}
2020-11-22 20:58:37 +00:00
LIBRARYFLAGS = -fPIC
endif
ifeq ($(UNAME_S),Darwin)
SDLPPLIBRARY = libsdlpp.dylib
LIBRARYFLAGS =
endif
2020-11-21 19:57:40 +00:00
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 $@
2020-11-22 20:58:37 +00:00
ifeq ($(UNAME_S),Linux)
2020-11-21 19:57:40 +00:00
${SDLPPLIBRARY}: ${OBJECTFILES}
${CXX} ${CPPFLAGS} -shared -Wl,-soname,libsdlpp.so.${MAJOR}\
-o ${SDLPPLIBRARY} $^
ln -sf ${SDLPPLIBRARY} libsdlpp.so
ln -sf ${SDLPPLIBRARY} libsdlpp.so.${MAJOR}
2020-11-22 20:58:37 +00:00
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
2020-11-21 19:57:40 +00:00
clean:
2020-11-22 20:58:37 +00:00
${RM} *.so* *.o *.dylib
2020-11-21 19:57:40 +00:00
.PHONY: all clean test