forked from FFMS/ffms2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
GNUmakefile
164 lines (134 loc) · 4.59 KB
/
GNUmakefile
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
161
162
163
164
# Makefile
include config.mak
all: default
ifndef V
$(foreach VAR,CC CXX AR RANLIB RC,\
$(eval override $(VAR) = @printf " %s\t%s\n" $(VAR) "$$@"; $($(VAR))))
endif
CORE_C =
CORE_CXX = src/core/audiosource.cpp \
src/core/ffms.cpp \
src/core/filehandle.cpp \
src/core/indexing.cpp \
src/core/track.cpp \
src/core/utils.cpp \
src/core/videosource.cpp \
src/core/videoutils.cpp \
src/core/zipfile.cpp
IDX_CXX = src/index/ffmsindex.cpp
SO_C =
SO_CXX =
# Optional module sources
ifeq ($(AVISYNTH), yes)
SO_C += src/avisynth_c/avisynth.c \
src/avisynth_c/avs_lib.c \
src/avisynth_c/avs_utils.c \
src/avisynth_c/ff_audsource.c \
src/avisynth_c/ff_vidsource.c
endif
ifeq ($(AVISYNTH_GCC), yes)
SO_CXX += src/avisynth/avisynth.cpp \
src/avisynth/avssources.cpp
endif
ifeq ($(AVXSYNTH), yes)
SO_CXX += src/avxsynth/avisynth.cpp \
src/avxsynth/avssources.cpp \
src/avxsynth/avsutils.cpp \
src/avxsynth/ffswscale.cpp
endif
ifeq ($(VAPOURSYNTH),yes)
SO_CXX += src/vapoursynth/vapoursource.cpp \
src/vapoursynth/vapoursynth.cpp
endif
CORE_O = $(CORE_C:%.c=%.o) $(CORE_CXX:%.cpp=%.o)
IDX_O = $(IDX_CXX:%.cpp=%.o)
SO_O = $(SO_C:%.c=%.o) $(SO_CXX:%.cpp=%.o)
ifeq ($(SYS), MINGW)
IDX_O += ffmsindexexe.o
IDX_LDFLAGS += -municode
ifneq ($(SONAME),)
SO_O += ffmsdll.o
endif
endif
INDEX_LINK=libffms2.a
ifneq ($(SONAME),)
INDEX_LINK=$(SONAME)
endif
ifneq ($(IMPLIBNAME),)
INDEX_LINK=$(IMPLIBNAME)
endif
ffmsdll.o: ffmsdll.rc.h
ffmsindexexe.o: ffmsindexexe.rc.h
%.o: %.rc
$(RC) $(RCFLAGS) --include-dir=. -o $@ $<
default: $(DEP) ffmsindex$(EXE)
libffms2.a: .depend $(CORE_O)
$(AR) rc libffms2.a $(CORE_O)
$(RANLIB) libffms2.a
$(SONAME): .depend $(CORE_O) $(SO_O) $(SO_CXX)
$(CXX) -shared -o $@ $(CORE_O) $(SO_O) $(SOFLAGS) $(SOFLAGS_USER) $(LDFLAGS)
ffmsindex$(EXE): $(IDX_O) libffms2.a $(SONAME)
$(CXX) -o $@ $(IDX_O) $(INDEX_LINK) $(LDFLAGS) $(IDX_LDFLAGS)
define \n
endef
.depend: config.mak
@rm -f .depend
@$(foreach SRC_C, $(CORE_C), \
$(PLC) $(CPPFLAGS) $(CFLAGS) $(SRC_C) -MT $(SRC_C:%.c=%.o) -MM -g0 1>> .depend;${\n})
@$(foreach SRC_CXX, $(CORE_CXX) $(IDX_CXX), \
$(PLPL) $(CPPFLAGS) $(CXXFLAGS) $(SRC_CXX) -MT $(SRC_CXX:%.cpp=%.o) -MM -g0 1>> .depend;${\n})
config.mak:
./configure
depend: .depend
ifneq ($(wildcard .depend),)
include .depend
endif
install: ffmsindex$(EXE) $(SONAME)
install -d $(DESTDIR)$(bindir)
install -d $(DESTDIR)$(includedir)
install -d $(DESTDIR)$(libdir)
install -d $(DESTDIR)$(libdir)/pkgconfig
install -m 644 include/ffms.h $(DESTDIR)$(includedir)
install -m 644 libffms2.a $(DESTDIR)$(libdir)
install -m 644 ffms2.pc $(DESTDIR)$(libdir)/pkgconfig
install ffmsindex$(EXE) $(DESTDIR)$(bindir)
$(RANLIBX) $(DESTDIR)$(libdir)/libffms2.a
ifeq ($(SYS),MINGW)
$(if $(SONAME), install -m 755 $(SONAME) $(DESTDIR)$(bindir))
else
$(if $(SONAME), ln -f -s $(SONAME) $(DESTDIR)$(libdir)/libffms2.$(SOSUFFIX))
$(if $(SONAME), install -m 755 $(SONAME) $(DESTDIR)$(libdir))
ifeq ($(AVSPLUG), yes)
install -d $(DESTDIR)$(avsplugindir)
install -m 644 etc/FFMS2.avsi $(DESTDIR)$(avsplugindir)/FFMS2.avsi
$(if $(SONAME), ln -f -s $(libdir)/$(SONAME) $(DESTDIR)$(avsplugindir)/libffms2.so)
endif
ifeq ($(AVXSYNTH), yes)
install -d $(DESTDIR)$(avxplugindir)
install -m 644 etc/FFMS2.avsi $(DESTDIR)$(avxplugindir)/FFMS2.avsi
$(if $(SONAME), ln -f -s $(libdir)/$(SONAME) $(DESTDIR)$(avxplugindir)/libavxffms2.so)
endif
ifeq ($(VAPOURSYNTH), yes)
install -d $(DESTDIR)$(vsplugindir)
$(if $(SONAME), ln -f -s $(libdir)/$(SONAME) $(DESTDIR)$(vsplugindir)/libffms2.$(SOSUFFIX))
endif
endif
$(if $(IMPLIBNAME), install -m 644 $(IMPLIBNAME) $(DESTDIR)$(libdir))
install-avs:
install -d $(DESTDIR)$(bindir)
install ffmsindex$(EXE) $(DESTDIR)$(bindir)
ifeq ($(SYS),MINGW)
cp etc/* $(DESTDIR)$(bindir)
mv $(DESTDIR)$(bindir)/FFMS2-cplugin.avsi $(DESTDIR)$(bindir)/FFMS2.avsi
cp -R doc $(DESTDIR)$(bindir)
$(if $(SONAME), install -m 755 $(SONAME) $(DESTDIR)$(bindir))
endif
uninstall:
rm -f $(DESTDIR)$(includedir)/ffms.h $(DESTDIR)$(libdir)/libffms2.a
rm -f $(DESTDIR)$(bindir)/ffmsindex$(EXE) $(DESTDIR)$(libdir)/pkgconfig/ffms2.pc
$(if $(SONAME), rm -f $(DESTDIR)$(libdir)/$(SONAME) $(DESTDIR)$(libdir)/libffms2.$(SOSUFFIX) $(DESTDIR)$(bindir)/$(SONAME))
$(if $(IMPLIBNAME), rm -f $(DESTDIR)$(libdir)/$(IMPLIBNAME))
clean:
rm -f $(CORE_O) $(SO_O) $(IDX_O) $(SONAME) *.a ffmsindex ffmsindex$(EXE) .depend TAGS
distclean: clean
rm -f config.mak config.h config.log ffms2.pc