Added a lot of options for allowing parts of mtx being compiled as DLLs.

This commit is contained in:
Moritz Bunkus 2004-01-10 17:58:24 +00:00
parent bb5ebb5412
commit a0b3aab33a
11 changed files with 142 additions and 247 deletions

View File

@ -13,39 +13,6 @@ else
SUBDIRS = avilib-0.6.10 src
endif
# And now the targets.
.PHONY: config.h
all: subdirs
subdirs:
list='$(SUBDIRS)'; \
for subdir in $$list; do \
echo "Making all in $$subdir"; \
(cd $$subdir && make -f Makefile.mingw) || exit 1; \
done
clean:
list='$(SUBDIRS)'; \
for subdir in $$list; do \
echo "Making clean in $$subdir"; \
(cd $$subdir && make -f Makefile.mingw clean) || exit 1; \
done
Makefile: Makefile.mingw
@echo Re-copying Makefile from Makefile.mingw
sed "s/-f Makefile\.mingw//g" < $< > $@
depend:
list='$(SUBDIRS)'; \
for subdir in $$list; do \
echo "Making depend in $$subdir"; \
(cd $$subdir && make -f Makefile.mingw depend) || exit 1; \
done
#
# include dependency files if they exist
#
ifneq ($(wildcard .depend),)
include .depend
endif
include Makefile.mingw.common

48
Makefile.mingw.common Normal file
View File

@ -0,0 +1,48 @@
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)
# Some general rules
.cpp.o:
$(CXXCOMPILE) -c -o $@ $<
.c.o:
$(CCOMPILE) -c -o $@ $<
subdirs:
list='$(SUBDIRS)'; \
for subdir in $$list; do \
echo "Making all in $$subdir"; \
(cd $$subdir && make -f Makefile.mingw) || exit 1; \
done
clean:
list='$(SUBDIRS)'; \
for subdir in $$list; do \
echo "Making clean in $$subdir"; \
(cd $$subdir && make -f Makefile.mingw clean) || exit 1; \
done
rm -f *.o lib*.a $(EXTRA_CLEAN)
depend:
list='$(SUBDIRS)'; \
for subdir in $$list; do \
echo "Making depend in $$subdir"; \
(cd $$subdir && make -f Makefile.mingw depend) || exit 1; \
done
ifneq (,$(ALL_SOURCES))
$(CXX) $(CXXFLAGS) $(INCLUDES) $(SYSTEM_INCLUDES) -MM \
$(ALL_SOURCES) > .depend
endif
#
# include dependency files if they exist
#
ifneq ($(wildcard .depend),)
include .depend
endif

View File

@ -3,7 +3,7 @@ TOP=c:/cygwin/usr/local/src/mkvtoolnix
INCLUDES = -Ic:/cygwin/usr/local/src/libebml \
-Ic:/cygwin/usr/local/src/libmatroska \
-Ic:/cygwin/usr/local/include
LIBRARIES = -Lc:/cygwin/usr/local/src/libebml/make/mingw32 \
LIBDIRS = -Lc:/cygwin/usr/local/src/libebml/make/mingw32 \
-Lc:/cygwin/usr/local/src/libmatroska/make/mingw32 \
-Lc:/cygwin/usr/local/lib
@ -20,6 +20,12 @@ COMPRESSION_LIBS = bzlib lzo
#CXXFLAGS =
#LDFLAGS =
# Have libebml and libmatroska been compiled as DLLs?
#CXXFLAGS += -DEBML_DLL -DMATROSKA_DLL
# Build mkvtoolnix with DLLs?
#MTX_DLLS = yes
# Activate debugging options?
DEBUG = yes
@ -31,6 +37,7 @@ CXX = g++.exe
CC = gcc.exe
LD = g++.exe
AR = ar.exe
RANLIB = ranlib.exe
#
# Don't chagen anything below this line.
@ -53,7 +60,7 @@ CXXFLAGS += -DHAVE_BZLIB_H=1
COMPRESSION_LIBRARIES = -lbz2
endif
ifneq (,$(findstring bzlib,$(LZO_LIBS)))
ifneq (,$(findstring lzo,$(LZO_LIBS)))
CXXFLAGS += -DHAVE_LZO1X_H=1
COMPRESSION_LIBRARIES += -llzo1x
endif
@ -65,10 +72,16 @@ WXWINDOWS_CFLAGS = $(shell wx-config --cflags)
WXWINDOWS_LDFLAGS = $(shell wx-config --ldflags)
endif
ifneq (,$(findstring yes,$(MTX_DLLS)))
DEP_COMMON = $(TOP)/src/common/libmtxcommon.dll
DEP_EBMLCOMMON = $(TOP)/src/common/libmtxebmlcommon.dll
DEP_KAXCOMMON = $(TOP)/src/common/libmtxkaxcommon.dll
CXXFLAGS += MTX_DLL
else
DEP_COMMON = $(TOP)/src/common/libmtxcommon.a
DEP_EBMLCOMMON = $(TOP)/src/common/libmtxebmlcommon.a
DEP_KAXCOMMON = $(TOP)/src/common/libmtxkaxcommon.a
DEP_COMP = $(TOP)/src/common/libmtxcomp.a
endif
DEP_INPUT = $(TOP)/src/input/libmtxinput.a
DEP_OUTPUT = $(TOP)/src/output/libmtxoutput.a
DEP_AVILIB = $(TOP)/avilib-0.6.10/libavi.a

