-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
101 lines (77 loc) · 2.7 KB
/
Makefile
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
MD := mkdir
RM := rm
CXX := c++
CXXFLAGS := -O2 -fPIC -std=c++11 -Wall -Wextra -Wno-switch -I source
LDFLAGS :=
BUILDDIR := build
SOURCES_MPEG2TS_SPLITTER := source/main.cpp source/CommandLineOptionsParser.cpp
SOURCE_DIRS_MPEG2TS_SPLITTER := $(sort $(dir $(SOURCES_MPEG2TS_SPLITTER)))
OBJS_MPEG2TS_SPLITTER = $(patsubst %.cpp,$(BUILDDIR)/%.o, $(notdir $(SOURCES_MPEG2TS_SPLITTER)))
SOURCES_TOOLS := \
source/tools/BitBuffer.cpp \
source/tools/CommandLineOption.cpp \
source/tools/CommandLineOptionGroup.cpp \
source/tools/CommandLineParser.cpp \
source/tools/Console.cpp \
source/tools/DeserializationImpl.cpp \
source/tools/SerializationImpl.cpp \
source/tools/Stopwatch.cpp \
source/tools/Util.cpp
SOURCE_DIRS_TOOLS := $(sort $(dir $(SOURCES_TOOLS)))
OBJS_TOOLS = $(patsubst %.cpp,$(BUILDDIR)/%.o, $(SOURCES_TOOLS))
SOURCES_MEDIA := \
source/media/AudioStreamHandler.cpp \
source/media/Logging.cpp \
source/media/MPEG2Splitter.cpp \
source/media/PAT.cpp \
source/media/PATHandler.cpp \
source/media/PESPacket.cpp \
source/media/PMT.cpp \
source/media/PMTHandler.cpp \
source/media/ProgramDescriptor.cpp \
source/media/StreamInfo.cpp \
source/media/StreamWriter.cpp \
source/media/TransportStream.cpp \
source/media/TSPacket.cpp \
source/media/VideoStreamHandler.cpp
SOURCE_DIRS_MEDIA := $(sort $(dir $(SOURCES_MEDIA)))
OBJS_MEDIA = $(patsubst %.cpp,$(BUILDDIR)/%.o, $(SOURCES_MEDIA))
SOURCES_TEST := \
tests/BitBufferTest.cpp \
tests/main.cpp \
tests/MPEG2SplitterTest.cpp
SOURCE_DIRS_TEST := $(sort $(dir $(SOURCES_TEST)))
OBJS_TEST = $(patsubst %.cpp,$(BUILDDIR)/%.o, $(SOURCES_TEST))
all : directories mpeg2ts-splitter tools media mpeg2ts-splitter-test
directories : $(BUILDDIR) $(BUILDDIR)/source $(BUILDDIR)/test $(BUILDDIR)/source/tools $(BUILDDIR)/source/media
$(BUILDDIR) :
$(MD) -p $@
$(BUILDDIR)/source :
$(MD) -p $@
$(BUILDDIR)/test :
$(MD) -p $@
$(BUILDDIR)/source/tools :
$(MD) -p $@
$(BUILDDIR)/source/media :
$(MD) -p $@
mpeg2ts-splitter : $(OBJS_MPEG2TS_SPLITTER) tools media
$(CXX) -o $@ $(OBJS_MPEG2TS_SPLITTER) -L$(BUILDDIR) -lmedia -ltools
mpeg2ts-splitter-test : $(OBJS_TEST) tools media
$(CXX) -o $@ $(OBJS_TEST) -L$(BUILDDIR) -lmedia -ltools
tools : $(OBJS_TOOLS)
rm -f $(BUILDDIR)/libtools.a
$(AR) qc $(BUILDDIR)/libtools.a $^
media : $(OBJS_MEDIA)
rm -f $(BUILDDIR)/libmedia.a
$(AR) qc $(BUILDDIR)/libmedia.a $^
vpath %.cpp $(SOURCE_DIRS_MPEG2TS_SPLITTER)
$(OBJS_MPEG2TS_SPLITTER): $(BUILDDIR)/%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<
$(OBJS_TOOLS): $(BUILDDIR)/%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<
$(OBJS_MEDIA): $(BUILDDIR)/%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<
$(OBJS_TEST): $(BUILDDIR)/%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<
clean :
rm -rf $(BUILDDIR)