Repository navigation
Expand file tree
/
Copy pathlibexterns.mk
More file actions
111 lines (84 loc) · 3.18 KB
/
Copy pathlibexterns.mk
File metadata and controls
111 lines (84 loc) · 3.18 KB
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
#******************************************************************************
# 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
SDL_MAIN_LIBRARY = sdl/lib/libSDL3.dll.a
SDL_EXTENSION_LIBRARIES = \
sdl/lib/libSDL3_image.dll.a
include prebuilds.mk
.PHONY: clean-libsdl deep-clean-libsdl
.INTERMEDIATE: libsdl libsdlimage
libexterns: libsdl libsdlimage
touch libexterns
clean-libexterns: clean-libsdl
$(RM) libexterns
deep-clean-libexterns: deep-clean-libsdl
ifneq (,$(findstring .tar.gz,$(SDL_PACKAGE)))
libsdl: $(SDL_MAIN_LIBRARY)
# If we have tar gzip prebuild, download and extract it
$(SDL_MAIN_LIBRARY): sdl/$(SDL_PACKAGE)
-$(ECHO) 'Extracting package: $<'
cd "$(<D)"; \
tar --strip-components=2 -zxmUf "$(<F)" SDL3-3.4.18/i686-w64-mingw32/bin SDL3-3.4.18/i686-w64-mingw32/include SDL3-3.4.18/i686-w64-mingw32/lib SDL3-3.4.18/i686-w64-mingw32/share 2>&1 | \
sed '/^.*: Archive value .* is out of .* range.*$$/d'
$(CP) sdl/bin/SDL3.dll sdl/for_final_package/
-$(ECHO) 'Finished extracting: $<'
-$(ECHO) ' '
sdl/$(SDL_PACKAGE):
-$(ECHO) 'Downloading package: $@'
$(MKDIR) "$(@D)"
curl -L -o "$@.dl" "$(SDL_DOWNLOAD)"
tar -tzf "$@.dl" >/dev/null
$(MV) "$@.dl" "$@"
-$(ECHO) 'Finished downloading: $@'
-$(ECHO) ' '
else
$(error Cannot handle SDL library prebuild. You need to prepare the library manually.)
endif
##################
$(SDL_EXTENSION_LIBRARIES): | $(SDL_MAIN_LIBRARY)
ifneq (,$(findstring .tar.gz,$(SDL_IMAGE_PACKAGE)))
libsdlimage: sdl/lib/libSDL3_image.dll.a
sdl/lib/libSDL3_image.dll.a: sdl/$(SDL_IMAGE_PACKAGE)
-$(ECHO) 'Extracting package: $<'
$(MKDIR) sdl/lib sdl/include
cd "$(<D)"; \
tar -xzf "$(<F)"
$(CP) -r sdl/SDL3_image-*/$(ARCH)/include/* sdl/include/
$(CP) -r sdl/SDL3_image-*/$(ARCH)/lib/* sdl/lib/
$(CP) sdl/SDL3_image-*/$(ARCH)/bin/SDL3_image.dll sdl/for_final_package/
-$(ECHO) 'Finished extracting: $<'
-$(ECHO) ' '
sdl/$(SDL_IMAGE_PACKAGE):
-$(ECHO) 'Downloading package: $@'
$(MKDIR) "$(@D)"
curl -L -o "$@.dl" "$(SDL_IMAGE_DOWNLOAD)"
tar -tzf "$@.dl"
$(MV) "$@.dl" "$@"
-$(ECHO) 'Finished downloading: $@'
-$(ECHO) ' '
else
$(error Cannot handle SDL_image 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) -rf sdl
-$(MKDIR) sdl
#******************************************************************************