-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
86 lines (70 loc) · 1.45 KB
/
Makefile
File metadata and controls
86 lines (70 loc) · 1.45 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
82
83
84
85
86
#
# paths
#
INCDIR := ./includes
IRR_INCDIR := $(dir $(shell find /usr/include/ /mingw64/include/ -type f -name "irrlicht.h" -print -quit))
SRCDIR := ./sources
#
# compilation options
#
CXX := g++
CXXFLAGS := -I $(INCDIR) -W -Wall -Wextra -Werror -pedantic
#
# link options
#
LINKER := $(CXX)
LDFLAGS :=
LDLIBS := -l Irrlicht
#
# indie binary options
#
NAME := indie
SRC := main.cpp \
MenuLoop.cpp
SRC := $(addprefix $(SRCDIR)/, $(SRC))
OBJ := $(SRC:.cpp=.swag)
OBJ_DEBUG := $(SRC:.cpp=.debug)
#
# main build rules
#
ifeq ($(firstword $(MAKECMDGOALS)), debug)
.ONESHELL:
else ifeq ($(firstword $(MAKECMDGOALS)), msys)
LDFLAGS += -D MSYS
endif
all: $(NAME)
%.swag: %.cpp
CPLUS_INCLUDE_PATH=$(IRR_INCDIR) $(CXX) -c $(CXXFLAGS) -o $@ $<
$(NAME): $(OBJ)
$(LINKER) -o $@ $^ $(LDFLAGS) $(LDLIBS)
@echo === $@ BUILD COMPLETE ===
%.debug: %.cpp
@export CPLUS_INCLUDE_PATH=$(IRR_INCDIR)
$(CXX) -c $(CXXFLAGS) -o $@ $< &> debug.log
[ $$? -ne 0 ] && less debug.log && exit -1 || exit 0
debug: $(OBJ_DEBUG)
@$(LINKER) -o $@ $^ $(LDFLAGS) $(LDLIBS) &> debug.log
[ $$? -ne 0 ] && less debug.log && exit -1
$(RM) debug.log $^
echo === $@ BUILD COMPLETE ===
echo
./$@
echo
$(RM) $@
echo === $@ EXECUTION COMPLETE ===
#
# clean rules
#
RM := rm -fv
clean:
$(RM) $(OBJ)
fclean: clean
$(RM) $(NAME)
re: fclean all
#
# special rules
#
.PHONY: all debug clean fclean re
.SILENT: clean fclean
.DEFAULT:
@echo nik ta mèr tu peu pa fèr sa