View File

@ -27,17 +27,24 @@ if gcc -v 2>&1 | grep -i mingw > /dev/null 2> /dev/null; then
echo ''
for i in `find -name Makefile.mingw`; do
n=`echo $i | sed 's/\.mingw$//'`
n=`echo $i | sed 's/\.mingw//'`
echo "Creating $n from $i"
sed "s/-f Makefile\.mingw//g" < $i > $n
sed -e "s/Makefile.mingw.common/Makefile.common/g" < $i > $n
done
echo "Creating config.h from config.h.mingw"
cp config.h.mingw config.h
echo ''
echo "Creating Makefile.common from Makefile.mingw.common"
sed -e "s!-f Makefile.mingw!!g" < Makefile.mingw.common > Makefile.common
echo 'Creating dependencies (calling "make depend")'
echo ''
make depend
if test "x$1" = "x"; then
echo "Creating config.h from config.h.mingw"
cp config.h.mingw config.h
echo ''
echo 'Creating dependencies (calling "make depend")'
echo ''
make depend
else
echo 'Not creating config.h.'
echo 'Not creating the dependencies.'
fi
exit $?
fi

View File

@ -8,39 +8,20 @@ ifneq (,$(findstring aviclasses,$(AVILIB)))
LIBRARIES = libaviclasses.a
endif
SYSTEM_INCLUDES = -I$(TOP) -$(TOP)/aviclasses -I$(TOP)/src/common
SYSTEM_INCLUDES = -I$(TOP) -I$(TOP)/aviclasses -I$(TOP)/src/common
libaviclasses_SOURCES = AVIReadHandler.cpp \
AVIIndex.cpp \
list.cpp
libaviclasses_OBJECTS := $(patsubst %.cpp,%.o,$(libaviclasses_SOURCES))
RUNAR = $(AR) rcu
.cpp.o:
$(CXX) $(CXXFLAGS) $(INCLUDES) $(SYSTEM_INCLUDES) -c -o $@ $<
ALL_SOURCES = $(libaviclasses_SOURCES)
all: $(LIBRARIES)
include ../Makefile.mingw.common
libaviclasses.a: $(libaviclasses_OBJECTS)
rm -f $@
$(RUNAR) $@ $(libaviclasses_OBJECTS)
ranlib $@
clean:
rm -f *.o $(LIBRARIES)
Makefile: Makefile.mingw
@echo Re-copying Makefile from Makefile.mingw
sed "s/-f Makefile\.mingw//g" < $< > $@
depend:
$(CXX) $(CXXFLAGS) $(INCLUDES) $(SYSTEM_INCLUDES) -MM \
$(libaviclasses_SOURCES) > .depend
#
# include dependency files if they exist
#
ifneq ($(wildcard .depend),)
include .depend
endif
$(RANLIB) $@

View File

@ -13,32 +13,13 @@ libavi_SOURCES = avidump.c \
avimisc.c
libavi_OBJECTS := $(patsubst %.c,%.o,$(libavi_SOURCES))
RUNAR = $(AR) rcu
.c.o:
$(CC) $(CFLAGS) $(INCLUDES) $(SYSTEM_INCLUDES) -c -o $@ $<
ALL_SOURCES = $(libavi_SOURCES)
all: $(LIBRARIES)
include ../Makefile.mingw.common
libavi.a: $(libavi_OBJECTS)
rm -f $@
$(RUNAR) $@ $(libavi_OBJECTS)
ranlib $@
clean:
rm -f *.o $(LIBRARIES) .depend
Makefile: Makefile.mingw
@echo Re-copying Makefile from Makefile.mingw
sed "s/-f Makefile\.mingw//g" < $< > $@
depend:
$(CC) $(CFLAGS) $(INCLUDES) $(SYSTEM_INCLUDES) -MM \
$(libavi_SOURCES) > .depend
#
# include dependency files if they exist
#
ifneq ($(wildcard .depend),)
include .depend
endif
$(RANLIB) $@

