forked from athos-ribeiro/jtj
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
47 lines (36 loc) · 918 Bytes
/
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
# Base Makefile for project build.
#
# Author: Edson Alves (edsonalves@unb.br)
# Date: 22/03/2016
# Directories
SRC_DIR = src
OBJ_DIR = obj
LIB_DIR = lib
BIN_DIR = bin
# C++ compiler
CC = g++
# Flags, includes and libs
CFLAGS = -W -Wall -pedantic -std=c++11 -MMD -g3
INCLUDES = -Iinclude `sdl-config --cflags`
LIBS = `sdl-config --libs` -lpthread -lSDL_image -lSDL_ttf
# Game info
NAME = jtj
GAME = $(BIN_DIR)/$(NAME)
# Project sources and objects
SRC = ${wildcard $(SRC_DIR)/*.cpp}
OBJ = ${addprefix $(OBJ_DIR)/, ${notdir ${SRC:.cpp=.o}}}
.PHONY: all clean depend
all:
@mkdir -p $(OBJ_DIR) $(LIB_DIR) $(BIN_DIR)
$(MAKE) $(GAME)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
@echo Building $@
@$(CC) -c $(CFLAGS) $(INCLUDES) $< -o $@
$(GAME): $(OBJ)
@echo Building $(NAME) ...
@$(CC) $(CFLAGS) $(INCLUDES) -o $@ $(OBJ) $(LIBS)
@echo --- Done
clean:
@echo Cleaning...
@rm -rf obj/ bin/ *~
-include $(OBJ:.o=.d)