-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.extlibs
270 lines (221 loc) · 10.1 KB
/
Makefile.extlibs
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
# -*- makefile-gmake -*-
# Build rules for internal libraries.
# Do not invoke this directly; these rules are used automatically when relevant.
ifndef VERBOSE # use "make VERBOSE=true" to show outputs
REDIR = >/dev/null 2>&1
REDSO = >/dev/null
endif
EL = extlib/lib
EI = extlib/include
EB = extlib/bin
ES = extlib/src
SDLSRC = $(ES)/SDL-1.2.13
SDLISRC = $(ES)/SDL_image-1.2.6
ZSRC = $(ES)/zlib-1.2.3
PNGSRC = $(ES)/libpng-1.2.24
JPEGSRC = $(ES)/jpeg-6b
SDLMSRC = $(ES)/SDL_mixer-1.2.8
OGGSRC = $(ES)/libogg-1.1.3
VORBSRC = $(ES)/libvorbis-1.2.0
SMPGSRC = $(ES)/smpeg
BZSRC = $(ES)/bzip2-1.0.4
FTSRC = $(ES)/freetype-2.3.5
SDLTSRC = $(ES)/SDL_ttf-2.0.8
LPREFIX = $(shell pwd)/extlib
CLEAN_TARGETS=clean_sdl clean_sdl_image clean_sdl_mixer clean_bzip2 \
clean_smpeg clean_freetype clean_sdl_ttf
DISTCLEAN_TARGETS=dclean_sdl dclean_sdl_image dclean_sdl_mixer \
dclean_smpeg dclean_freetype dclean_sdl_ttf
#-- SDL -----------------------------------------------------------------------
.PHONY: clean_sdl dclean_sdl
internal_sdl = $(EB)/sdl-config
clean_sdl:
@if [ -f $(SDLSRC)/Makefile ]; then $(MAKE) -C $(SDLSRC) uninstall; fi
@if [ -f $(SDLSRC)/Makefile ]; then $(MAKE) -C $(SDLSRC) clean; fi
dclean_sdl: clean_sdl
@if [ -f $(SDLSRC)/Makefile ]; then $(MAKE) -C $(SDLSRC) distclean; fi
$(SDLSRC)/Makefile: $(if $(INTERNAL_LIBPNG),$(EL)/libpng$(LIBSUFFIX))
@echo Configuring internal SDL...
@cd $(SDLSRC) && \
./configure --prefix="$(LPREFIX)" $(SDLOTHERCONFIG) \
$(addprefix --disable-,shared joystick nas $(addprefix video-,fbcon directfb svga vgl wscons opengl)) \
$(REDIR)
$(EB)/sdl-config: $(SDLSRC)/Makefile
@echo Building internal SDL...
@$(MAKE) -C $(SDLSRC) $(REDSO)
@$(MAKE) -C $(SDLSRC) install $(REDSO)
@if [ -n "$(WIN32)" ]; then \
mv $@ $@.tmp; \
sed -e 's/\(-lmingw32 -lSDLmain.*\)$$/\1 -lwinmm/' $@.tmp > $@; \
rm $@.tmp; \
fi # Fix for annoying Windows breakage
#-- SDL_image -----------------------------------------------------------------
.PHONY: clean_sdl_image dclean_sdl_image
internal_sdl_image = $(EL)/libSDL_image$(LIBSUFFIX)
clean_sdl_image:
@-if [ -f $(SDLISRC)/Makefile ]; then $(MAKE) -C $(SDLISRC) uninstall; fi
@-if [ -f $(SDLISRC)/Makefile ]; then $(MAKE) -C $(SDLISRC) clean; fi
@-if [ -f $(EL)/libz$(LIBSUFFIX) ]; then $(MAKE) -C $(ZSRC) uninstall prefix="$(LPREFIX)"; fi
@-if [ -f $(ZSRC)/libz$(LIBSUFFIX) ]; then $(MAKE) -C $(ZSRC) clean; fi
@-if [ -f $(PNGSRC)/Makefile ]; then $(MAKE) -C $(PNGSRC) uninstall; fi
@-if [ -f $(PNGSRC)/Makefile ]; then $(MAKE) -C $(PNGSRC) clean; fi
@-if [ -f $(JPEGSRC)/Makefile ]; then \
rm -f $(EL)/libjpeg$(LIBSUFFIX) $(addprefix $(EI)/,jconfig.h jpeglib.h jmorecfg.h jerror.h); \
$(MAKE) -C $(JPEGSRC) clean; \
fi
dclean_sdl_image:
@-if [ -f $(SDLISRC)/Makefile ]; then $(MAKE) -C $(SDLISRC) distclean; fi
@-if [ -f $(PNGSRC)/Makefile ]; then $(MAKE) -C $(PNGSRC) distclean; fi
@-if [ -f $(JPEGSRC)/Makefile ]; then $(MAKE) -C $(JPEGSRC) distclean; fi
$(SDLISRC)/Makefile: $(if $(INTERNAL_SDL),$(EB)/sdl-config) \
$(if $(INTERNAL_LIBPNG),$(EL)/libpng$(LIBSUFFIX)) \
$(if $(INTERNAL_LIBJPEG),$(EL)/libjpeg$(LIBSUFFIX))
@echo Configuring internal SDL_image...
@cd $(SDLISRC) && \
./configure --prefix="$(LPREFIX)" $(OTHERCONFIG) \
$(addprefix --disable-,shared lbm pcx pnm tga xcf xv tif \
$(if $(INTERNAL_LIBPNG),png-shared) \
$(if $(INTERNAL_LIBJPEG),jpg-shared)) \
$(REDIR)
@if grep -q 'PNG image loading disabled' $(SDLISRC)/config.log; then \
echo "PNG error - check $(SDLISRC)/config.log for details"; \
rm Makefile; \
exit 1; \
fi
$(EL)/libSDL_image$(LIBSUFFIX): $(SDLISRC)/Makefile
@echo Building internal SDL_image...
@$(MAKE) -C $(SDLISRC) $(REDSO)
@$(MAKE) -C $(SDLISRC) install $(REDSO)
# First build libz, libpng, and libjpeg, if required.
internal_png = $(EL)/libpng$(LIBSUFFIX)
internal_jpeg = $(EL)/libjpeg$(LIBSUFFIX)
$(PNGSRC)/Makefile: $(EL)/libz$(LIBSUFFIX)
@echo Configuring internal libpng...
@cd $(PNGSRC) && \
./configure --prefix="$(LPREFIX)" --disable-shared --disable-dependency-tracking $(OTHERCONFIG) $(REDIR)
$(EL)/libpng$(LIBSUFFIX): $(PNGSRC)/Makefile
@echo Building internal libpng...
@$(MAKE) -C $(PNGSRC) $(REDSO)
@$(MAKE) -C $(PNGSRC) install $(REDSO)
$(EL)/libz$(LIBSUFFIX):
@echo Building internal zlib...
@$(MAKE) -C $(ZSRC) install prefix="$(LPREFIX)" $(REDSO)
$(JPEGSRC)/Makefile:
@echo Configuring internal libjpeg...
@cd $(JPEGSRC) && \
./configure --prefix="$(LPREFIX)" --disable-shared --enable-static $(OTHERCONFIG) $(REDIR)
$(EL)/libjpeg$(LIBSUFFIX): $(JPEGSRC)/Makefile
@echo Building internal libjpeg...
@$(MAKE) -C $(JPEGSRC) install-lib $(REDSO)
#-- SDL_mixer -----------------------------------------------------------------
OGGLIBS = $(EL)/libogg$(LIBSUFFIX) $(EL)/libvorbis$(LIBSUFFIX) $(EL)/libvorbisfile$(LIBSUFFIX)
.PHONY: clean_sdl_mixer dclean_sdl_mixer
internal_sdl_mixer = $(EL)/libSDL_mixer$(LIBSUFFIX)
clean_sdl_mixer:
@if [ -f $(SDLMSRC)/Makefile ]; then $(MAKE) -C $(SDLMSRC) uninstall; fi
@if [ -f $(VORBSRC)/Makefile ]; then $(MAKE) -C $(VORBSRC) uninstall; fi
@if [ -f $(OGGSRC)/Makefile ]; then $(MAKE) -C $(OGGSRC) uninstall; fi
@if [ -f $(SDLMSRC)/Makefile ]; then $(MAKE) -C $(SDLMSRC) clean; fi
@if [ -f $(VORBSRC)/Makefile ]; then $(MAKE) -C $(VORBSRC) clean; fi
@if [ -f $(OGGSRC)/Makefile ]; then $(MAKE) -C $(OGGSRC) clean; fi
dclean_sdl_mixer:
@if [ -f $(SDLMSRC)/Makefile ]; then $(MAKE) -C $(SDLMSRC) distclean; fi
@if [ -f $(VORBSRC)/Makefile ]; then $(MAKE) -C $(VORBSRC) distclean; fi
@if [ -f $(OGGSRC)/Makefile ]; then $(MAKE) -C $(OGGSRC) distclean; fi
$(SDLMSRC)/Makefile: $(if $(INTERNAL_SDL),$(EB)/sdl-config) \
$(if $(INTERNAL_SMPEG),$(EB)/smpeg-config) \
$(if $(INTERNAL_OGGLIBS),$(OGGLIBS))
@echo Configuring internal SDL_mixer...
@cd $(SDLMSRC) && \
./configure --prefix="$(LPREFIX)" $(SDL_MIXER_FLAGS) $(OTHERCONFIG) \
$(addprefix --disable-,shared $(addprefix music-,cmd timidity-midi)) \
$(REDIR)
$(EL)/libSDL_mixer$(LIBSUFFIX): $(SDLMSRC)/Makefile
@echo Building internal SDL_mixer...
@$(MAKE) -C $(SDLMSRC) $(REDSO)
@$(MAKE) -C $(SDLMSRC) install $(REDSO)
# First build Ogg libs, if required.
internal_ogglibs = $(OGGLIBS)
$(OGGSRC)/Makefile:
@echo Configuring internal libogg...
@cd $(OGGSRC) && \
./configure --prefix="$(LPREFIX)" --disable-shared --disable-dependency-tracking $(OTHERCONFIG) $(REDIR)
$(EL)/libogg$(LIBSUFFIX): $(OGGSRC)/Makefile
@echo Building internal libogg...
@$(MAKE) -C $(OGGSRC) $(REDSO)
@$(MAKE) -C $(OGGSRC) install $(REDSO)
$(VORBSRC)/Makefile:
@echo Configuring internal libvorbis...
@cd $(VORBSRC) && \
./configure --prefix="$(LPREFIX)" $(addprefix --disable-,shared dependency-tracking docs) $(OTHERCONFIG) $(REDIR)
$(EL)/libvorbisfile$(LIBSUFFIX): $(EL)/libvorbis$(LIBSUFFIX)
$(EL)/libvorbis$(LIBSUFFIX): $(EL)/libogg$(LIBSUFFIX) $(VORBSRC)/Makefile
@echo Building internal libvorbis...
@$(MAKE) -C $(VORBSRC) $(REDSO)
@$(MAKE) -C $(VORBSRC) install $(REDSO)
#-- SMPEG ---------------------------------------------------------------------
.PHONY: clean_smpeg dclean_smpeg
internal_smpeg = $(EB)/smpeg-config
clean_smpeg:
@-if [ -f $(SMPGSRC)/Makefile ]; then $(MAKE) -C $(SMPGSRC) uninstall; fi
@-if [ -f $(SMPGSRC)/Makefile ]; then $(MAKE) -C $(SMPGSRC) clean; fi
dclean_smpeg: clean_smpeg
@-if [ -f $(SMPGSRC)/Makefile ]; then $(MAKE) -C $(SMPGSRC) distclean; fi
$(SMPGSRC)/Makefile: $(if $(INTERNAL_SDL),$(EB)/sdl-config)
@echo Configuring internal smpeg...
@cd $(SMPGSRC) && \
./configure --prefix="$(LPREFIX)" $(OTHERCONFIG) \
$(addprefix --disable-,shared gtk-player opengl-player debug) \
$(REDIR)
$(EB)/smpeg-config: $(SMPGSRC)/Makefile
@echo Building internal smpeg...
@$(MAKE) -C $(SMPGSRC) $(REDSO)
@$(MAKE) -C $(SMPGSRC) prefix="$(LPREFIX)" install $(REDSO)
#-- Freetype ------------------------------------------------------------------
FTCONFIGURE = $(FTSRC)/builds/unix/config.status
.PHONY: clean_freetype dclean_freetype
internal_freetype = $(EB)/freetype-config
clean_freetype:
@-if [ -f $(FTCONFIGURE) ]; then $(MAKE) -C $(FTSRC) uninstall; fi
@-if [ -f $(FTCONFIGURE) ]; then $(MAKE) -C $(FTSRC) clean; fi
dclean_freetype:
@-if [ -f $(FTCONFIGURE) ]; then $(MAKE) -C $(FTSRC) distclean; fi
$(FTCONFIGURE): $(if $(INTERNAL_LIBPNG),$(EL)/libz$(LIBSUFFIX))
@echo Configuring internal Freetype...
@cd $(FTSRC) && \
./configure --prefix="$(LPREFIX)" --disable-shared $(OTHERCONFIG) $(REDIR)
$(EB)/freetype-config: $(FTCONFIGURE)
@echo Building internal Freetype...
@$(MAKE) -C $(FTSRC) $(REDSO)
@$(MAKE) -C $(FTSRC) install $(REDSO)
#-- SDL_ttf -------------------------------------------------------------------
.PHONY: clean_sdl_ttf dclean_sdl_ttf
internal_sdl_ttf = $(EL)/libSDL_ttf$(LIBSUFFIX)
clean_sdl_ttf:
@if [ -f $(SDLTSRC)/Makefile ]; then $(MAKE) -C $(SDLTSRC) uninstall; fi
@if [ -f $(SDLTSRC)/Makefile ]; then $(MAKE) -C $(SDLTSRC) clean; fi
dclean_sdl_ttf: clean_sdl_ttf
@if [ -f $(SDLTSRC)/Makefile ]; then $(MAKE) -C $(SDLTSRC) distclean; fi
$(SDLTSRC)/Makefile: $(if $(INTERNAL_SDL),$(EB)/sdl-config) $(if $(INTERNAL_FREETYPE),$(EB)/freetype-config)
@echo Configuring internal SDL_ttf...
@cd $(SDLTSRC) && \
./configure --prefix="$(LPREFIX)" --disable-shared $(OTHERCONFIG) $(REDIR)
$(EL)/libSDL_ttf$(LIBSUFFIX): $(SDLTSRC)/Makefile
@echo Building internal SDL_ttf...
@$(MAKE) -C $(SDLTSRC) $(REDSO)
@$(MAKE) -C $(SDLTSRC) install $(REDSO)
#-- libbzip2 ------------------------------------------------------------------
BZOBJS = blocksort huffman crctable randtable compress decompress bzlib
.PHONY: clean_bzip2
internal_bzip2 = $(EL)/libbz2$(LIBSUFFIX) $(EI)/bzlib.h
clean_bzip2:
rm -f $(EL)/libbz2$(LIBSUFFIX) $(EI)/bzlib.h $(BZSRC)/*$(OBJSUFFIX)
$(EL)/libbz2$(LIBSUFFIX): $(foreach fn,$(BZOBJS),$(BZSRC)/$(fn)$(OBJSUFFIX))
rm -f $@
$(AR) cq $@ $^
@if [ -f "$(RANLIB)" -o -f /usr/bin/ranlib -o \
-f /bin/ranlib -o -f /usr/ccs/bin/ranlib ]; then \
$(if $(RANLIB),$(RANLIB),ranlib) $@ ; \
fi
$(EI)/bzlib.h: $(BZSRC)/bzlib.h
cp $< $@