View File

@ -19,21 +19,21 @@ mkvmerge_SOURCES = mkvmerge.cpp \
mkvmerge_OBJECTS := $(patsubst %.cpp,%.o,$(mkvmerge_SOURCES))
mkvmerge_DEPENDENCIES += $(DEP_COMMON) $(DEP_EBMLCOMMON) $(DEP_KAXCOMMON) \
$(DEP_COMP) $(DEP_INPUT) $(DEP_OUTPUT) $(DEP_AVI)
mkvmerge_LDADD = -lmtxinput -lmtxoutput -lmtxcomp \
mkvmerge_LDADD = -lmtxinput -lmtxoutput \
-lmtxkaxcommon -lmtxebmlcommon -lmtxcommon \
-lmatroska -lebml \
-lavi $(AVICLASSES_LIBDIRS) $(AVICLASSES_LIBRARIES) \
-lvorbis -lflac -logg \
-liconv -lexpat \
-lz $(COMPRESSION_LIBRARIES)
-lvorbis -lflac -logg -lz $(COMPRESSION_LIBRARIES) \
-lexpat -liconv
mkvinfo_SOURCES = mkvinfo.cpp \
mkvinfo_gui.cpp \
mkvinfo_tag_types.cpp
mkvinfo_OBJECTS := $(patsubst %.cpp,%.o,$(mkvinfo_SOURCES))
mkvinfo_DEPENDENCIES += $(DEP_COMMON) $(DEP_EBMLCOMMON)
mkvinfo_LDADD = -lmtxebmlcommon -lmtxcommon -lmatroska -lebml -liconv \
$(WXWINDOWS_LDFLAGS) $(WXWINDOWS_LIBS)
mkvinfo_LDADD = -lmtxebmlcommon -lmtxcommon -lmatroska -lebml \
$(WXWINDOWS_LDFLAGS) $(WXWINDOWS_LIBS) \
-liconv
mkvextract_SOURCES = mkvextract.cpp \
mkvextract_attachments.cpp \
@ -43,29 +43,24 @@ mkvextract_SOURCES = mkvextract.cpp \
mkvextract_OBJECTS := $(patsubst %.cpp,%.o,$(mkvextract_SOURCES))
mkvextract_DEPENDENCIES += $(DEP_COMMON) $(DEP_EBMLCOMMON) $(DEP_KAXCOMMON) \
$(DEP_AVILIB)
mkvextract_LDADD = -lmtxebmlcommon -lmtxkaxcommon -lmtxcommon -lebml -liconv \
-lvorbis -logg -lavi -lmatroska -lebml
mkvextract_LDADD = -lmtxebmlcommon -lmtxkaxcommon -lmtxcommon \
-lvorbis -logg -lavi -lmatroska -lebml -liconv
base64tool_SOURCES = base64tool.cpp
base64tool_OBJECTS := $(patsubst %.cpp,%.o,$(base64tool_SOURCES))
base64tool_DEPENDENCIES += $(DEP_COMMON) $(DEP_EBMLCOMMON)
base64tool_LDADD = -lmtxebmlcommon -lmtxcommon -lebml -liconv
base64tool_LDADD = -lmtxcommon -lmtxebmlcommon -liconv
# Definitions that are needed before the inclusions.
SUBDIRS = common input output mmg
LINK = $(LD) $(LDFLAGS) $(LIBRARIES) $(SYSTEM_LIBDIRS)
.cpp.o:
$(CXX) $(CXXFLAGS) $(INCLUDES) $(SYSTEM_INCLUDES) -c -o $@ $<
ALL_SOURCES = $(mkvmerge_SOURCES) $(mkvinfo_SOURCES) $(mkvextract_SOURCES) \
$(base64tool_SOURCES)
EXTRA_CLEAN = $(PROGRAMS)
all: subdirs $(PROGRAMS)
subdirs:
list='$(SUBDIRS)'; \
for subdir in $$list; do \
echo "Making all in $$subdir"; \
(cd $$subdir && make -f Makefile.mingw) || exit 1; \
done
# Include the common stuff.
include ../Makefile.mingw.common
mkvmerge: $(mkvmerge_OBJECTS) $(mkvmerge_DEPENDENCIES)
$(LINK) -o $@ $(mkvmerge_OBJECTS) $(mkvmerge_LDADD)
@ -78,33 +73,3 @@ mkvextract: $(mkvextract_OBJECTS) $(mkvextract_DEPENDENCIES)
base64tool: $(base64tool_OBJECTS) $(base64tool_DEPENDENCIES)
$(LINK) -o $@ $(base64tool_OBJECTS) $(base64tool_LDADD)
clean:
list='$(SUBDIRS)'; \
for subdir in $$list; do \
echo "Making clean in $$subdir"; \
(cd $$subdir && make -f Makefile.mingw clean) || exit 1; \
done
rm -f *.o $(PROGRAMS)
Makefile: Makefile.mingw
@echo Re-copying Makefile from Makefile.mingw
sed "s/-f Makefile\.mingw//g" < $< > $@
depend:
list='$(SUBDIRS)'; \
for subdir in $$list; do \
echo "Making depend in $$subdir"; \
(cd $$subdir && make -f Makefile.mingw depend) || exit 1; \
done
$(CXX) $(CXXFLAGS) $(INCLUDES) $(SYSTEM_INCLUDES) -MM \
$(mkvmerge_SOURCES) $(mkvinfo_SOURCES) $(mkvextract_SOURCES) \
$(base64tool_SOURCES) > .depend
#
# include dependency files if they exist
#
ifneq ($(wildcard .depend),)
include .depend
endif

