forked from tsduck/tsduck
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.tsduck
160 lines (134 loc) · 5.29 KB
/
Makefile.tsduck
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
#-----------------------------------------------------------------------------
#
# TSDuck - The MPEG Transport Stream Toolkit
# Copyright (c) 2005-2020, Thierry Lelegard
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
# THE POSSIBILITY OF SUCH DAMAGE.
#
#-----------------------------------------------------------------------------
#
# Common makefile definitions for the TSDuck project.
#
#-----------------------------------------------------------------------------
# Standard common makefile is in same directory.
include $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))/Makefile.common
# Project specific directories and files.
STATIC_LIBTSDUCK := libtsduck.a
SHARED_LIBTSDUCK := tsduck.so
INSTALLERDIR := $(ROOTDIR)/installers
SRCROOT := $(ROOTDIR)/src
LIBTSDUCKDIR := $(SRCROOT)/libtsduck
TSTOOLSDIR := $(SRCROOT)/tstools
TSPLUGINSDIR := $(SRCROOT)/tsplugins
LIBTSDUCK := $(LIBTSDUCKDIR)/$(OBJDIR)/$(STATIC_LIBTSDUCK)
ifndef TSPLUGINS
export TSPLUGINS := $(sort $(filter-out $(if $(NOTELETEXT),tsplugin_teletext,),\
$(notdir $(basename $(wildcard $(TSPLUGINSDIR)/tsplugin_*.cpp)))))
export TSEXECS := $(sort $(filter-out $(notdir $(basename $(wildcard $(TSTOOLSDIR)/*.h))),\
$(notdir $(basename $(wildcard $(TSTOOLSDIR)/*.cpp)))))
endif
# Default installation root.
# RPM packagers should override this in the "make install" command line.
SYSROOT =
# A shortcut-target to rebuild with static linking.
# Not meaningfull everywhere:
# - Static linking with system libraries is not supported on macOS.
# - On Linux, all used libraries must be installed. This is not supported
# on all distros. On Fedora, you may install "glibc-static libstdc++-static"
# but there is no static package for curl and pcsclite.
.PHONY: static
static:
+@$(MAKE) STATIC=true
ifdef STATIC
ifdef MACOS
$(error static linking is not supported on macOS)
else
CFLAGS_INCLUDES += -DTSDUCK_STATIC=1
endif
else
LDLIBS := -ldl $(LDLIBS)
endif
# A setenv.sh script to setup the environment for a binary directory.
$(OBJDIR)/setenv.sh: $(ROOTDIR)/build/setenv-template.sh
cp -f $< $@
# External include directories and libraries.
ifdef CROSS_TARGET
# Some libraries are bypassed in cross-compilation.
NOCURL := true
NOPCSC := true
NODTAPI := true
endif
ifdef NOTELETEXT
CFLAGS_INCLUDES += -DTS_NOTELETEXT=1
endif
ifeq ($(MACOS)$(NOSRT),)
# Not on macOS and SRT not disabled, check if libsrt is available.
NOSRT = $(if $(wildcard /usr/include/srt/*.h)$(wildcard /usr/local/include/srt/*.h),,true)
endif
ifneq ($(NOSRT),)
CFLAGS_INCLUDES += -DTS_NOSRT=1
else
LDLIBS := -lsrt $(LDLIBS)
endif
ifdef NOCURL
CFLAGS_INCLUDES += -DTS_NO_CURL=1
else
ifndef CFLAGS_CURL
export CFLAGS_CURL := $(shell curl-config --cflags)
export LDLIBS_CURL := $(shell curl-config --libs)
endif
CFLAGS_INCLUDES += $(CFLAGS_CURL)
LDLIBS := $(LDLIBS_CURL) $(LDLIBS)
endif
ifdef NOPCSC
CFLAGS_INCLUDES += -DTS_NO_PCSC=1
else
ifdef MACOS
CFLAGS_INCLUDES += -I/usr/local/opt/pcsc-lite/include/PCSC
LDLIBS := -L/usr/local/opt/pcsc-lite/lib/ -lpcsclite $(LDLIBS)
else
CFLAGS_INCLUDES += -I/usr/include/PCSC
LDLIBS := -lpcsclite $(LDLIBS)
endif
endif
ifdef NODTAPI
CFLAGS_INCLUDES += -DTS_NO_DTAPI=1
endif
ifdef ARIB
CXXFLAGS_STANDARD = -std=c++14 # required for std::make_unique()
CFLAGS_INCLUDES += -DTS_ARIB=1 $(shell pkg-config --cflags aribb24)
LDLIBS := $(shell pkg-config --libs aribb24) $(LDLIBS)
endif
ifdef MACOS
CFLAGS_INCLUDES += -I$(LIBTSDUCKDIR)/mac
LDFLAGS_EXTRA += -Wl,-rpath,@executable_path
SOFLAGS = -install_name '@rpath/$(notdir $@)'
else
CFLAGS_INCLUDES += -I$(LIBTSDUCKDIR)/linux
LDFLAGS_EXTRA += -Wl,-rpath,'$$ORIGIN'
SOFLAGS = -Wl,-soname=$(notdir $@)
endif
CFLAGS_INCLUDES += $(addprefix -I,$(shell find $(LIBTSDUCKDIR) -type d ! -name private ! -name windows ! -name $(if $(MACOS),linux,mac)))
ifneq ($(TS_NO_BUILD_VERSION),)
CPPFLAGS += -DTS_NO_BUILD_VERSION
endif