game/tetris/Makefile

50 lines
1.3 KiB
Makefile
Raw Normal View History

2020-09-11 12:29:06 +00:00
CXX ?= g++
2020-10-20 09:04:07 +00:00
CFLAGS ?= -O2 -Wall -Wextra -std=c++14
2020-09-11 12:29:06 +00:00
PREFIX ?= /usr/local/bin
LDFLAGS ?= -lSDL2 -lSDL2_image -lSDL2_gfx -lSDL2_ttf -pthread
2020-11-22 20:58:37 +00:00
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
2020-09-11 12:29:06 +00:00
.PHONY: default
default: tetris
2020-11-22 20:58:37 +00:00
tetris: ${TETRIS_OBJECTS}
2020-11-22 21:01:20 +00:00
$(CXX) $(CFLAGS) -o $@ $^ ${LDFLAGS} -L $(shell pwd) -lsdlpp
2020-09-11 12:29:06 +00:00
2020-11-21 19:58:52 +00:00
tetris.o: tetris.cpp ../sdlpp/sdlpp.hpp config.hpp custom_classes.hpp scenes.hpp global_vars.hpp functions.hpp
2020-09-11 12:29:06 +00:00
$(CXX) $(CFLAGS) -c -o $@ $<
2020-11-21 19:58:52 +00:00
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 $@ $<
2020-09-11 19:40:51 +00:00
functions.o: functions.cpp config.hpp functions.hpp global_vars.hpp scenes.hpp
$(CXX) $(CFLAGS) -c -o $@ $<
2020-09-11 19:40:51 +00:00
global_vars.o: global_vars.cpp config.hpp global_vars.hpp functions.hpp
2020-09-11 12:29:06 +00:00
$(CXX) $(CFLAGS) -c -o $@ $<
2020-11-21 19:58:52 +00:00
libsdlpp.so: ../sdlpp
$(MAKE) -C ../sdlpp
cp ../sdlpp/libsdlpp.so .
ln -sf libsdlpp.so libsdlpp.so.1
2020-11-22 20:58:37 +00:00
libsdlpp.dylib: ../sdlpp
$(MAKE) -C ../sdlpp
cp ../sdlpp/libsdlpp.dylib .
2020-11-21 19:58:52 +00:00
start:
LD_LIBRARY_PATH=$$(pwd) ./tetris
2020-09-11 12:29:06 +00:00
clean:
rm -Rf *.o tetris