View File

@ -4,8 +4,12 @@
# Put all the user changeable options into one file
include ../../Makefile.mingw.options
LIBRARIES = libmtxcommon.a libmtxebmlcommon.a libmtxkaxcommon.a \
libmtxcomp.a
ifneq (,$(findstring yes,$(MTX_DLLS)))
LIBRARIES = libmtxcommon.dll libmtxebmlcommon.dll libmtxkaxcommon.dll
CXXFLAGS += -DMTX_DLL_EXPORT
else
LIBRARIES = libmtxcommon.a libmtxebmlcommon.a libmtxkaxcommon.a
endif
SYSTEM_INCLUDES = -I$(TOP) -I$(TOP)/src -I$(TOP)/src/common
@ -13,6 +17,7 @@ libmtxcommon_SOURCES = base64.cpp \
aac_common.cpp \
ac3_common.cpp \
common.cpp \
compression.cpp \
dts_common.cpp \
iso639.cpp \
mp3_common.cpp
@ -30,51 +35,37 @@ libmtxkaxcommon_SOURCES = chapters.cpp \
tagwriter.cpp
libmtxkaxcommon_OBJECTS := $(patsubst %.cpp,%.o,$(libmtxkaxcommon_SOURCES))
libmtxcomp_SOURCES = compression.cpp
libmtxcomp_OBJECTS := $(patsubst %.cpp,%.o,$(libmtxcomp_SOURCES))
RUNAR = $(AR) rcu
.cpp.o:
$(CXX) $(CXXFLAGS) $(INCLUDES) $(SYSTEM_INCLUDES) -c -o $@ $<
ALL_SOURCES = $(libmtxcommon_SOURCES) $(libmtxebmlcommon_SOURCES) \
$(libmtxkaxcommon_SOURCES)
EXTRA_CLEAN = lib*.dll
all: $(LIBRARIES)
include ../../Makefile.common
libmtxcommon.dll: $(libmtxcommon_OBJECTS)
$(LINKSHARED) -Wl,--out-implib=$@.a -o $@ $(libmtxcommon_OBJECTS) \
-liconv -lz $(COMPRESSION_LIBRARIES)
libmtxebmlcommon.dll: $(libmtxebmlcommon_OBJECTS)
$(LINKSHARED) -Wl,--out-implib=$@.a -o $@ $(libmtxebmlcommon_OBJECTS) \
-L. -lmtxcommon -lebml
libmtxkaxcommon.dll: $(libmtxkaxcommon_OBJECTS)
$(LINKSHARED) -Wl,--out-implib=$@.a -o $@ $(libmtxkaxcommon_OBJECTS) \
-L. -lmtxcommon -lmatroska -lebml -lmtxebmlcommon -lexpat
libmtxcommon.a: $(libmtxcommon_OBJECTS)
rm -f $@
$(RUNAR) $@ $(libmtxcommon_OBJECTS)
ranlib $@
$(RANLIB) $@
libmtxebmlcommon.a: $(libmtxebmlcommon_OBJECTS)
rm -f $@
$(RUNAR) $@ $(libmtxebmlcommon_OBJECTS)
ranlib $@
$(RANLIB) $@
libmtxkaxcommon.a: $(libmtxkaxcommon_OBJECTS)
rm -f $@
$(RUNAR) $@ $(libmtxkaxcommon_OBJECTS)
ranlib $@
libmtxcomp.a: $(libmtxcomp_OBJECTS)
rm -f $@
$(RUNAR) $@ $(libmtxcomp_OBJECTS)
ranlib $@
clean:
rm -f *.o $(LIBRARIES)
Makefile: Makefile.mingw
@echo Re-copying Makefile from Makefile.mingw
sed "s/-f Makefile\.mingw//g" < $< > $@
depend:
$(CXX) $(CXXFLAGS) $(INCLUDES) $(SYSTEM_INCLUDES) -MM \
$(libmtxcommon_SOURCES) $(libmtxebmlcommon_SOURCES) \
$(libmtxkaxcommon_SOURCES) $(libmtxcomp_SOURCES) > .depend
#
# include dependency files if they exist
#
ifneq ($(wildcard .depend),)
include .depend
endif
$(RANLIB) $@

