-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
47 lines (37 loc) · 1.28 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
NAME = ije02_game
SRC_DIR = src
INC_DIR = include
OBJ_DIR = obj
LIB_DIR = libs
BIN_DIR = bin
TARGET = $(BIN_DIR)/$(NAME)
CC = g++
CFLAGS = -pedantic -std=c++11 -w -MMD -g3 -g -fPIC\
-W -Wall -Wextra -Wshadow -Wcast-align -Wcast-qual -Wctor-dtor-privacy\
-Wdisabled-optimization -Wformat=2 -Wlogical-op -Wmissing-declarations\
-Wmissing-include-dirs -Wnoexcept -Woverloaded-virtual -Wredundant-decls\
-Wsign-promo -Wstrict-null-sentinel -Wswitch-default -Wundef\
-Wzero-as-null-pointer-constant -Wuseless-cast -Wnon-virtual-dtor
INCLUDES = -Iinclude `sdl2-config --cflags` -I/usr/local/include/ijengine
LIBS = -L/usr/local/lib -lijengine `sdl2-config --libs` -lSDL2_image -lSDL2_ttf -lSDL2_mixer -ldl
SRC = ${wildcard $(SRC_DIR)/*.cpp}
OBJ = ${addprefix $(OBJ_DIR)/, ${notdir ${SRC:.cpp=.o}}}
.PHONY: clean depend dist-clean dist
all:
@mkdir -p $(OBJ_DIR) $(BIN_DIR)
$(MAKE) $(TARGET)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
@echo Building $@
@$(CC) -c $(CFLAGS) $(INCLUDES) $< -o $@
$(TARGET): $(OBJ)
@echo Building $@
$(CC) $(CFLAGS) $(INCLUDES) $(OBJ) -o $@ $(LIBS)
@echo Done.
clean:
@echo Cleaning...
@find . -name *.o -exec rm {} \;
@find . -name *.d -exec rm {} \;
@rm -rf *~ *.o prog out.txt
dist-clean: clean
@rm -f $(TARGET)/$(NAME)
@rm -rf *.tar.gz $(OBJ_DIR) $(BIN_DIR)