forked from NJU-ProjectN/onscripter-navy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (37 loc) · 999 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
48
49
50
NAME = onscripter
INC_DIR += ./include
BUILD_DIR ?= ./build
OBJ_DIR ?= $(BUILD_DIR)/
BINARY ?= $(BUILD_DIR)/$(NAME)
.DEFAULT_GOAL = app
DEFS = -DUSE_BUILTIN_EFFECTS -DUSE_BUILTIN_LAYER_EFFECTS
# optional: enable English mode
#DEFS += -DENABLE_1BYTE_CHAR -DFORCE_1BYTE_CHAR
# Compilation flags
CC = gcc
CXX = g++
LD = g++
INCLUDES = $(addprefix -I, $(INC_DIR))
CFLAGS = -O2 -MMD -Wall $(INCLUDES) `sdl-config --cflags`
CXXFLAGS = $(CFLAGS)
LDFLAGS = -O2 `sdl-config --libs` -lSDL_ttf -lSDL_image -lSDL_mixer -lbz2 -lm
# Files to be compiled
CXX_SRCS = $(shell find src/ -name "*.cpp")
OBJS = $(CXX_SRCS:src/%.cpp=$(OBJ_DIR)/%.o)
# Compilation patterns
$(OBJ_DIR)/%.o: src/%.cpp
@echo + CXX $<
@mkdir -p $(dir $@)
@$(CXX) $(CXXFLAGS) -c -o $@ $<
# Depencies
-include $(OBJS:.o=.d)
# Some convenient rules
.PHONY: app clean
app: $(BINARY)
$(BINARY): $(OBJS)
@echo + LD $@
@$(LD) -o $@ $^ $(LDFLAGS)
run: app
./$(BINARY) -r ../ons-game/clannad
clean:
-rm -rf $(BUILD_DIR)