-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
143 lines (122 loc) · 2.71 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
CC ?= cc
CXX ?= c++
CFLAGS ?= -O2
CXXFLAGS ?= -O2
FLAGS_C := -std=c99
FLAGS_CXX := -std=c++11
PREFIX ?= /usr/local
DATAROOTDIR ?= $(PREFIX)/share
DATADIR ?= $(DATAROOTDIR)
DOCDIR ?= $(DATAROOTDIR)/doc/$(NAME)
LIBDIR ?= $(PREFIX)/lib
USE_EXTERNAL_MINIZ ?= 0
PKG_CONFIG ?= pkg-config
CFLAGS_SDL2 := $(shell $(PKG_CONFIG) --cflags sdl2)
LIBS_SDL2 := $(shell $(PKG_CONFIG) --libs sdl2)
CFLAGS_XML2 := $(shell $(PKG_CONFIG) --cflags libxml-2.0)
LIBS_XML2 := $(shell $(PKG_CONFIG) --libs libxml-2.0)
#UIFLAGS += -ggdb1 -rdynamic -g -O0 -fno-inline -fno-eliminate-unused-debug-types -gstabs -g3
UIFLAGS := -Wall -Ideps/yxml $(CFLAGS_SDL2) $(CFLAGS_XML2)
UILIBS := $(LIBS_SDL2) $(LIBS_XML2) -lGL -lGLU
TARGET := u4
CSRCS := \
deps/yxml/yxml.c \
src/lzw/hash.c \
src/lzw/lzw.c \
src/lzw/u4decode.c \
src/armor.c \
src/cmixer.c \
src/coords.c \
src/direction.c \
src/error.c \
src/image.c \
src/imageloader.c \
src/io.c \
src/moongate.c \
src/music.c \
src/names.c \
src/random.c \
src/rle.c \
src/savegame.c \
src/settings.c \
src/sound.c \
src/stb_vorbis.c \
src/xmlparse.c \
src/u4_sdl.c \
src/video.c \
src/weapon.c \
src/u4file.c
CXXSRCS := \
src/annotation.cpp \
src/aura.cpp \
src/camp.cpp \
src/cheat.cpp \
src/city.cpp \
src/codex.cpp \
src/combat.cpp \
src/config.cpp \
src/controller.cpp \
src/context.cpp \
src/conversation.cpp \
src/creature.cpp \
src/death.cpp \
src/dialogueloader.cpp \
src/dialogueloader_hw.cpp \
src/dialogueloader_lb.cpp \
src/dialogueloader_tlk.cpp \
src/dungeon.cpp \
src/dungeonview.cpp \
src/event.cpp \
src/event_sdl.cpp \
src/game.cpp \
src/imagemgr.cpp \
src/imageview.cpp \
src/intro.cpp \
src/item.cpp \
src/location.cpp \
src/map.cpp \
src/maploader.cpp \
src/mapmgr.cpp \
src/menu.cpp \
src/menuitem.cpp \
src/movement.cpp \
src/object.cpp \
src/person.cpp \
src/player.cpp \
src/portal.cpp \
src/progress_bar.cpp \
src/script.cpp \
src/screen.cpp \
src/shrine.cpp \
src/spell.cpp \
src/stats.cpp \
src/textview.cpp \
src/tile.cpp \
src/tileanim.cpp \
src/tilemap.cpp \
src/tileset.cpp \
src/tileview.cpp \
src/u4.cpp \
src/view.cpp \
src/xml.cpp
ifeq ($(USE_EXTERNAL_MINIZ), 0)
CFLAGS_MINIZ := -Ideps/miniz
LIBS_MINIZ :=
CSRCS += deps/miniz/miniz.c
else
CFLAGS_MINIZ := $(shell $(PKG_CONFIG) --cflags miniz)
LIBS_MINIZ := $(shell $(PKG_CONFIG) --libs miniz)
endif
UIFLAGS += $(CFLAGS_MINIZ)
UILIBS += $(LIBS_MINIZ)
.PHONY: all clean
OBJS := $(CSRCS:.c=.o) $(CXXSRCS:.cpp=.o)
all: $(TARGET)
%.o: %.c
$(CC) $(CFLAGS) $(CPPFLAGS) $(FLAGS_C) $(UIFLAGS) -c $< -o $@
%.o: %.cpp
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(FLAGS_CXX) $(UIFLAGS) -c $< -o $@
$(TARGET): $(OBJS)
$(CXX) $^ $(LDFLAGS) $(UILIBS) -o $@
clean:
rm -rf *~ */*~ $(OBJS) $(TARGET)