-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·81 lines (66 loc) · 2.25 KB
/
Makefile
File metadata and controls
executable file
·81 lines (66 loc) · 2.25 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#
# SpaceSheep, ncurses game. Code is hosted on GitHub.
#
# File: Makefile
#
# Authors:
# Martina Crippa <martina.crippa2@studenti.unimi.it>
# Pietro Francesco Fontana <pietrofrancesco.fontana@studenti.unimi.it>
#
################################################################################
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
# configure multithreaded compilation
OS := $(shell uname)
ifeq ($(OS), Linux)
export MAKEFLAGS="-j $(grep -c ^processor /proc/cpuinfo)"
else ifeq ($(OS), Darwin)
export MAKEFLAGS="-j $(sysctl-n hw.ncpu)"
endif
# search in VPATH for source file
VPATH=./source/
# place object file in OBJPATH
OBJPATH=./obj/
GCC47_BINDIR :=
# configure compilator path in tolab
#GCC47_BINDIR := /opt/centos/devtoolset-1.1/root/usr/bin/
CXX := $(GCC47_BINDIR)$(CXX)
TARGET := game
OBJS := $(patsubst %.o,$(OBJPATH)%.o, obstacle.o hitbox.o sketcher.o engine.o \
prizegive.o UDPMcastSender.o UDPMcastReceiver.o UDPSSMcast.o)
DEBUG := -g
WARNING := -Wall -Wextra
CXXFLAGS := $(CXXFLAGS) -std=c++11
LDFLAGS := -lncurses -lpthread
# libraries for compilation on old system (tolab)
#LDFLAGS := -lncurses -ltinfo -lrt -lpthread
all: $(TARGET)
game: $(OBJS) $(OBJPATH)main.o
$(CXX) -o $@ $(OBJS) $(OBJPATH)main.o $(CXXFLAGS) $(LDFLAGS)
$(OBJPATH)main.o: main.cpp $(OBJS)
$(CXX) -c $< -o $@ $(CXXFLAGS)
$(OBJPATH)%.o: %.cpp %.h
ifeq ($(wildcard $(OBJPATH)*),) #search for obj path, create it if it doesn't exist
@mkdir -p $(OBJPATH)
endif
$(CXX) -c $< -o $@ $(CXXFLAGS)
.PHONY: run clean
run:
./$(TARGET)
clean:
/bin/rm -f $(OBJPATH)*.o
/bin/rm -f $(TARGET)
# vim: set noexpandtab: