50 lines
1.3 KiB
Makefile
50 lines
1.3 KiB
Makefile
CXX ?= g++
|
|
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
|
|
endif
|
|
ifeq ($(UNAME_S),Darwin)
|
|
TETRIS_OBJECTS += libsdlpp.dylib
|
|
endif
|
|
|
|
.PHONY: default
|
|
default: tetris
|
|
|
|
tetris: ${TETRIS_OBJECTS}
|
|
$(CXX) $(CFLAGS) -o $@ $^ ${LDFLAGS} -L $(shell pwd) -lsdlpp
|
|
|
|
tetris.o: tetris.cpp ../sdlpp/sdlpp.hpp config.hpp custom_classes.hpp scenes.hpp global_vars.hpp functions.hpp
|
|
$(CXX) $(CFLAGS) -c -o $@ $<
|
|
scenes.o: scenes.cpp ../sdlpp/sdlpp.hpp config.hpp scenes.hpp functions.hpp global_vars.hpp
|
|
$(CXX) $(CFLAGS) -c -o $@ $<
|
|
config.o: config.cpp config.hpp
|
|
$(CXX) $(CFLAGS) -c -o $@ $<
|
|
functions.o: functions.cpp config.hpp functions.hpp global_vars.hpp scenes.hpp
|
|
$(CXX) $(CFLAGS) -c -o $@ $<
|
|
global_vars.o: global_vars.cpp config.hpp global_vars.hpp functions.hpp
|
|
$(CXX) $(CFLAGS) -c -o $@ $<
|
|
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
|
|
|
|
clean:
|
|
rm -Rf *.o tetris
|