-
Notifications
You must be signed in to change notification settings - Fork 78
/
libexterns.mk
228 lines (180 loc) · 6.1 KB
/
libexterns.mk
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
#******************************************************************************
# Free implementation of Bullfrog's Dungeon Keeper strategy game.
#******************************************************************************
# @file libexterns.mk
# A script used by GNU Make to recompile the project.
# @par Purpose:
# Defines make rules for libraries which source is external to KeeperFX.
# Most libraries can be downloaded from official prebuilds.
# @par Comment:
# None.
# @author Tomasz Lis
# @date 08 Jun 2010 - 09 Jun 2010
# @par Copying and copyrights:
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
#******************************************************************************
ARCH = i686-w64-mingw32
include prebuilds.mk
.PHONY: clean-libsdl deep-clean-libsdl
.INTERMEDIATE: libsdl libsdlnet libsdlmixer libsdlimage
libexterns: libsdl libsdlnet libsdlmixer libsdlimage
touch libexterns
clean-libexterns: clean-libsdl
$(RM) libexterns
deep-clean-libexterns: deep-clean-libsdl
ifneq (,$(findstring .tar.gz,$(SDL_PACKAGE)))
libsdl: sdl/lib/libSDL2main.a
# If we have tar gzip prebuild, download and extract it
sdl/lib/libSDL2main.a: sdl/$(SDL_PACKAGE)
-$(ECHO) 'Extracting package: $<'
# Grep is used to remove bogus error messages, return state of tar is also ignored
-cd "$(<D)"; \
tar --strip-components=2 -zxmUf "$(<F)" SDL2-2.30.7/i686-w64-mingw32/bin SDL2-2.30.7/i686-w64-mingw32/include SDL2-2.30.7/i686-w64-mingw32/lib SDL2-2.30.7/i686-w64-mingw32/share 2>&1 | \
grep -v '^.*: Archive value .* is out of .* range.*$$'
$(CP) sdl/bin/SDL2.dll sdl/for_final_package/
-$(ECHO) 'Finished extracting: $<'
-$(ECHO) ' '
sdl/$(SDL_PACKAGE):
-$(ECHO) 'Downloading package: $@'
$(MKDIR) "$(@D)"
curl -L -o "[email protected]" "$(SDL_DOWNLOAD)"
tar -tzf "[email protected]" >/dev/null
$(MV) "[email protected]" "$@"
-$(ECHO) 'Finished downloading: $@'
-$(ECHO) ' '
else
$(error Cannot handle SDL library prebuild. You need to prepare the library manually.)
endif
##################
ifneq (,$(findstring .tar.gz,$(SDL_NET_PACKAGE)))
libsdlnet: sdl/lib/libSDL2_net.lib
sdl/lib/libSDL2_net.lib: sdl/$(SDL_NET_PACKAGE)
-$(ECHO) 'Extracting package: $<'
$(MKDIR) sdl/lib sdl/include/SDL2
cd "$(<D)"; \
tar -xzf "$(<F)"
$(MV) sdl/SDL2_net-*/$(ARCH)/include/SDL2/* sdl/include/SDL2/
$(CP) -r sdl/SDL2_net-*/$(ARCH)/lib/* sdl/lib/
$(CP) sdl/SDL2_net-*/$(ARCH)/bin/SDL2_net.dll sdl/for_final_package/
-$(ECHO) 'Finished extracting: $<'
-$(ECHO) ' '
sdl/$(SDL_NET_PACKAGE):
-$(ECHO) 'Downloading package: $@'
$(MKDIR) "$(@D)"
curl -L -o "[email protected]" "$(SDL_NET_DOWNLOAD)"
tar -tzf "[email protected]"
$(MV) "[email protected]" "$@"
-$(ECHO) 'Finished downloading: $@'
-$(ECHO) ' '
else
libsdlnet: sdl/lib/SDL2_net.lib
sdl/lib/SDL2_net.lib: sdl/$(SDL_NET_PACKAGE)
-$(ECHO) 'Extracting package: $<'
$(MKDIR) sdl/lib sdl/include/SDL2
cd "$(<D)"; \
unzip -DD -qo "$(<F)"
$(MV) sdl/SDL2_net-*/include/* sdl/include/SDL2/
$(MV) sdl/SDL2_net-*/lib/x86/* sdl/lib/
-$(ECHO) 'Finished extracting: $<'
-$(ECHO) ' '
sdl/$(SDL_NET_PACKAGE):
-$(ECHO) 'Downloading package: $@'
$(MKDIR) "$(@D)"
curl -L -o "[email protected]" "$(SDL_NET_DOWNLOAD)"
unzip -qt "[email protected]"
$(MV) "[email protected]" "$@"
-$(ECHO) 'Finished downloading: $@'
-$(ECHO) ' '
endif
##################
ifneq (,$(findstring .tar.gz,$(SDL_MIXER_PACKAGE)))
libsdlmixer: sdl/lib/libSDL2_mixer.lib
sdl/lib/libSDL2_mixer.lib: sdl/$(SDL_MIXER_PACKAGE)
-$(ECHO) 'Extracting package: $<'
$(MKDIR) sdl/lib sdl/include/SDL2
cd "$(<D)"; \
tar -xzf "$(<F)"
$(MV) sdl/SDL2_mixer-*/$(ARCH)/include/SDL2/* sdl/include/SDL2/
$(CP) -r sdl/SDL2_mixer-*/$(ARCH)/lib/* sdl/lib/
$(CP) sdl/SDL2_mixer-*/$(ARCH)/bin/SDL2_mixer.dll sdl/for_final_package/
-$(ECHO) 'Finished extracting: $<'
-$(ECHO) ' '
sdl/$(SDL_MIXER_PACKAGE):
-$(ECHO) 'Downloading package: $@'
$(MKDIR) "$(@D)"
curl -L -o "[email protected]" "$(SDL_MIXER_DOWNLOAD)"
tar -tzf "[email protected]"
$(MV) "[email protected]" "$@"
-$(ECHO) 'Finished downloading: $@'
-$(ECHO) ' '
else
libsdlmixer: sdl/lib/SDL2_mixer.lib
sdl/lib/SDL2_mixer.lib: sdl/$(SDL_MIXER_PACKAGE)
-$(ECHO) 'Extracting package: $<'
$(MKDIR) sdl/lib sdl/include/SDL2
cd "$(<D)"; \
unzip -DD -qo "$(<F)"
$(MV) sdl/SDL2_mixer-*/include/* sdl/include/SDL2/
$(MV) sdl/SDL2_mixer-*/lib/x86/* sdl/lib/
-$(ECHO) 'Finished extracting: $<'
-$(ECHO) ' '
sdl/$(SDL_MIXER_PACKAGE):
-$(ECHO) 'Downloading package: $@'
$(MKDIR) "$(@D)"
curl -L -o "[email protected]" "$(SDL_MIXER_DOWNLOAD)"
unzip -qt "[email protected]"
$(MV) "[email protected]" "$@"
-$(ECHO) 'Finished downloading: $@'
-$(ECHO) ' '
endif
##################
ifneq (,$(findstring .tar.gz,$(SDL_IMAGE_PACKAGE)))
libsdlimage: sdl/lib/libSDL2_image.lib
sdl/lib/libSDL2_image.lib: sdl/$(SDL_IMAGE_PACKAGE)
-$(ECHO) 'Extracting package: $<'
$(MKDIR) sdl/lib sdl/include/SDL2
cd "$(<D)"; \
tar -xzf "$(<F)"
$(MV) sdl/SDL2_image-*/$(ARCH)/include/SDL2/* sdl/include/SDL2/
$(CP) -r sdl/SDL2_image-*/$(ARCH)/lib/* sdl/lib/
$(CP) sdl/SDL2_image-*/$(ARCH)/bin/SDL2_image.dll sdl/for_final_package/
-$(ECHO) 'Finished extracting: $<'
-$(ECHO) ' '
sdl/$(SDL_IMAGE_PACKAGE):
-$(ECHO) 'Downloading package: $@'
$(MKDIR) "$(@D)"
curl -L -o "[email protected]" "$(SDL_IMAGE_DOWNLOAD)"
tar -tzf "[email protected]"
$(MV) "[email protected]" "$@"
-$(ECHO) 'Finished downloading: $@'
-$(ECHO) ' '
else
libsdlimage: sdl/lib/SDL2_image.lib
sdl/lib/SDL2_image.lib: sdl/$(SDL_IMAGE_PACKAGE)
-$(ECHO) 'Extracting package: $<'
$(MKDIR) sdl/lib sdl/include/SDL2
cd "$(<D)"; \
unzip -DD -qo "$(<F)"
$(MV) sdl/SDL2_image-*/include/* sdl/include/SDL2/
$(MV) sdl/SDL2_image-*/lib/x86/* sdl/lib/
-$(ECHO) 'Finished extracting: $<'
-$(ECHO) ' '
sdl/$(SDL_IMAGE_PACKAGE):
-$(ECHO) 'Downloading package: $@'
$(MKDIR) "$(@D)"
curl -L -o "[email protected]" "$(SDL_IMAGE_DOWNLOAD)"
unzip -qt "[email protected]"
$(MV) "[email protected]" "$@"
-$(ECHO) 'Finished downloading: $@'
-$(ECHO) ' '
endif
clean-libsdl:
-$(RM) -R sdl/bin sdl/include sdl/lib sdl/share
deep-clean-libsdl:
-$(RM) -rf sdl
-$(MKDIR) sdl
#******************************************************************************