-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
60 lines (49 loc) · 1.66 KB
/
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Copyright (c) 2015-2017 Annemarie Mattmann, Johannes Mattmann,
# Matthias Gazzari, Moritz Hagemann, Sebastian Artz
#
# Licensed under the MIT license. See the LICENSE file for details.
# $< the first dependency
# $@ name of the target
# $+ list of all dependencies
# $^ list of all dependencies (unique elements)
VERSION = 1.0
CC = clang++
#CC = g++
LIBS = -lsfml-audio -lsfml-graphics -lsfml-window -lsfml-system
CFLAGS = -Wall -std=c++11 -O2
BUILDDIR = build
BINARYDIR = bin
# windows crosscompiler variables
WIN_CC = /usr/bin/i686-w64-mingw32-g++
SFML_PATH = SFML-2.2
# define code paths
SOURCE_PATH = src
SOURCES = $(wildcard $(SOURCE_PATH)/*.cpp) $(wildcard $(SOURCE_PATH)/Items/*.cpp)
OBJECT = $(patsubst %.cpp, $(BUILDDIR)/%.o, $(SOURCES))
# build all
all: $(OBJECT)
mkdir -p $(BINARYDIR)
$(CC) -o $(BINARYDIR)/run $^ $(LIBS)
# build window release using g++ (via MinGW)
win: CC = $(WIN_CC)
win: CFLAGS := $(CFLAGS) -I $(SFML_PATH)/include
win: LIBS := -L $(SFML_PATH)/lib $(LIBS)
win: all
# build window release using g++ (via MinGW) fixing std::to_string
win_fix: CC = $(WIN_CC)
win_fix: CFLAGS := $(CFLAGS) -I $(SFML_PATH)/include -DFIX_TO_STRING
win_fix: LIBS := -L $(SFML_PATH)/lib $(LIBS)
win_fix: all
# build static window release using g++ (via MinGW) fixing std::to_string
# create object files in BUILDIR
$(BUILDDIR)/%.o: %.cpp
mkdir -p $(dir $@)
$(CC) -c $(CFLAGS) $< -o $@
# remove object and binary files
clean:
@rm -rf $(BUILDDIR)
@rm -rf $(BINARYDIR)
png:
cd img && mogrify -layers merge -format png *.xcf
ogg:
cd sound && for input in *.wav; do if [ ! -f $${input%.*}.ogg ]; then ffmpeg -i $$input -acodec libvorbis $${input%.*}.ogg; fi done