| 1 |
|
| 2 |
USER_DIR = .. |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
GTEST_DIR = $(USER_DIR)/test/googletest/googletest |
| 7 |
|
| 8 |
|
| 9 |
SAMPLES_DIR = |
| 10 |
|
| 11 |
|
| 12 |
SAMPLES_URL = |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
CPPFLAGS += -isystem $(GTEST_DIR)/include \ |
| 18 |
-I$(USER_DIR)/include \ |
| 19 |
-D_FILE_OFFSET_BITS=64 \ |
| 20 |
-DFFMS_EXPORTS \ |
| 21 |
-D__STDC_CONSTANT_MACROS \ |
| 22 |
-DSAMPLES_DIR=$(SAMPLES_DIR) |
| 23 |
|
| 24 |
|
| 25 |
CXXFLAGS += -g -Wall -Wextra -pthread -std=c++11 -fvisibility=hidden |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
TESTS = indexer \ |
| 30 |
hdr \ |
| 31 |
display_matrix |
| 32 |
|
| 33 |
RUNTESTS = $(subst $() $(),-run$() $(),$(TESTS))-run |
| 34 |
|
| 35 |
|
| 36 |
SAMPLES = test.mp4 \ |
| 37 |
hdr10tags-both.mkv \ |
| 38 |
hdr10tags-container.mkv \ |
| 39 |
hdr10tags-stream.mp4 \ |
| 40 |
qrvideo_hflip_90.mov \ |
| 41 |
qrvideo_hflip_270.mov \ |
| 42 |
qrvideo_vflip.mov \ |
| 43 |
vp9_audfirst.webm \ |
| 44 |
qrvideo_24fps_1elist_1ctts.mov \ |
| 45 |
qrvideo_24fps_1elist_ends_last_bframe.mov \ |
| 46 |
qrvideo_24fps_1elist_noctts.mov \ |
| 47 |
qrvideo_24fps_2elist_elist1_dur_zero.mov \ |
| 48 |
qrvideo_24fps_2elist_elist1_ends_bframe.mov \ |
| 49 |
qrvideo_24fps_2s_3elist.mov \ |
| 50 |
qrvideo_24fps_3elist_1ctts.mov \ |
| 51 |
qrvideo_24fps_elist_starts_ctts_2ndsample.mov \ |
| 52 |
qrvideo_stream_shorter_than_movie.mov |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
GTEST_HEADERS = $(GTEST_DIR)/include/gtest/*.h $(GTEST_DIR)/include/gtest/internal/*.h |
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
all: $(TESTS) |
| 61 |
|
| 62 |
run: all $(RUNTESTS) |
| 63 |
|
| 64 |
sync: |
| 65 |
@for i in $(SAMPLES); do \ |
| 66 |
if [ ! -f "$(SAMPLES_DIR)/$$i" ]; then \ |
| 67 |
wget -O $(SAMPLES_DIR)/$$i $(SAMPLES_URL)/$$i; \ |
| 68 |
fi \ |
| 69 |
done |
| 70 |
|
| 71 |
clean: |
| 72 |
rm -f $(TESTS) gtest.a gtest_main.a *.o |
| 73 |
rm -rf .libs |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
GTEST_SRCS_ = $(GTEST_DIR)/src/*.cc $(GTEST_DIR)/src/*.h $(GTEST_HEADERS) |
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
gtest-all.o: $(GTEST_SRCS_) |
| 86 |
$(CXX) $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c $(GTEST_DIR)/src/gtest-all.cc |
| 87 |
|
| 88 |
gtest_main.o: $(GTEST_SRCS_) |
| 89 |
$(CXX) $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c $(GTEST_DIR)/src/gtest_main.cc |
| 90 |
|
| 91 |
gtest.a: gtest-all.o |
| 92 |
$(AR) $(ARFLAGS) $@ $^ |
| 93 |
|
| 94 |
gtest_main.a: gtest-all.o gtest_main.o |
| 95 |
$(AR) $(ARFLAGS) $@ $^ |
| 96 |
|
| 97 |
tests.o: $(USER_DIR)/test/tests.cpp $(USER_DIR)/include/ffms.h $(GTEST_HEADERS) |
| 98 |
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/test/tests.cpp |
| 99 |
|
| 100 |
hdr.o: $(USER_DIR)/test/hdr.cpp $(USER_DIR)/include/ffms.h $(GTEST_HEADERS) |
| 101 |
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/test/hdr.cpp |
| 102 |
|
| 103 |
display_matrix.o: $(USER_DIR)/test/display_matrix.cpp $(USER_DIR)/include/ffms.h $(GTEST_HEADERS) |
| 104 |
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/test/display_matrix.cpp |
| 105 |
|
| 106 |
indexer.o: $(USER_DIR)/test/indexer.cpp $(USER_DIR)/include/ffms.h $(GTEST_HEADERS) |
| 107 |
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/test/indexer.cpp |
| 108 |
|
| 109 |
indexer: indexer.o tests.o gtest_main.a ../src/core/libffms2.la |
| 110 |
../libtool --tag=CXX --mode=link $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o indexer indexer.o tests.o gtest_main.a -lavutil ../src/core/libffms2.la |
| 111 |
|
| 112 |
indexer-run: |
| 113 |
@./indexer |
| 114 |
|
| 115 |
hdr: hdr.o gtest_main.a ../src/core/libffms2.la |
| 116 |
../libtool --tag=CXX --mode=link $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o hdr hdr.o gtest_main.a -lavutil ../src/core/libffms2.la |
| 117 |
|
| 118 |
hdr-run: |
| 119 |
@./hdr |
| 120 |
|
| 121 |
display_matrix: display_matrix.o gtest_main.a ../src/core/libffms2.la |
| 122 |
../libtool --tag=CXX --mode=link $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o display_matrix display_matrix.o gtest_main.a -lavutil ../src/core/libffms2.la |
| 123 |
|
| 124 |
display_matrix-run: |
| 125 |
@./display_matrix |