2020-07-27 16:58:43 +00:00
|
|
|
PREFIX ?= /usr/local/bin
|
2021-03-12 21:33:46 +00:00
|
|
|
|
|
|
|
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
|
2020-08-22 11:17:56 +00:00
|
|
|
LDFLAGS ?= -lSDL2 -lSDL2_image -lSDL2_gfx -lSDL2_ttf -pthread
|
2021-03-12 21:33:46 +00:00
|
|
|
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
|
2020-07-27 16:58:43 +00:00
|
|
|
|
|
|
|
.PHONY: default
|
2021-03-12 21:33:46 +00:00
|
|
|
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
|
2020-07-27 16:58:43 +00:00
|
|
|
|
2021-03-12 21:33:46 +00:00
|
|
|
else
|
|
|
|
test: ${TEST_OBJECTS}
|
|
|
|
$(CXX) $(CXXFLAGS) -o $@ $^ ${LDFLAGS} -L $(shell pwd) -lsdlpp
|
|
|
|
endif
|
2020-07-27 16:58:43 +00:00
|
|
|
|
2021-03-12 21:33:46 +00:00
|
|
|
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 .
|
2020-07-27 16:58:43 +00:00
|
|
|
|
2021-03-12 21:33:46 +00:00
|
|
|
start:
|
|
|
|
LD_LIBRARY_PATH=$$(pwd) ./test
|
2020-09-12 23:35:42 +00:00
|
|
|
|
2020-07-27 16:58:43 +00:00
|
|
|
clean:
|
2021-03-12 21:33:46 +00:00
|
|
|
rm -Rf *.${OBJEXT} test
|