-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
60 lines (48 loc) · 2.17 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
# --------------------------------------------------------------------
# Makefile Genérico :: Módulo 2. Curso Experto Desarrollo Videojuegos
# Carlos González Morcillo Escuela Superior de Informática (UCLM)
# --------------------------------------------------------------------
EXEC := PacMan
DIRSRC := src/
DIROBJ := obj/
DIRHEA := include/
CXX := g++
# Flags de compilación -----------------------------------------------
CXXFLAGS := -I $(DIRHEA) -Wall -I/usr/local/include/cegui-0/CEGUI -I/usr/local/include/cegui-0 `pkg-config --cflags OGRE OIS OGRE-Overlay` `pkg-config \
--cflags OgreBullet` `pkg-config --cflags bullet`
# Flags del linker ---------------------------------------------------
LDFLAGS := `pkg-config --libs-only-L OGRE` `pkg-config --libs-only-l \
OgreBullet` `pkg-config --libs-only-l bullet` -lOIS -lGL -lstdc++ -lboost_system -lCEGUIBase-0 -lCEGUIOgreRenderer-0
LDLIBS := `pkg-config --libs-only-l gl OIS OGRE OGRE-Overlay SDL2_mixer` `pkg-config --libs-only-l \
OgreBullet` `pkg-config --libs-only-l bullet` -lstdc++ -lConvexDecomposition -lboost_system -lOIS -lGL
# Modo de compilación (-mode=release -mode=debug) --------------------
ifeq ($(mode), release)
CXXFLAGS += -O2 -D_RELEASE
else
CXXFLAGS += -g -D_DEBUG
mode := debug
endif
# Obtención automática de la lista de objetos a compilar -------------
OBJS := $(subst $(DIRSRC), $(DIROBJ), \
$(patsubst %.cpp, %.o, $(wildcard $(DIRSRC)*.cpp)))
.PHONY: all clean
all: info dirs $(EXEC)
info:
@echo '------------------------------------------------------'
@echo '>>> Using mode $(mode)'
@echo ' (Please, call "make" with [mode=debug|release]) '
@echo '------------------------------------------------------'
dirs:
mkdir -p $(DIROBJ)
# Enlazado -----------------------------------------------------------
$(EXEC): $(OBJS)
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
# Compilación --------------------------------------------------------
$(DIROBJ)%.o: $(DIRSRC)%.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
# Limpieza de temporales ---------------------------------------------
clean:
rm -f *.log $(EXEC) *~ $(DIRSRC)*~ $(DIRHEA)*~
rm -rf $(DIROBJ)
edit:
emacs $(wildcard $(DIRSRC)*.cpp) $(wildcard $(DIRHEA)*.h) &