-
Notifications
You must be signed in to change notification settings - Fork 45
/
makefile
71 lines (57 loc) · 1.91 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
CXXFLAGS = -g3 -Ofast -std=c++14 -D__STDC_CONSTANT_MACROS \
-Wall -Wextra -Wno-deprecated -Wno-deprecated-declarations \
-Wdisabled-optimization -Wctor-dtor-privacy \
-Woverloaded-virtual -Wno-unused -Wno-missing-field-initializers
ifeq ($(findstring CYGWIN_NT-10.0, $(shell uname)), CYGWIN_NT-10.0)
FFMPEG_VERSION = 7.1-full_build-shared
SDL2_VERSION = 2.30.8
SDL2_TTF_VERSION = 2.22.0
FFMPEG_PATH = ffmpeg-$(FFMPEG_VERSION)
SDL2_PATH = SDL2-devel-$(SDL2_VERSION)-mingw/SDL2-$(SDL2_VERSION)/x86_64-w64-mingw32
SDL2_TTF_PATH = SDL2_ttf-devel-$(SDL2_TTF_VERSION)-mingw/SDL2_ttf-$(SDL2_TTF_VERSION)/x86_64-w64-mingw32
CXX = x86_64-w64-mingw32-g++
CXXFLAGS += -I$(FFMPEG_PATH)/include/ \
-I$(SDL2_PATH)/include/ \
-I$(SDL2_PATH)/include/SDL2/ \
-I$(SDL2_TTF_PATH)/include/
LDLIBS += -L$(FFMPEG_PATH)/lib/ \
-L$(SDL2_PATH)/lib/ \
-L$(SDL2_TTF_PATH)/lib/
else
CXX = g++
LDLIBS = -pthread
endif
ifneq "$(wildcard /opt/homebrew)" ""
CXXFLAGS += -I/opt/homebrew/include/
LDLIBS += -L/opt/homebrew/lib/
BINDIR = /opt/homebrew/bin/
else ifneq "$(wildcard /opt/local)" ""
CXXFLAGS += -I/opt/local/include/
LDLIBS += -L/opt/local/lib/
BINDIR = /opt/local/bin/
else
CXXFLAGS += -I/usr/local/include/
LDLIBS += -L/usr/local/lib/
BINDIR = /usr/local/bin/
endif
ifneq "$(wildcard /usr/include/ffmpeg)" ""
CXXFLAGS += -I/usr/include/ffmpeg
endif
LDLIBS += -lavformat -lavcodec -lavfilter -lavutil -lswscale -lswresample -lSDL2 -lSDL2_ttf
src = $(wildcard *.cpp)
obj = $(src:.cpp=.o)
dep = $(obj:.o=.d)
target = video-compare
all: $(target)
$(target): $(obj)
$(CXX) -o $@ $^ $(LDLIBS)
-include $(dep)
%.d: %.cpp
@$(CXX) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@
test: $(target)
./$(target) -w 800x screenshot_1.jpg screenshot_2.jpg
.PHONY: clean
clean:
$(RM) $(obj) $(target) $(dep)
install: $(target)
install -s video-compare $(BINDIR)