forked from ParadoxZero/sfml-snake
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
40 lines (26 loc) · 1018 Bytes
/
Makefile
File metadata and controls
40 lines (26 loc) · 1018 Bytes
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
BUILD = build
BIN = bin
OUTPUTNAME = sfml-snake
INCLUDE = -I./include -I./src
CUSTOMLIB = -L./liblinux -lGameMenu
SRCFILES := $(shell find src/ -name *.cpp)
OBJFILES := $(patsubst %.cpp,%.o,$(SRCFILES))
OBJFILES := $(foreach dir,$(OBJFILES),$(subst src/,,$(dir)))
DIR := $(dir $(OBJFILES))
TARGETLIST = $(foreach f,$(OBJFILES),$(BUILD)/$(f))
$(foreach d,$(DIR),$(shell mkdir -p $(BUILD)/$(d)))
$(shell mkdir -p $(BIN))
CC = g++
CFLAGS = -g -std=c++11
LIBS=-lsfml-graphics -lsfml-window -lsfml-system
G++_VER_LT48 := $(shell expr `$(CC) -dumpversion | cut -f1-2 -d.` \< 4.8 )
ifeq ("$(G++_VER_LT48)","1")
$(error old version of g++ not supported, upgrade to 4.8 or higher)
endif
$(info Source: $(SRCFILES))
$(info Targets: $(TARGETLIST))
default: $(BIN)/$(OUTPUTNAME)
$(BIN)/$(OUTPUTNAME): $(TARGETLIST)
$(CC) $(CFLAGS) $(TARGETLIST) $(LIBS) $(CUSTOMLIB) -o $(BIN)/$(OUTPUTNAME)
$(BUILD)/%.o: $(SRCFILES)
$(CC) -c $(CFLAGS) $(INCLUDE) $(filter %$(notdir $(patsubst %.o,%.cpp,$@)),$(SRCFILES)) -o $@