Make dynamic library work on macos
This commit is contained in:
+22
-2
@@ -3,11 +3,28 @@ CFLAGS ?= -O2 -Wall -Wextra -std=c++14
|
||||
PREFIX ?= /usr/local/bin
|
||||
LDFLAGS ?= -lSDL2 -lSDL2_image -lSDL2_gfx -lSDL2_ttf -pthread
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
UNAME_S := Windows
|
||||
else
|
||||
UNAME_S := $(shell uname -s)
|
||||
endif
|
||||
|
||||
TETRIS_OBJECTS = tetris.o scenes.o config.o functions.o global_vars.o
|
||||
|
||||
ifeq ($(UNAME_S),Linux)
|
||||
TETRIS_OBJECTS += libsdlpp.so
|
||||
SDLLIB = libsdlpp
|
||||
endif
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
TETRIS_OBJECTS += libsdlpp.dylib
|
||||
SDLLIB = sdlpp
|
||||
endif
|
||||
|
||||
.PHONY: default
|
||||
default: tetris
|
||||
|
||||
tetris: tetris.o scenes.o config.o functions.o global_vars.o libsdlpp.so
|
||||
$(CXX) $(CFLAGS) -o $@ $^ ${LDFLAGS} -L -llibsdlpp
|
||||
tetris: ${TETRIS_OBJECTS}
|
||||
$(CXX) $(CFLAGS) -o $@ $^ ${LDFLAGS} -L $(shell pwd) -l${SDLLIB}
|
||||
|
||||
tetris.o: tetris.cpp ../sdlpp/sdlpp.hpp config.hpp custom_classes.hpp scenes.hpp global_vars.hpp functions.hpp
|
||||
$(CXX) $(CFLAGS) -c -o $@ $<
|
||||
@@ -23,6 +40,9 @@ libsdlpp.so: ../sdlpp
|
||||
$(MAKE) -C ../sdlpp
|
||||
cp ../sdlpp/libsdlpp.so .
|
||||
ln -sf libsdlpp.so libsdlpp.so.1
|
||||
libsdlpp.dylib: ../sdlpp
|
||||
$(MAKE) -C ../sdlpp
|
||||
cp ../sdlpp/libsdlpp.dylib .
|
||||
|
||||
start:
|
||||
LD_LIBRARY_PATH=$$(pwd) ./tetris
|
||||
|
||||
Reference in New Issue
Block a user