-
Notifications
You must be signed in to change notification settings - Fork 28
/
Makefile
45 lines (35 loc) · 915 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
.PHONY: clean setup
CXX := g++
BIN := bin
BUILD := build
STDV := -std=c++11
CXXFLAGS := -MMD -MP
ifeq ($(CONFIG),debug)
CXXFLAGS += -g3 -ggdb -gstabs+
else
CXXFLAGS += -O2
endif
OBJECTS := main.o shape.o screen.o game.o functions.o
OBJECT_OUTPUTS := $(patsubst %, $(BUILD)/%, $(OBJECTS))
DEPENDS := $(patsubst %.o,%.d,$(OBJECTS))
ifneq ($(OS),Windows_NT)
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
CXXFLAGS += -lncursesw
endif
ifeq ($(UNAME_S),Darwin)
CXXFLAGS += -lncurses
endif
endif
main: setup $(OBJECT_OUTPUTS)
$(CXX) $(OBJECT_OUTPUTS) $(STDV) $(CXXFLAGS) -o $(BIN)/tetris
$(BUILD)/%.o: src/%.cpp
$(CXX) $(STDV) $(CXXFLAGS) -MT $@ $< -c -o $@
install:
install -m 0755 $(BIN)/tetris /usr/local/bin
brewinstall: setup
install -m 0755 $(BIN)/tetris $(newpath)/$(BIN)/tetris
clean:
rm -rf build/ bin/
setup:
mkdir -p $(BIN) $(BUILD) ${newpath}