Makethird 16.1 KB
Newer Older
1 2 3
# GNU Makefile for third party libraries used by MuPDF
#
# If thirdparty libraries are supplied, they will be built as
4 5 6 7 8 9
# static libraries.
#
# Use 'git submodule init' and 'git submodule update' to check
# out the thirdparty libraries from git.

FREETYPE_DIR := thirdparty/freetype
10
HARFBUZZ_DIR := thirdparty/harfbuzz
11
JBIG2DEC_DIR := thirdparty/jbig2dec
12
JPEGXR_DIR := thirdparty/jpegxr
13
LCMS2_DIR := thirdparty/lcms2
14 15
LIBJPEG_DIR := thirdparty/libjpeg
LURATECH_DIR := thirdparty/luratech
16
MUJS_DIR := thirdparty/mujs
17
OPENJPEG_DIR := thirdparty/openjpeg/src/lib/openjp2
18
ZLIB_DIR := thirdparty/zlib
19

20
CURL_DIR := thirdparty/curl
21
GLUT_DIR := thirdparty/freeglut
22 23 24 25 26

# --- MuJS ---

ifneq "$(wildcard $(MUJS_DIR)/README)" ""

27
MUJS_OUT := $(OUT)/thirdparty/mujs
28 29
MUJS_SRC := one.c

30 31 32 33
MUJS_OBJ := $(addprefix $(MUJS_OUT)/, $(MUJS_SRC:%.c=%.o))

