mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-24 20:01:53 +00:00
261 lines
7.1 KiB
Makefile
261 lines
7.1 KiB
Makefile
# mkvtoolnix - Makefile for MinGW
|
|
# because I was fed up fighting against libtool
|
|
|
|
# Put all the user changeable options into one file
|
|
include Makefile.options
|
|
|
|
ifneq (,$(DEBUG))
|
|
CFLAGS += -g -DDEBUG
|
|
CXXFLAGS += -g -DDEBUG
|
|
endif
|
|
|
|
ifneq (,$(findstring bzlib,$(COMPRESSION_LIBS)))
|
|
CXXFLAGS += -DHAVE_BZLIB_H=1
|
|
COMPRESSION_LIBRARIES = -lbz2
|
|
endif
|
|
|
|
ifneq (,$(findstring lzo,$(COMPRESSION_LIBS)))
|
|
CXXFLAGS += -DHAVE_LZO1X_H=1
|
|
COMPRESSION_LIBRARIES += -llzo1x
|
|
endif
|
|
|
|
ifneq (,$(WXWINDOWS))
|
|
WXWINDOWS_LIBS = $(shell wx-config --libs)
|
|
WXWINDOWS_LDFLAGS = $(shell wx-config --ldflags)
|
|
CXXFLAGS += -DHAVE_WXWINDOWS=1 $(shell wx-config --cflags)
|
|
endif
|
|
|
|
ifneq (,$(findstring yes,$(MTX_DLLS)))
|
|
DEP_COMMON = src/common/libmtxcommon.dll
|
|
DEP_EBMLCOMMON = src/common/libmtxebmlcommon.dll
|
|
DEP_KAXCOMMON = src/common/libmtxkaxcommon.dll
|
|
CXXFLAGS_SRC_COMMON += -DMTX_DLL_EXPORT
|
|
CXXFLAGS_NO_SRC_COMMON += -DMTX_DLL
|
|
else
|
|
DEP_COMMON = src/common/libmtxcommon.a
|
|
DEP_EBMLCOMMON = src/common/libmtxebmlcommon.a
|
|
DEP_KAXCOMMON = src/common/libmtxkaxcommon.a
|
|
endif
|
|
DEP_INPUT = src/input/libmtxinput.a
|
|
DEP_OUTPUT = src/output/libmtxoutput.a
|
|
DEP_AVILIB = avilib-0.6.10/libavi.a
|
|
DEP_AVI = $(DEP_AVILIB)
|
|
DEP_RMFF = librmff/librmff.a
|
|
|
|
#
|
|
# System settings. Don't change anything below here.
|
|
#
|
|
SUBDIRS = avilib-0.6.10 src
|
|
|
|
APPLICATIONS=src/mkvmerge$(EXT) src/mkvinfo$(EXT) src/mkvextract$(EXT) \
|
|
src/base64tool$(EXT) src/mmg/mmg$(EXT)
|
|
|
|
all: config.h $(APPLICATIONS)
|
|
|
|
SYSTEM_INCLUDES = -Iavilib-0.6.10 \
|
|
-I. -Ilibrmff -Isrc -Isrc/common -Isrc/input -Isrc/output
|
|
SYSTEM_LIBDIRS = -Lavilib-0.6.10 \
|
|
-Llibrmff -Lsrc/common -Lsrc/input -Lsrc/output
|
|
|
|
RUNAR = $(AR) rcu
|
|
LINK = $(LD) $(LDFLAGS) $(LIBDIRS) $(SYSTEM_LIBDIRS)
|
|
LINKSHARED = $(CXX) $(LDFLAGS) $(LIBDIRS) $(SYSTEM_LIBDIRS) \
|
|
-shared -Wl,--export-all
|
|
CXXCOMPILE = $(CXX) $(CXXFLAGS) $(INCLUDES) $(SYSTEM_INCLUDES)
|
|
CCOMPILE = $(CC) $(CFLAGS) $(INCLUDES) $(SYSTEM_INCLUDES)
|
|
|
|
ALL_SOURCES=$(wildcard avilib-0.6.10/*.c) $(wildcard librmff/*.c) \
|
|
$(wildcard src/*.cpp) $(wildcard src/input/*.cpp) \
|
|
$(wildcard src/output/*.cpp) $(wildcard src/common/*.cpp) \
|
|
$(wildcard src/mmg/*.cpp)
|
|
|
|
ifeq ($(V),1)
|
|
Q =
|
|
else
|
|
Q = @
|
|
endif
|
|
|
|
# Some general rules
|
|
%.o: %.cpp
|
|
@echo ' CXX ' $<
|
|
@if echo $@ | grep src/common > /dev/null 2>&1; then \
|
|
test x$(V) = "x1" && echo $(CXXCOMPILE) $(CXXFLAGS_SRC_COMMON) -c -o $@ $< ; \
|
|
$(CXXCOMPILE) $(CXXFLAGS_SRC_COMMON) -c -o $@ $< ; \
|
|
else \
|
|
test x$(V) = "x1" && echo $(CXXCOMPILE) $(CXXFLAGS_NO_SRC_COMMON) -c -o $@ $< ; \
|
|
$(CXXCOMPILE) $(CXXFLAGS_NO_SRC_COMMON) -c -o $@ $< ; \
|
|
fi
|
|
|
|
%.o: %.c
|
|
@echo ' CC ' $<
|
|
$(Q)$(CCOMPILE) -c -o $@ $<
|
|
|
|
%.mo: %.po
|
|
@echo ' MSGFMT ' $<
|
|
$(Q)msgfmt -o $@ $<
|
|
|
|
clean:
|
|
rm -f *.o */*.o */*/*.o */lib*.a */*/lib*.a */*/*.dll src/*.exe src/mmg/*.exe
|
|
|
|
depend:
|
|
@echo Calculating dependecies:
|
|
@rm -f .depend
|
|
@touch .depend
|
|
@for i in $(ALL_SOURCES); do \
|
|
o="`echo $$i | sed -e 's/\.c$$/.o/' -e 's/\.cpp$$/.o/'`" ; \
|
|
echo ' ' $$i: $$o ; \
|
|
$(CXX) $(CXXFLAGS) $(INCLUDES) $(SYSTEM_INCLUDES) -MM \
|
|
-MT $$o $$i >> .depend ; \
|
|
done
|
|
|
|
config.h: configure.in
|
|
@echo configure.in is newer than config.h. Re-run autogen.sh.
|
|
@false
|
|
|
|
Makefile: Makefile.mingw
|
|
@echo Makefile.mingw is newer than Makefile. Copying Makefile.mingw to
|
|
@echo Makefile. Re-run 'make' now.
|
|
@cp Makefile.mingw Makefile
|
|
@false
|
|
|
|
#
|
|
# avilib-0.6.10
|
|
#
|
|
|
|
libavi_SOURCES = $(wildcard avilib-0.6.10/*.c) $(wildcard avilib-0.6.10/*.cpp)
|
|
libavi_OBJECTS := $(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(libavi_SOURCES)))
|
|
|
|
avilib-0.6.10/libavi.a: $(libavi_OBJECTS)
|
|
@rm -f $@
|
|
@echo ' AR ' $@
|
|
$(Q)$(RUNAR) $@ $(libavi_OBJECTS)
|
|
@echo ' RANLIB ' $@
|
|
$(Q)$(RANLIB) $@
|
|
|
|
#
|
|
# librmff
|
|
#
|
|
librmff_SOURCES = $(wildcard librmff/*.c)
|
|
librmff_OBJECTS := $(patsubst %.c,%.o,$(librmff_SOURCES))
|
|
|
|
librmff/librmff.a: $(librmff_OBJECTS)
|
|
@rm -f $@
|
|
@echo ' AR ' $@
|
|
$(Q)$(RUNAR) $@ $(librmff_OBJECTS)
|
|
@echo ' RANLIB ' $@
|
|
$(Q)$(RANLIB) $@
|
|
|
|
#
|
|
# src/common
|
|
#
|
|
|
|
libmtxcommon_SOURCES = $(wildcard src/common/*.cpp)
|
|
libmtxcommon_OBJECTS := $(patsubst %.cpp,%.o,$(libmtxcommon_SOURCES))
|
|
|
|
src/common/libmtxcommon.dll: $(libmtxcommon_OBJECTS)
|
|
@echo ' LD/DLL ' $@
|
|
$(Q)$(LINKSHARED) -Wl,--out-implib=$@.a -o $@ $(libmtxcommon_OBJECTS) \
|
|
-liconv -lz $(COMPRESSION_LIBRARIES) -lmatroska -lebml -lexpat
|
|
|
|
src/common/libmtxcommon.a: $(libmtxcommon_OBJECTS)
|
|
@rm -f $@
|
|
@echo ' AR ' $@
|
|
$(Q)$(RUNAR) $@ $(libmtxcommon_OBJECTS)
|
|
@echo ' RANLIB ' $@
|
|
$(Q)$(RANLIB) $@
|
|
|
|
#
|
|
# src/input
|
|
#
|
|
|
|
libmtxinput_SOURCES = $(wildcard src/input/*.cpp)
|
|
libmtxinput_OBJECTS := $(patsubst %.cpp,%.o,$(libmtxinput_SOURCES))
|
|
|
|
src/input/libmtxinput.a: $(libmtxinput_OBJECTS)
|
|
@rm -f $@
|
|
@echo ' AR ' $@
|
|
$(Q)$(RUNAR) $@ $(libmtxinput_OBJECTS)
|
|
@echo ' RANLIB ' $@
|
|
$(Q)$(RANLIB) $@
|
|
|
|
#
|
|
# src/output
|
|
#
|
|
|
|
libmtxoutput_SOURCES = $(wildcard src/output/*.cpp)
|
|
libmtxoutput_OBJECTS := $(patsubst %.cpp,%.o,$(libmtxoutput_SOURCES))
|
|
|
|
src/output/libmtxoutput.a: $(libmtxoutput_OBJECTS)
|
|
@rm -f $@
|
|
@echo ' AR ' $@
|
|
$(Q)$(RUNAR) $@ $(libmtxoutput_OBJECTS)
|
|
@echo ' RANLIB ' $@
|
|
$(Q)$(RANLIB) $@
|
|
|
|
#
|
|
# src
|
|
#
|
|
|
|
mkvmerge_SOURCES = src/mkvmerge.cpp \
|
|
src/cluster_helper.cpp \
|
|
src/pr_generic.cpp
|
|
mkvmerge_OBJECTS := $(patsubst %.cpp,%.o,$(mkvmerge_SOURCES))
|
|
mkvmerge_DEPENDENCIES += $(DEP_COMMON) \
|
|
$(DEP_COMP) $(DEP_INPUT) $(DEP_OUTPUT) $(DEP_AVI) $(DEP_RMFF)
|
|
mkvmerge_LDADD = -lmtxinput -lmtxoutput \
|
|
-lmtxcommon -lmatroska -lebml \
|
|
-lavi -lvorbis -lFLAC -logg -lz $(COMPRESSION_LIBRARIES) \
|
|
-lexpat -liconv -lrmff
|
|
|
|
mkvinfo_SOURCES = $(wildcard src/mkvinfo*.cpp)
|
|
mkvinfo_OBJECTS := $(patsubst %.cpp,%.o,$(mkvinfo_SOURCES))
|
|
mkvinfo_DEPENDENCIES += $(DEP_COMMON)
|
|
mkvinfo_LDADD = -lmtxcommon -lmatroska -lebml \
|
|
$(WXWINDOWS_LDFLAGS) $(WXWINDOWS_LIBS) \
|
|
-liconv
|
|
|
|
mkvextract_SOURCES = $(wildcard src/mkvextract*.cpp)
|
|
mkvextract_OBJECTS := $(patsubst %.cpp,%.o,$(mkvextract_SOURCES))
|
|
mkvextract_DEPENDENCIES += $(DEP_COMMON) $(DEP_AVILIB) $(DEP_RMFF)
|
|
mkvextract_LDADD = -lmtxcommon -lvorbis -logg -lavi -lmatroska -lebml -liconv \
|
|
-lrmff -lexpat
|
|
|
|
base64tool_SOURCES = src/base64tool.cpp
|
|
base64tool_OBJECTS := $(patsubst %.cpp,%.o,$(base64tool_SOURCES))
|
|
base64tool_DEPENDENCIES += $(DEP_COMMON)
|
|
base64tool_LDADD = -lmtxcommon -liconv
|
|
|
|
mmg_SOURCES = $(wildcard src/mmg/*.cpp)
|
|
mmg_OBJECTS := $(patsubst %.cpp,%.o,$(mmg_SOURCES))
|
|
mmg_DEPENDENCIES += $(DEP_COMMON)
|
|
mmg_LDADD = -lmtxcommon -lmatroska -lebml -liconv -lexpat \
|
|
$(WXWINDOWS_LDFLAGS) $(WXWINDOWS_LIBS) \
|
|
-mwindows
|
|
|
|
src/mkvmerge$(EXT): $(mkvmerge_OBJECTS) $(mkvmerge_DEPENDENCIES)
|
|
@echo ' LINK ' $@
|
|
$(Q)$(LINK) -o $@ $(mkvmerge_OBJECTS) $(mkvmerge_LDADD)
|
|
|
|
src/mkvinfo$(EXT): $(mkvinfo_OBJECTS) $(mkvinfo_DEPENDENCIES)
|
|
@echo ' LINK ' $@
|
|
$(Q)$(LINK) -o $@ $(mkvinfo_OBJECTS) $(mkvinfo_LDADD)
|
|
|
|
src/mkvextract$(EXT): $(mkvextract_OBJECTS) $(mkvextract_DEPENDENCIES)
|
|
@echo ' LINK ' $@
|
|
$(Q)$(LINK) -o $@ $(mkvextract_OBJECTS) $(mkvextract_LDADD)
|
|
|
|
src/base64tool$(EXT): $(base64tool_OBJECTS) $(base64tool_DEPENDENCIES)
|
|
@echo ' LINK ' $@
|
|
$(Q)$(LINK) -o $@ $(base64tool_OBJECTS) $(base64tool_LDADD)
|
|
|
|
src/mmg/mmg$(EXT): $(mmg_OBJECTS) $(mmg_DEPENDENCIES)
|
|
@echo ' LINK ' $@
|
|
$(Q)$(LINK) -o $@ $(mmg_OBJECTS) $(mmg_LDADD)
|
|
|
|
#
|
|
# include dependency files if they exist
|
|
#
|
|
ifneq ($(wildcard .depend),)
|
|
include .depend
|
|
endif
|