-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
91 lines (76 loc) · 3.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
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
87
88
89
90
91
SRCDIR := src
BUILDDIR := build
BUILDDIRGCW := build-gcw
BINDIR := bin
PROG := rrpg
TARGET := $(PROG)
TARGETDIST := $(PROG).opk
CC := $(CROSS_COMPILE)g++ -std=c++11
INCL :=
CFLAGS := -g -O2 -Wall -Wmissing-declarations -Weffc++ \
-pedantic -pedantic-errors -Wextra -Wcast-align \
-Wcast-qual -Wconversion -Wsign-conversion \
-Wdisabled-optimization \
-Werror -Wfloat-equal -Wformat=2 \
-Wformat-nonliteral -Wformat-security \
-Wformat-y2k \
-Wimport -Winit-self -Winline \
-Winvalid-pch \
-Wlong-long \
-Wmissing-field-initializers -Wmissing-format-attribute \
-Wmissing-include-dirs -Wmissing-noreturn \
-Wpacked -Wpointer-arith \
-Wredundant-decls \
-Wshadow -Wstack-protector \
-Wstrict-aliasing=2 -Wswitch-default \
-Wswitch-enum \
-Wunreachable-code -Wunused \
-Wunused-parameter \
-Wvariadic-macros \
-Wwrite-strings
LDFLAGS:=-Isrc/rRpg -Isrc/common
CCDYNAMICFLAGS := ${CFLAGS} ${LDFLAGS} -lSDL2 -lSDL2_image
SRC := $(shell find $(SRCDIR)/rRpg/ $(SRCDIR)/common/ -type f -name '*.cpp')
OBJ := $(patsubst %.cpp,$(BUILDDIR)/%.o,$(SRC))
OBJGCW := $(patsubst %.cpp,$(BUILDDIRGCW)/%.o,$(SRC))
DEP := $(patsubst %.o,%.deps,$(OBJ))
all: game
full: tools game build-resources
build-resources:
./bin/tools/data-compiler tiles resources/src/floor-tiles.dat resources/floor-tiles.dat
./bin/tools/data-compiler tilesets resources/src/tilesets.dat resources/tilesets.dat
./bin/tools/data-compiler races resources/src/taxonomy.dat resources/taxonomy.dat
./bin/tools/data-compiler objects resources/src/objects.dat resources/objects.dat
game: $(PROG)
-include $(DEP)
%.deps: %.cpp
$(CC) -MM $< >$@
$(BUILDDIR)/%.o: %.cpp
mkdir -p $(dir $@)
$(CC) -c -MMD $(patsubst $(BUILDDIR)/%.o,%.cpp,$@) $(CCDYNAMICFLAGS) -o $@
$(BUILDDIRGCW)/%.o: %.cpp
mkdir -p $(dir $@)
$(CC) -DGCW -c -MMD $(patsubst $(BUILDDIRGCW)/%.o,%.cpp,$@) $(CCDYNAMICFLAGS) -o $@
clean:
rm -rf $(BUILDDIR) $(LIBDIR)
$(PROG): $(OBJ)
mkdir -p $(BINDIR)
$(CC) -o $(BINDIR)/$@ $^ $(CCDYNAMICFLAGS)
gcw: $(OBJGCW)
mkdir -p $(BINDIR)
$(CC) -o $(BINDIR)/$(PROG) $^ $(CCDYNAMICFLAGS)
opk: tools build-resources
mkdir -p dist/bin dist/resources/DawnLike/Objects/ dist/resources/DawnLike/Characters/
cp -r configs dist/
cp resources/tilesets.dat resources/floor-tiles.dat resources/objects.dat resources/taxonomy.dat dist/resources/
cp resources/DawnLike/Characters/Demon1.png resources/DawnLike/Characters/Player1.png resources/DawnLike/Characters/Demon0.png resources/DawnLike/Characters/Player0.png resources/DawnLike/Characters/Rodent1.png resources/DawnLike/Characters/Rodent0.png dist/resources/DawnLike/Characters/
cp resources/DawnLike/Objects/Floor.png resources/DawnLike/Objects/Wall.png resources/DawnLike/Objects/Tile.png dist/resources/DawnLike/Objects/
mkdir -p dist/bin
cp $(BINDIR)/$(PROG) dist/bin/
mksquashfs dist $(TARGETDIST) -all-root -noappend -no-exports -no-xattrs
tools:
@mkdir -p $(BINDIR)/tools
$(CC) ${CFLAGS} ${CFLAGS} ${LDFLAGS} $(shell find src/tools/dataCompiler/ $(SRCDIR)/common/ -name "*.cpp") \
-o $(BINDIR)/tools/data-compiler
$(CC) ${CFLAGS} ${CFLAGS} ${LDFLAGS} $(shell find src/tools/dataDecompiler/ $(SRCDIR)/common/ -name "*.cpp") \
-o $(BINDIR)/tools/data-decompiler