$(MUJS_OUT)/one.o: $(wildcard $(MUJS_DIR)/js*.c $(MUJS_DIR)/utf*.c $(MUJS_DIR)/regex.c $(MUJS_DIR)/*.h)

34 35 36 37 38 39 40
$(MUJS_OUT):
	$(MKDIR_CMD)
$(MUJS_OUT)/%.o: $(MUJS_DIR)/%.c | $(MUJS_OUT)
	$(CC_CMD)

MUJS_CFLAGS := -I$(MUJS_DIR)

41 42 43 44
else

MUJS_CFLAGS := -DFZ_ENABLE_JS=0

45
endif
46

47
# --- FreeType 2 ---
Tor Andersson's avatar
Tor Andersson committed
48

49
ifneq "$(wildcard $(FREETYPE_DIR)/README)" ""
50

51
FREETYPE_OUT := $(OUT)/thirdparty/freetype
52 53 54 55
FREETYPE_SRC := \
	ftbase.c \
	ftbbox.c \
	ftbitmap.c \
56
	ftdebug.c \
57
	ftfntfmt.c \
58 59 60 61 62 63 64 65 66
	ftgasp.c \
	ftglyph.c \
	ftinit.c \
	ftstroke.c \
	ftsynth.c \
	ftsystem.c \
	fttype1.c \
	cff.c \
	psaux.c \
67
	pshinter.c \
68
	psnames.c \
Robin Watts's avatar
Robin Watts committed
69
	raster.c \
70 71 72 73 74 75
	sfnt.c \
	smooth.c \
	truetype.c \
	type1.c \
	type1cid.c \

76
FREETYPE_OBJ := $(addprefix $(FREETYPE_OUT)/, $(FREETYPE_SRC:%.c=%.o))
77 78 79

$(FREETYPE_OUT):
	$(MKDIR_CMD)
80 81

FT_CFLAGS := -DFT2_BUILD_LIBRARY -DDARWIN_NO_CARBON \
Tor Andersson's avatar
Tor Andersson committed
82 83 84
	'-DFT_CONFIG_MODULES_H="slimftmodules.h"' \
	'-DFT_CONFIG_OPTIONS_H="slimftoptions.h"'

85
$(FREETYPE_OUT)/%.o: $(FREETYPE_DIR)/src/base/%.c	| $(FREETYPE_OUT)
86
	$(CC_CMD) $(FT_CFLAGS)
87
$(FREETYPE_OUT)/%.o: $(FREETYPE_DIR)/src/cff/%.c	| $(FREETYPE_OUT)
88
	$(CC_CMD) $(FT_CFLAGS)
89
$(FREETYPE_OUT)/%.o: $(FREETYPE_DIR)/src/cid/%.c	| $(FREETYPE_OUT)
90
	$(CC_CMD) $(FT_CFLAGS)
91
$(FREETYPE_OUT)/%.o: $(FREETYPE_DIR)/src/psaux/%.c	| $(FREETYPE_OUT)
92
	$(CC_CMD) $(FT_CFLAGS)
93
$(FREETYPE_OUT)/%.o: $(FREETYPE_DIR)/src/pshinter/%.c	| $(FREETYPE_OUT)
94
	$(CC_CMD) $(FT_CFLAGS)
95
$(FREETYPE_OUT)/%.o: $(FREETYPE_DIR)/src/psnames/%.c	| $(FREETYPE_OUT)
96
	$(CC_CMD) $(FT_CFLAGS)
97
$(FREETYPE_OUT)/%.o: $(FREETYPE_DIR)/src/raster/%.c	| $(FREETYPE_OUT)
Robin Watts's avatar
Robin Watts committed
98
	$(CC_CMD) $(FT_CFLAGS)
99
$(FREETYPE_OUT)/%.o: $(FREETYPE_DIR)/src/smooth/%.c	| $(FREETYPE_OUT)
100
	$(CC_CMD) $(FT_CFLAGS)
101
$(FREETYPE_OUT)/%.o: $(FREETYPE_DIR)/src/sfnt/%.c	| $(FREETYPE_OUT)
102
	$(CC_CMD) $(FT_CFLAGS)
103
$(FREETYPE_OUT)/%.o: $(FREETYPE_DIR)/src/truetype/%.c	| $(FREETYPE_OUT)
104
	$(CC_CMD) $(FT_CFLAGS)
105
$(FREETYPE_OUT)/%.o: $(FREETYPE_DIR)/src/type1/%.c	| $(FREETYPE_OUT)
106 107
	$(CC_CMD) $(FT_CFLAGS)

108
FREETYPE_CFLAGS := -Iscripts/freetype -I$(FREETYPE_DIR)/include
109
else
110 111
FREETYPE_CFLAGS := $(SYS_FREETYPE_CFLAGS)
FREETYPE_LIBS := $(SYS_FREETYPE_LIBS)
Tor Andersson's avatar
Tor Andersson committed
112 113
endif

114 115 116 117
# --- HarfBuzz ---

ifneq "$(wildcard $(HARFBUZZ_DIR)/README)" ""

118
HARFBUZZ_OUT := $(OUT)/thirdparty/harfbuzz
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
HARFBUZZ_SRC := \
	hb-blob.cc \
	hb-buffer.cc \
	hb-buffer-serialize.cc \
	hb-common.cc \
	hb-face.cc \
	hb-fallback-shape.cc \
	hb-font.cc \
	hb-ft.cc \
	hb-ot-font.cc \
	hb-ot-layout.cc \
	hb-ot-map.cc \
	hb-ot-shape-complex-arabic.cc \
	hb-ot-shape-complex-default.cc \
	hb-ot-shape-complex-hangul.cc \
	hb-ot-shape-complex-hebrew.cc \
	hb-ot-shape-complex-indic-table.cc \
	hb-ot-shape-complex-indic.cc \
	hb-ot-shape-complex-myanmar.cc \
	hb-ot-shape-complex-thai.cc \
	hb-ot-shape-complex-tibetan.cc \
	hb-ot-shape-complex-use-table.cc \
	hb-ot-shape-complex-use.cc \
	hb-ot-shape-fallback.cc \
	hb-ot-shape-normalize.cc \
	hb-ot-shape.cc \
	hb-ot-tag.cc \
	hb-set.cc \
	hb-shape-plan.cc \
	hb-shape.cc \
	hb-shaper.cc \
	hb-ucdn.cc \
	hb-unicode.cc \
	hb-warning.cc

#	hb-coretext.cc
#	hb-directwrite.cc
#	hb-glib.cc
#	hb-gobject-structs.cc
#	hb-graphite2.cc
#	hb-icu.cc
#	hb-uniscribe.cc

HARFBUZZ_OBJ := $(addprefix $(HARFBUZZ_OUT)/, $(HARFBUZZ_SRC:%.cc=%.o))

$(HARFBUZZ_OUT):
	$(MKDIR_CMD)
$(HARFBUZZ_OUT)/%.o: $(HARFBUZZ_DIR)/src/%.cc | $(HARFBUZZ_OUT)
	$(CC_CMD) -DHAVE_OT -DHAVE_UCDN -DHB_NO_MT $(FREETYPE_CFLAGS) \
168 169
		-Dhb_malloc_impl=fz_hb_malloc -Dhb_calloc_impl=fz_hb_calloc \
		-Dhb_free_impl=fz_hb_free -Dhb_realloc_impl=fz_hb_realloc \
170 171 172 173 174 175 176 177
		-fno-rtti -fno-exceptions -fvisibility-inlines-hidden --std=c++0x

HARFBUZZ_CFLAGS := -I$(HARFBUZZ_DIR)/src
else
HARFBUZZ_CFLAGS := $(SYS_HARFBUZZ_CFLAGS)
HARFBUZZ_LIBS := $(SYS_HARFBUZZ_LIBS)
endif

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 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336
# --- LURATECH ---

ifneq "$(wildcard $(LURATECH_DIR)/ldf_jb2)$(wildcard $(LURATECH_DIR)/lwf_jp2)" ""

LURATECH_OUT := $(OUT)/thirdparty/luratech
LURATECH_SRC := \
	jb2_adt_cache.c \
	jb2_adt_decoder_halftone_region.c \
	jb2_adt_encoder_text_region.c \
	jb2_adt_huffman_tree.c \
	jb2_adt_symbol_instance.c \
	jb2_adt_context_ref_encoder.c \
	jb2_adt_context_ref_buffer.c \
	jb2_adt_context_ref_encoder.c \
	jb2_adt_mq_encoder.c \
	jb2_adt_decoder_text_region.c \
	jb2_adt_huffman_table_user_defined.c \
	jb2_adt_mmr_tables.c \
	jb2_adt_huffman_table_symbol.c \
	jb2_adt_component.c \
	jb2_adt_context_buffer.c \
	jb2_adt_context_decoder.c \
	jb2_adt_context_encoder.c \
	jb2_adt_context_ref_decoder.c \
	jb2_adt_decoder_collective_bitmap.c \
	jb2_adt_decoder_generic_region.c \
	jb2_adt_decoder_pattern_dict.c \
	jb2_adt_decoder_symbol_dict.c \
	jb2_adt_encoder_symbol_dict.c \
	jb2_adt_external_cache.c \
	jb2_adt_file.c \
	jb2_adt_file_extras.c \
	jb2_adt_handle_document.c \
	jb2_adt_huffman_decoder.c \
	jb2_adt_huffman_encoder.c \
	jb2_adt_huffman_table.c \
	jb2_adt_huffman_table_standard.c \
	jb2_adt_location.c \
	jb2_adt_memory.c \
	jb2_adt_message.c \
	jb2_adt_mmr_decoder.c \
	jb2_adt_mq_decoder.c \
	jb2_adt_mq_encoder.c \
	jb2_adt_mq_state.c \
	jb2_adt_pattern_dict.c \
	jb2_adt_pdf_file.c \
	jb2_adt_pdf_stream.c \
	jb2_adt_props_decompress.c \
	jb2_adt_read_bit_buffer.c \
	jb2_adt_read_data.c \
	jb2_adt_render_common.c \
	jb2_adt_render_generic_region.c \
	jb2_adt_render_halftone_region.c \
	jb2_adt_render_text_region.c \
	jb2_adt_run_array.c \
	jb2_adt_segment_array.c \
	jb2_adt_segment.c \
	jb2_adt_segment_end_of_stripe.c \
	jb2_adt_segment_generic_region.c \
	jb2_adt_segment_halftone_region.c \
	jb2_adt_segment_page_info.c \
	jb2_adt_segment_pattern_dict.c \
	jb2_adt_segment_region.c \
	jb2_adt_segment_symbol_dict.c \
	jb2_adt_segment_table.c \
	jb2_adt_segment_text_region.c \
	jb2_adt_segment_types.c \
	jb2_adt_stack.c \
	jb2_adt_symbol.c \
	jb2_adt_symbol_dict.c \
	jb2_adt_symbol_unify.c \
	jb2_adt_write_bits.c \
	jb2_adt_write_data.c \
	jb2_adt_write_pdf.c \
	jb2_common.c \
	jb2_license_dummy.c \
	jp2_adt_band_array.c \
	jp2_adt_band_buffer.c \
	jp2_adt_block_array.c \
	jp2_adt_cache.c \
	jp2_adt_comp.c \
	jp2_adt_component_array.c \
	jp2_adt_decomp.c \
	jp2_adt_ebcot_decoder.c \
	jp2_adt_external_cache.c \
	jp2_adt_image.c \
	jp2_adt_memory.c \
	jp2_adt_mq_decoder.c \
	jp2_adt_mq_state.c \
	jp2_adt_packet_decoder.c \
	jp2_adt_precinct_array.c \
	jp2_adt_rate.c \
	jp2_adt_rate_list.c \
	jp2_adt_read_bits.c \
	jp2_adt_read_data.c \
	jp2_adt_reader_requirements.c \
	jp2_adt_resolution_array.c \
	jp2_adt_tile_array.c \
	jp2_adt_tlm_marker_array.c \
	jp2_adt_write_data.c \
	jp2_buffer.c \
	jp2c_code_cb.c \
	jp2c_coder.c \
	jp2c_codestream.c \
	jp2c_file_format.c \
	jp2c_format.c \
	jp2c_memory.c \
	jp2_code_cb.c \
	jp2_common.c \
	jp2c_progression.c \
	jp2c_quant.c \
	jp2c_wavelet.c \
	jp2c_wavelet_lifting.c \
	jp2c_weights.c \
	jp2c_write.c \
	jp2d_codestream.c \
	jp2d_decoder.c \
	jp2d_file_format.c \
	jp2d_format.c \
	jp2d_image.c \
	jp2d_memory.c \
	jp2d_partial_decoding.c \
	jp2d_progression.c \
	jp2d_quant.c \
	jp2d_scale.c \
	jp2d_wavelet.c \
	jp2d_wavelet_lifting.c \
	jp2d_write.c \
	jp2_icc.c \
	jp2_license.c \
	jp2_packet.c \
	jp2_tag_tree.c

LURATECH_OBJ := $(addprefix $(LURATECH_OUT)/, $(LURATECH_SRC:%.c=%.o))

$(LURATECH_OUT):
	$(MKDIR_CMD)
$(LURATECH_OUT)/%.o: $(LURATECH_DIR)/ldf_jb2/source/common/%.c | $(LURATECH_OUT)
	$(CC_CMD) \
		-I$(LURATECH_DIR)/ldf_jb2/source/common \
		-DLINUX
$(LURATECH_OUT)/%.o: $(LURATECH_DIR)/ldf_jb2/source/compress/%.c | $(LURATECH_OUT)
	$(CC_CMD) \
		-I$(LURATECH_DIR)/ldf_jb2/source/common \
		-DLINUX
$(LURATECH_OUT)/%.o: $(LURATECH_DIR)/lwf_jp2/library/source/%.c | $(LURATECH_OUT)
	$(CC_CMD) \
		-I$(LURATECH_DIR)/ldf_jb2/source/common \
		-DLINUX

LURATECH_CFLAGS := \
-I$(LURATECH_DIR)/ldf_jb2/source/common \
	-I$(LURATECH_DIR)/ldf_jb2/source/libraries \
	-I$(LURATECH_DIR)/ldf_jb2/source/compress \
	-I$(LURATECH_DIR)/lwf_jp2/library/source \
	-DHAVE_LURATECH

else # --- LURATECH ---

337
# --- JBIG2DEC ---
338

339
ifneq "$(wildcard $(JBIG2DEC_DIR)/README)" ""
340

341
JBIG2DEC_OUT := $(OUT)/thirdparty/jbig2dec
342
JBIG2DEC_SRC := \
343 344 345
	jbig2.c \
	jbig2_arith.c \
	jbig2_arith_iaid.c \
346 347
	jbig2_arith_int.c \
	jbig2_generic.c \
348
	jbig2_halftone.c \
349
	jbig2_huffman.c \
350 351 352
	jbig2_image.c \
	jbig2_metadata.c \
	jbig2_mmr.c \
353
	jbig2_page.c \
354 355
	jbig2_refinement.c \
	jbig2_segment.c \
356
	jbig2_symbol_dict.c \
357
	jbig2_text.c
358

359 360
JBIG2DEC_OBJ := $(addprefix $(JBIG2DEC_OUT)/, $(JBIG2DEC_SRC:%.c=%.o))

361 362 363
$(JBIG2DEC_OUT):
	$(MKDIR_CMD)
$(JBIG2DEC_OUT)/%.o: $(JBIG2DEC_DIR)/%.c | $(JBIG2DEC_OUT)
364
	$(CC_CMD) -DHAVE_STDINT_H -DJBIG_EXTERNAL_MEMENTO_H=\"mupdf/memento.h\"
365 366 367 368 369

JBIG2DEC_CFLAGS := -I$(JBIG2DEC_DIR)
else
JBIG2DEC_CFLAGS := $(SYS_JBIG2DEC_CFLAGS)
JBIG2DEC_LIBS := $(SYS_JBIG2DEC_LIBS)
370 371
endif

372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417
# --- OpenJPEG ---

ifneq "$(wildcard $(OPENJPEG_DIR)/openjpeg.h)" ""

OPENJPEG_OUT := $(OUT)/thirdparty/openjpeg
OPENJPEG_SRC := \
	bio.c \
	cidx_manager.c \
	cio.c \
	dwt.c \
	event.c \
	function_list.c \
	image.c \
	invert.c \
	j2k.c \
	jp2.c \
	mct.c \
	mqc.c \
	openjpeg.c \
	phix_manager.c \
	pi.c \
	ppix_manager.c \
	raw.c \
	t1.c \
	t2.c \
	tcd.c \
	tgt.c \
	thix_manager.c \
	tpix_manager.c \
	thread.c

OPENJPEG_OBJ := $(addprefix $(OPENJPEG_OUT)/, $(OPENJPEG_SRC:%.c=%.o))

$(OPENJPEG_OUT):
	$(MKDIR_CMD)
$(OPENJPEG_OUT)/%.o: $(OPENJPEG_DIR)/%.c | $(OPENJPEG_OUT)
	$(CC_CMD) -DOPJ_STATIC -DOPJ_HAVE_STDINT_H -DOPJ_HAVE_INTTYPES_H -DUSE_JPIP

OPENJPEG_CFLAGS += -I$(OPENJPEG_DIR)
else
OPENJPEG_CFLAGS := $(SYS_OPENJPEG_CFLAGS)
OPENJPEG_LIBS := $(SYS_OPENJPEG_LIBS)
endif

endif # --- LURATECH ---

418
# --- JPEG library from IJG ---
419

420
ifneq "$(wildcard $(LIBJPEG_DIR)/README)" ""
421

422 423
LIBJPEG_OUT := $(OUT)/thirdparty/libjpeg
LIBJPEG_SRC := \
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449
	jaricom.c \
	jcomapi.c \
	jdapimin.c \
	jdapistd.c \
	jdarith.c \
	jdatadst.c \
	jdatasrc.c \
	jdcoefct.c \
	jdcolor.c \
	jddctmgr.c \
	jdhuff.c \
	jdinput.c \
	jdmainct.c \
	jdmarker.c \
	jdmaster.c \
	jdmerge.c \
	jdpostct.c \
	jdsample.c \
	jdtrans.c \
	jerror.c \
	jfdctflt.c \
	jfdctfst.c \
	jfdctint.c \
	jidctflt.c \
	jidctfst.c \
	jidctint.c \
450
	jmemmgr.c \
451 452 453
	jquant1.c \
	jquant2.c \
	jutils.c \
454

455
LIBJPEG_OBJ := $(addprefix $(LIBJPEG_OUT)/, $(LIBJPEG_SRC:%.c=%.o))
456

457
$(LIBJPEG_OUT):
458
	$(MKDIR_CMD)
459
$(LIBJPEG_OUT)/%.o: $(LIBJPEG_DIR)/%.c | $(LIBJPEG_OUT)
460
	$(CC_CMD) -Dmain=xxxmain
461

462
LIBJPEG_CFLAGS := -Iscripts/libjpeg -I$(LIBJPEG_DIR)
463
else
464 465
LIBJPEG_CFLAGS := $(SYS_LIBJPEG_CFLAGS) -DSHARE_JPEG
LIBJPEG_LIBS := $(SYS_LIBJPEG_LIBS)
466 467
endif

468
# --- jpegxr ---
Tor Andersson's avatar
Tor Andersson committed
469

470
ifneq "$(wildcard $(JPEGXR_DIR)/T835E.pdf)" ""
471

472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490
JPEGXR_OUT := $(OUT)/thirdparty/jpegxr
JPEGXR_SRC := \
	algo.c \
	api.c \
	flags.c \
	init.c \
	io.c \
	cr_parse.c \
	jpegxr_pixelformat.c \
	r_parse.c \
	r_strip.c \
	r_tile_spatial.c \
	r_tile_frequency.c \
	x_strip.c

JPEGXR_OBJ := $(addprefix $(JPEGXR_OUT)/, $(JPEGXR_SRC:%.c=%.o))

$(JPEGXR_OUT):
	$(MKDIR_CMD)
Tor Andersson's avatar
Tor Andersson committed
491

492 493
$(JPEGXR_OUT)/%.o: $(JPEGXR_DIR)/Software/%.c | $(JPEGXR_OUT)
	$(CC_CMD) $(JPEGXR_CFLAGS)
494

495 496 497 498
JPEGXR_CFLAGS := \
	-I$(JPEGXR_DIR) \
	-I$(JPEGXR_DIR)/Software \
	-DHAVE_JPEGXR
499

Tor Andersson's avatar
Tor Andersson committed
500 501
endif

502
# --- ZLIB ---
503

504
ifneq "$(wildcard $(ZLIB_DIR)/README)" ""
505

506
ZLIB_OUT := $(OUT)/thirdparty/zlib
507
ZLIB_SRC := \
508 509 510 511 512 513 514 515 516
	adler32.c \
	compress.c \
	crc32.c \
	deflate.c \
	inffast.c \
	inflate.c \
	inftrees.c \
	trees.c \
	uncompr.c \
517
	zutil.c \
518 519 520 521 522 523
	gzlib.c \
	gzwrite.c \
	gzclose.c \
	gzread.c \

ZLIB_OBJ := $(addprefix $(ZLIB_OUT)/, $(ZLIB_SRC:%.c=%.o))
524

525 526 527
$(ZLIB_OUT):
	$(MKDIR_CMD)
$(ZLIB_OUT)/%.o: $(ZLIB_DIR)/%.c | $(ZLIB_OUT)
528
	$(CC_CMD) -Dverbose=-1 -DHAVE_UNISTD_H -DHAVE_STDARG_H
529 530 531 532 533

ZLIB_CFLAGS := -I$(ZLIB_DIR)
else
ZLIB_CFLAGS := $(SYS_ZLIB_CFLAGS)
ZLIB_LIBS := $(SYS_ZLIB_LIBS)
534
endif
Tor Andersson's avatar
Tor Andersson committed
535

536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580
# --- LCMS2 ---

ifneq "$(wildcard $(LCMS2_DIR)/INSTALL)" ""

LCMS2_OUT := $(OUT)/lcms2
LCMS2_SRC := \
	cmsalpha.c \
	cmscam02.c \
	cmscgats.c \
	cmscnvrt.c \
	cmserr.c \
	cmsgamma.c \
	cmsgmt.c \
	cmshalf.c \
	cmsintrp.c \
	cmsio0.c \
	cmsio1.c \
	cmslut.c \
	cmsmd5.c \
	cmsmtrx.c \
	cmsnamed.c \
	cmsopt.c \
	cmspack.c \
	cmspcs.c \
	cmsplugin.c \
	cmsps2.c \
	cmssamp.c \
	cmssm.c \
	cmstypes.c \
	cmsvirt.c \
	cmswtpnt.c \
	cmsxform.c \

LCMS2_OBJ := $(addprefix $(LCMS2_OUT)/, $(LCMS2_SRC:%.c=%.o))

$(LCMS2_OUT):
	$(MKDIR_CMD)
$(LCMS2_OUT)/%.o: $(LCMS2_DIR)/src/%.c | $(LCMS2_OUT)
	$(CC_CMD) -I$(LCMS2_DIR)/include

LCMS2_CFLAGS := -I$(LCMS2_DIR)/include
else
LCMS2_CFLAGS := -DNO_ICC
endif

Robin Watts's avatar
Robin Watts committed
581 582 583 584 585
# --- cURL ---

ifneq "$(wildcard $(CURL_DIR)/README)" ""

CURL_LIB := $(OUT)/libcurl.a
586
CURL_OUT := $(OUT)/thirdparty/curl
Robin Watts's avatar
Robin Watts committed
587 588 589 590 591 592
CURL_SRC := \
	base64.c \
	conncache.c \
	connect.c \
	content_encoding.c \
	curl_addrinfo.c \
593
	dotdot.c \
Robin Watts's avatar
Robin Watts committed
594 595 596 597 598 599 600 601 602
	easy.c \
	escape.c \
	fileinfo.c \
	formdata.c \
	getenv.c \
	getinfo.c \
	hash.c \
	hostcheck.c \
	hostip4.c \
603
	hostip.c \
Robin Watts's avatar
Robin Watts committed
604 605 606 607 608 609 610 611 612
	hostsyn.c \
	http.c \
	http_chunks.c \
	if2ip.c \
	llist.c \
	mprintf.c \
	multi.c \
	netrc.c \
	nonblock.c \
613
	openssl.c \
Robin Watts's avatar
Robin Watts committed
614 615 616 617 618 619 620 621 622
	parsedate.c \
	pipeline.c \
	progress.c \
	select.c \
	sendf.c \
	share.c \
	slist.c \
	speedcheck.c \
	splay.c \
623
	strcase.c \
Robin Watts's avatar
Robin Watts committed
624 625 626 627 628 629
	strdup.c \
	strerror.c \
	timeval.c \
	transfer.c \
	url.c \
	version.c \
630
	vtls.c \
Robin Watts's avatar
Robin Watts committed
631
	warnless.c \
632
	wildcard.c
Robin Watts's avatar
Robin Watts committed
633 634 635 636 637 638 639

$(CURL_LIB): $(addprefix $(CURL_OUT)/, $(CURL_SRC:%.c=%.o))

$(CURL_OUT):
	$(MKDIR_CMD)

CRL_CFLAGS := -DHAVE_CONFIG_H -DBUILDING_LIBCURL -DCURL_STATICLIB \
640 641 642 643
	-DCURL_DISABLE_LDAP -I$(CURL_DIR)/include -I$(CURL_DIR)/lib
ifeq "$(HAVE_OPENSSL_SSL)" "yes"
CRL_CFLAGS += -DUSE_OPENSSL
endif
Robin Watts's avatar
Robin Watts committed
644 645 646 647

$(CURL_OUT)/%.o: $(CURL_DIR)/lib/%.c	| $(CURL_OUT)
	$(CC_CMD) $(CRL_CFLAGS)

648 649 650
$(CURL_OUT)/%.o: $(CURL_DIR)/lib/vtls/%.c	| $(CURL_OUT)
	$(CC_CMD) $(CRL_CFLAGS)

Robin Watts's avatar
Robin Watts committed
651
CURL_CFLAGS := -I$(CURL_DIR)/include
652
CURL_LIBS := $(SYS_CURL_DEPS)
653 654

HAVE_CURL := yes
655 656 657 658

else ifeq "$(HAVE_CURL)" "yes"
CURL_CFLAGS := $(SYS_CURL_CFLAGS)
CURL_LIBS := $(SYS_CURL_LIBS)
659 660
endif

661
# --- FreeGLUT ---
662

663
ifneq "$(wildcard $(GLUT_DIR)/README)" ""
664 665

ifeq "$(OS)" "MACOS"
666 667
GLUT_CFLAGS := $(SYS_GLUT_CFLAGS)
GLUT_LIBS := $(SYS_GLUT_LIBS)
668 669
else

670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723
HAVE_GLUT := yes

GLUT_LIB := $(OUT)/libfreeglut.a
GLUT_OUT := $(OUT)/thirdparty/freeglut
GLUT_SRC := \
	fg_callbacks.c \
	fg_cursor.c \
	fg_display.c \
	fg_ext.c \
	fg_font.c \
	fg_font_data.c \
	fg_gamemode.c \
	fg_geometry.c \
	fg_gl2.c \
	fg_init.c \
	fg_input_devices.c \
	fg_joystick.c \
	fg_main.c \
	fg_menu.c \
	fg_misc.c \
	fg_overlay.c \
	fg_spaceball.c \
	fg_state.c \
	fg_stroke_mono_roman.c \
	fg_stroke_roman.c \
	fg_structure.c \
	fg_teapot.c \
	fg_videoresize.c \
	fg_window.c

GLUT_X11_SRC := \
	fg_cursor_x11.c \
	fg_display_x11_glx.c \
	fg_ext_x11.c \
	fg_gamemode_x11.c \
	fg_glutfont_definitions_x11.c \
	fg_init_x11.c \
	fg_input_devices_x11.c \
	fg_joystick_x11.c \
	fg_main_x11.c \
	fg_menu_x11.c \
	fg_spaceball_x11.c \
	fg_state_x11.c \
	fg_state_x11_glx.c \
	fg_structure_x11.c \
	fg_window_x11.c \
	fg_window_x11_glx.c \
	fg_xinput_x11.c

GLUT_OBJ := $(addprefix $(GLUT_OUT)/, $(GLUT_SRC:%.c=%.o))
GLUT_OBJ += $(addprefix $(GLUT_OUT)/, $(GLUT_X11_SRC:%.c=%.o))

$(GLUT_LIB): $(GLUT_OBJ)
$(GLUT_OUT):
724
	$(MKDIR_CMD)
725 726 727 728 729 730 731 732 733
$(GLUT_OUT)/%.o: $(GLUT_DIR)/src/%.c | $(GLUT_OUT)
	$(CC_CMD) -I$(GLUT_DIR)/include -I$(GLUT_DIR)/src -Wno-unused-function -Wno-unused-const-variable \
		-DHAVE_UNISTD_H -DHAVE_STDINT_H -DHAVE_X11_EXTENSIONS_XRANDR_H
$(GLUT_OUT)/%.o: $(GLUT_DIR)/src/x11/%.c | $(GLUT_OUT)
	$(CC_CMD) -I$(GLUT_DIR)/include -I$(GLUT_DIR)/src -Wno-unused-function \
		-DHAVE_UNISTD_H -DHAVE_STDINT_H -DHAVE_X11_EXTENSIONS_XRANDR_H

GLUT_CFLAGS := -I$(GLUT_DIR)/include
GLUT_LIBS := -lGL -lX11 -lXrandr
734

735 736 737 738
endif
else
GLUT_CFLAGS := $(SYS_GLUT_CFLAGS)
GLUT_LIBS := $(SYS_GLUT_LIBS)
739 740
endif

741 742 743 744 745
# --- X11 ---

ifeq "$(HAVE_X11)" "yes"
X11_CFLAGS := $(SYS_X11_CFLAGS)
X11_LIBS := $(SYS_X11_LIBS)
Robin Watts's avatar
Robin Watts committed
746
endif
747 748 749 750 751 752 753 754 755 756

# --- OpenSSL ---

ifeq "$(HAVE_LIBCRYPTO)" "yes"
LIBCRYPTO_CFLAGS := $(SYS_LIBCRYPTO_CFLAGS)
LIBCRYPTO_LIBS := $(SYS_LIBCRYPTO_LIBS)
endif

# --- pthread ---

757 758 759 760 761 762
ifneq "$(threading)" "no"
ifeq "$(HAVE_PTHREAD)" "yes"
THREADING_CFLAGS := $(SYS_PTHREAD_CFLAGS) -DHAVE_PTHREAD
THREADING_LIBS := $(SYS_PTHREAD_LIBS)
endif
endif