View File

@ -28,33 +28,13 @@ libmtxinput_SOURCES = r_aac.cpp \
subtitles.cpp
libmtxinput_OBJECTS := $(patsubst %.cpp,%.o,$(libmtxinput_SOURCES))
RUNAR = $(AR) rcu
.cpp.o:
$(CXX) $(CXXFLAGS) $(INCLUDES) $(SYSTEM_INCLUDES) -c -o $@ $<
ALL_SOURCES = $(libmtxinput_SOURCES)
all: $(LIBRARIES)
include ../../Makefile.common
libmtxinput.a: $(libmtxinput_OBJECTS)
rm -f $@
$(RUNAR) $@ $(libmtxinput_OBJECTS)
ranlib $@
clean:
rm -f *.o $(LIBRARIES)
Makefile: Makefile.mingw
@echo Re-copying Makefile from Makefile.mingw
sed "s/-f Makefile\.mingw//g" < $< > $@
depend:
$(CXX) $(CXXFLAGS) $(INCLUDES) $(SYSTEM_INCLUDES) -MM \
$(libmtxinput_SOURCES) > .depend
#
# include dependency files if they exist
#
ifneq ($(wildcard .depend),)
include .depend
endif
$(RANLIB) $@

View File

@ -27,30 +27,12 @@ mmg_LDADD = -lmtxkaxcommon -lmtxebmlcommon -lmtxcommon \
$(WXWINDOWS_LDFLAGS) $(WXWINDOWS_LIBS) \
-mwindows
LINK = $(LD) $(LDFLAGS) $(LIBRARIES) $(SYSTEM_LIBDIRS)
.cpp.o:
$(CXX) $(CXXFLAGS) $(INCLUDES) $(SYSTEM_INCLUDES) -c -o $@ $<
ALL_SOURCES = $(mmg_SOURCES)
EXTRA_CLEAN = $(PROGRAMS)
all: $(PROGRAMS)
include ../../Makefile.common
mmg: $(mmg_OBJECTS) $(mmg_DEPENDENCIES)
$(LINK) -o $@ $(mmg_OBJECTS) $(mmg_LDADD)
clean:
rm -f *.o $(PROGRAMS)
Makefile: Makefile.mingw
@echo Re-copying Makefile from Makefile.mingw
sed "s/-f Makefile\.mingw//g" < $< > $@
depend:
$(CXX) $(CXXFLAGS) $(INCLUDES) $(SYSTEM_INCLUDES) -MM \
$(mmg_SOURCES) > .depend
#
# include dependency files if they exist
#
ifneq ($(wildcard .depend),)
include .depend
endif

View File

@ -24,33 +24,13 @@ libmtxoutput_SOURCES = p_aac.cpp \
p_vorbis.cpp
libmtxoutput_OBJECTS := $(patsubst %.cpp,%.o,$(libmtxoutput_SOURCES))
RUNAR = $(AR) rcu
.cpp.o:
$(CXX) $(CXXFLAGS) $(INCLUDES) $(SYSTEM_INCLUDES) -c -o $@ $<
ALL_SOURCES = $(libmtxoutput_SOURCES)
all: $(LIBRARIES)
include ../../Makefile.common
libmtxoutput.a: $(libmtxoutput_OBJECTS)
rm -f $@
$(RUNAR) $@ $(libmtxoutput_OBJECTS)
ranlib $@
clean:
rm -f *.o $(LIBRARIES)
Makefile: Makefile.mingw
@echo Re-copying Makefile from Makefile.mingw
sed "s/-f Makefile\.mingw//g" < $< > $@
depend:
$(CXX) $(CXXFLAGS) $(INCLUDES) $(SYSTEM_INCLUDES) -MM \
$(libmtxoutput_SOURCES) > .depend
#
# include dependency files if they exist
#
ifneq ($(wildcard .depend),)
include .depend
endif