-
Notifications
You must be signed in to change notification settings - Fork 10
/
libexterns.mk
124 lines (96 loc) · 3.48 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
#******************************************************************************
# 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.
#
#******************************************************************************
.PHONY: clean-libsdl deep-clean-libsdl
libexterns: libsdl libsdlnet libsdlmixer
clean-libexterns: clean-libsdl
deep-clean-libexterns: deep-clean-libsdl
ifneq (,$(findstring .tar.gz,$(SDL_PACKAGE)))
libsdl: sdl/lib/libSDLmain.a
# If we have tar gzip prebuild, download and extract it
sdl/lib/libSDLmain.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=1 -zxmUf "$(<F)" --no-anchored bin include lib share 2>&1 | \
grep -v '^.*: Archive value .* is out of .* range.*$$'
-$(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 .zip,$(SDL_NET_PACKAGE)))
libsdlnet: sdl/lib/SDL_net.lib
sdl/lib/SDL_net.lib: sdl/$(SDL_NET_PACKAGE)
-$(ECHO) 'Extracting package: $<'
$(MKDIR) sdl/lib sdl/include/SDL
cd "$(<D)"; \
unzip -DD -qo "$(<F)"
$(MV) sdl/SDL_net-*/include/* sdl/include/SDL/
$(MV) sdl/SDL_net-*/lib/* 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) ' '
else
$(error Cannot handle SDL_net library prebuild. You need to prepare the library manually.)
endif
ifneq (,$(findstring .zip,$(SDL_MIXER_PACKAGE)))
libsdlmixer: sdl/lib/SDL_mixer.lib
sdl/lib/SDL_mixer.lib: sdl/$(SDL_MIXER_PACKAGE)
-$(ECHO) 'Extracting package: $<'
$(MKDIR) sdl/lib sdl/include/SDL
cd "$(<D)"; \
unzip -DD -qo "$(<F)"
$(MV) sdl/SDL_mixer-*/include/* sdl/include/SDL/
$(MV) sdl/SDL_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) ' '
else
$(error Cannot handle SDL_mixer library prebuild. You need to prepare the library manually.)
endif
clean-libsdl:
-$(RM) -R sdl/bin sdl/include sdl/lib sdl/share
deep-clean-libsdl:
-$(RM) sdl/$(SDL_PACKAGE)
-$(RM) sdl/$(SDL_NET_PACKAGE)
-$(RM) sdl/$(SDL_MIXER_PACKAGE)
#******************************************************************************