aboutsummaryrefslogtreecommitdiff
path: root/lib/libdvd/Makefile.in
blob: 00827cf2d682e2adae2ea19c9bda5a2168ac88b2 (plain)
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

ARCH=@ARCH@
CC=@CC@
CXX=@CXX@

ifeq (@CROSS_COMPILING@,yes)
  DEPENDS_DIR = $(shell grep "^PREFIX=/" @abs_top_srcdir@/tools/depends/Makefile.include | sed 's/PREFIX=//g')
  DVDNAV_A = $(DEPENDS_DIR)/lib/libdvdnav.a
  DVDREAD_A = $(DEPENDS_DIR)/lib/libdvdread.a
  DVDCSS_A = $(DEPENDS_DIR)/lib/libdvdcss.a
else
  DVDNAV_A = @abs_top_srcdir@/tools/depends/target/libdvdnav/dvdnav-install/lib/libdvdnav.a
  DVDREAD_A = @abs_top_srcdir@/tools/depends/target/libdvdread/dvdread-install/lib/libdvdread.a
  DVDCSS_A = @abs_top_srcdir@/tools/depends/target/libdvdcss/dvdcss-install/lib/libdvdcss.a
endif

SYSDIR = @abs_top_srcdir@/system/players/VideoPlayer
SOS = libdvdnav-$(ARCH).so

WRAPPER = @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o
WRAPPER_DEF = @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.def
WRAPPER_MACH_ALIAS = @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper_mach_alias

ifeq ($(findstring osx,$(ARCH)),osx)
  SO_LDFLAGS = $(LDFLAGS) -bundle -undefined dynamic_lookup -read_only_relocs suppress
else
  SO_LDFLAGS = $(LDFLAGS) -shared -fPIC -rdynamic
endif

ifeq ($(ARCH), powerpc-osx)
  # Add -lbundle1.o for powerpc-osx
  BUNDLE1_O = -lbundle1.o
endif

ifeq ($(ARCH),arm-osx)
  BUILD_DVDCSS = 0
else
  BUILD_DVDCSS = 1
endif
ifeq ($(BUILD_DVDCSS),1)
  SOS += libdvdcss-$(ARCH).so
  DVDREAD_DEPS = $(DVDCSS_A)
  DVDCSS_OBJS = libdvdcss/*.o
endif


SLIB = $(addprefix $(SYSDIR)/, $(SOS))

DISTCLEAN_FILES=libdvdcss/* libdvdnav/* libdvdread/*

all: $(SLIB)

ifeq ($(findstring osx,$(ARCH)), osx)

$(SYSDIR)/libdvdcss-$(ARCH).so:  $(WRAPPER) $(DVDREAD_DEPS)
	[ -d libdvdcss ] || mkdir libdvdcss
	cd libdvdcss; ar x $(DVDCSS_A)
	$(CC) $(SO_LDFLAGS) -Wl,-alias_list,$(WRAPPER_MACH_ALIAS) -o $@ \
                $(WRAPPER) $(DVDCSS_OBJS) $(BUNDLE1_O)

$(SYSDIR)/libdvdnav-$(ARCH).so: $(WRAPPER) $(DVDNAV_A) $(DVDREAD_A) $(DVDREAD_DEPS)
	[ -d libdvdread ] || mkdir libdvdread
	[ -d libdvdnav ] || mkdir libdvdnav
	[ $(BUILD_DVDCSS) -eq 1 ] && { [ -d libdvdcss ] || mkdir libdvdcss; } || :
	[ $(BUILD_DVDCSS) -eq 1 ] && { cd libdvdcss && ar x $(DVDCSS_A); } || :
	cd libdvdnav; ar x $(DVDNAV_A)
	cd libdvdread; ar x $(DVDREAD_A)
	$(CC) $(SO_LDFLAGS) -Wl,-alias_list,$(WRAPPER_MACH_ALIAS) -o $@ \
                $(WRAPPER) libdvdread/*.o libdvdnav/*.o $(DVDCSS_OBJS) $(BUNDLE1_O)

else
$(SYSDIR)/libdvdcss-$(ARCH).so: $(WRAPPER) $(WRAPPER_DEF) $(DVDCSS_A)
	[ -d libdvdcss ] || mkdir libdvdcss
	cd libdvdcss; ar x $(DVDCSS_A)
	$(CC) -o $@ $(SO_LDFLAGS) -Wl,--soname,$@ $(DVDCSS_OBJS) -Wl,--unresolved-symbols=ignore-all -lm \
        `cat $(WRAPPER_DEF)` $(WRAPPER)

$(SYSDIR)/libdvdnav-$(ARCH).so: $(WRAPPER) $(WRAPPER_DEF) $(DVDNAV_A) $(DVDREAD_A) $(DVDCSS_A)
	[ -d libdvdread ] || mkdir libdvdread
	[ -d libdvdnav ] || mkdir libdvdnav
	[ $(BUILD_DVDCSS) -eq 1 ] && { [ -d libdvdcss ] || mkdir libdvdcss; } || :
	[ $(BUILD_DVDCSS) -eq 1 ] && { cd libdvdcss && ar x $(DVDCSS_A); } || :
	cd libdvdnav; ar x $(DVDNAV_A)
	cd libdvdread; ar x $(DVDREAD_A)
	$(CC) -o $@ $(SO_LDFLAGS) -Wl,--soname,$@ libdvdread/*.o libdvdnav/*.o $(DVDCSS_OBJS) -lm -Wl,--unresolved-symbols=ignore-all \
                `cat  $(WRAPPER_DEF)` $(WRAPPER)
endif

$(WRAPPER_DEF):
	$(MAKE) -C @abs_top_srcdir@/xbmc/cores/DllLoader/exports wrapper.def

$(DVDNAV_A): $(DVDREAD_A)
	$(MAKE) -C @abs_top_srcdir@/tools/depends/target/libdvdnav

$(DVDREAD_A): $(DVDREAD_DEPS)
	$(MAKE) -C @abs_top_srcdir@/tools/depends/target/libdvdread

ifeq ($(BUILD_DVDCSS),1)
$(DVDCSS_A):
	$(MAKE) -C @abs_top_srcdir@/tools/depends/target/libdvdcss
endif

include @abs_top_srcdir@/Makefile.include