Unified the build system again.

This commit is contained in:
Moritz Bunkus 2004-11-14 12:41:02 +00:00
parent 55ef898d62
commit fed7ef7dba
2 changed files with 49 additions and 20 deletions

View File

@ -93,7 +93,16 @@ AVILIB_INCLUDES = -Iavilib-0.6.10
AVILIB_LIBDIRS = -Lavilib-0.6.10 AVILIB_LIBDIRS = -Lavilib-0.6.10
DEP_AVILIB = avilib-0.6.10/libavi.a DEP_AVILIB = avilib-0.6.10/libavi.a
DEP_COMMON = src/common/libmtxcommon.a LIBMTXCOMMONDLL=@LIBMTXCOMMONDLL@
ifeq (1,$(LIBMTXCOMMONDLL))
LIBMTXCOMMONEXT = dll
CXXFLAGS_SRC_COMMON += -DMTX_DLL_EXPORT
CXXFLAGS_NO_SRC_COMMON += -DMTX_DLL
else
LIBMTXCOMMONEXT = a
endif
DEP_COMMON = src/common/libmtxcommon.$(LIBMTXCOMMONEXT)
DEP_EBMLCOMMON = src/common/libmtxebmlcommon.a DEP_EBMLCOMMON = src/common/libmtxebmlcommon.a
DEP_KAXCOMMON = src/common/libmtxkaxcommon.a DEP_KAXCOMMON = src/common/libmtxkaxcommon.a
DEP_INPUT = src/input/libmtxinput.a DEP_INPUT = src/input/libmtxinput.a
@ -103,10 +112,11 @@ DEP_RMFF = librmff/librmff.a
DEP_MPEGPARSER = src/mpegparser/libmpegparser.a DEP_MPEGPARSER = src/mpegparser/libmpegparser.a
COMPRESSION_LIBRARIES = $(LZO_LIBS) $(BZ2_LIBS) COMPRESSION_LIBRARIES = $(LZO_LIBS) $(BZ2_LIBS)
APPLICATIONS = src/mkvmerge src/mkvinfo src/mkvextract src/base64tool APPLICATIONS = src/mkvmerge@EXEEXT@ src/mkvinfo@EXEEXT@ \
src/mkvextract@EXEEXT@ src/base64tool@EXEEXT@
MANPAGES = doc/mkvmerge.1 doc/mkvinfo.1 doc/mkvextract.1 doc/base64tool.1 MANPAGES = doc/mkvmerge.1 doc/mkvinfo.1 doc/mkvextract.1 doc/base64tool.1
ifeq (yes,$(USE_WXWINDOWS)) ifeq (yes,$(USE_WXWINDOWS))
APPLICATIONS += src/mmg/mmg APPLICATIONS += src/mmg/mmg@EXEEXT@
MANPAGES += doc/mmg.1 MANPAGES += doc/mmg.1
endif endif
@ -155,6 +165,8 @@ SYSTEM_LIBDIRS = $(AVILIB_LIBDIRS) \
RUNAR = $(AR) rcu RUNAR = $(AR) rcu
LINK = $(CXX) $(LDFLAGS) $(LIBDIRS) $(SYSTEM_LIBDIRS) LINK = $(CXX) $(LDFLAGS) $(LIBDIRS) $(SYSTEM_LIBDIRS)
LINKSHARED = $(CXX) $(LDFLAGS) $(LIBDIRS) $(SYSTEM_LIBDIRS) \
-shared -Wl,--export-all
CXXCOMPILE = $(CXX) $(CXXFLAGS) $(INCLUDES) $(SYSTEM_INCLUDES) CXXCOMPILE = $(CXX) $(CXXFLAGS) $(INCLUDES) $(SYSTEM_INCLUDES)
CCOMPILE = $(CC) $(CFLAGS) $(INCLUDES) $(SYSTEM_INCLUDES) CCOMPILE = $(CC) $(CFLAGS) $(INCLUDES) $(SYSTEM_INCLUDES)
@ -173,9 +185,21 @@ else
endif endif
# Some general rules # Some general rules
ifeq (1,$(LIBMTXCOMMONDLL))
%.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
else
%.o: %.cpp %.o: %.cpp
@echo ' CXX ' $< @echo ' CXX ' $<
$(Q)$(CXXCOMPILE) -c -o $@ $< $(Q)$(CXXCOMPILE) -c -o $@ $<
endif
%.o: %.c %.o: %.c
@echo ' CC ' $< @echo ' CC ' $<
@ -186,10 +210,11 @@ endif
$(Q)msgfmt -o $@ $< $(Q)msgfmt -o $@ $<
clean: clean:
rm -f *.o */*.o */*/*.o */lib*.a */*/lib*.a po/*.mo $(APPLICATIONS) rm -f *.o */*.o */*/*.o */lib*.a */*/lib*.a po/*.mo $(APPLICATIONS) \
*/*.exe */*/*.exe */*/*.dll */*/*.dll.a
distclean dist-clean: clean distclean dist-clean: clean
rm -f configure config.h config.h.in config.log \ rm -f configure config.h config.h.in config.log config.cache \
Makefile */Makefile */*/Makefile Makefile */Makefile */*/Makefile
depend: depend:
@ -355,23 +380,23 @@ mmg_DEPENDENCIES += $(DEP_COMMON)
mmg_LDADD = -lmtxcommon -lmatroska -lebml -lexpat $(ICONV_LIBS) \ mmg_LDADD = -lmtxcommon -lmatroska -lebml -lexpat $(ICONV_LIBS) \
$(WXWINDOWS_LIBS) $(LIBINTL_LIBS) $(WXWINDOWS_LIBS) $(LIBINTL_LIBS)
src/mkvmerge: $(mkvmerge_OBJECTS) $(mkvmerge_DEPENDENCIES) src/mkvmerge@EXEEXT@: $(mkvmerge_OBJECTS) $(mkvmerge_DEPENDENCIES)
@echo ' LINK ' $@ @echo ' LINK ' $@
$(Q)$(LINK) -o $@ $(mkvmerge_OBJECTS) $(mkvmerge_LDADD) $(Q)$(LINK) -o $@ $(mkvmerge_OBJECTS) $(mkvmerge_LDADD)
src/mkvinfo: $(mkvinfo_OBJECTS) $(mkvinfo_DEPENDENCIES) src/mkvinfo@EXEEXT@: $(mkvinfo_OBJECTS) $(mkvinfo_DEPENDENCIES)
@echo ' LINK ' $@ @echo ' LINK ' $@
$(Q)$(LINK) -o $@ $(mkvinfo_OBJECTS) $(mkvinfo_LDADD) $(Q)$(LINK) -o $@ $(mkvinfo_OBJECTS) $(mkvinfo_LDADD)
src/mkvextract: $(mkvextract_OBJECTS) $(mkvextract_DEPENDENCIES) src/mkvextract@EXEEXT@: $(mkvextract_OBJECTS) $(mkvextract_DEPENDENCIES)
@echo ' LINK ' $@ @echo ' LINK ' $@
$(Q)$(LINK) -o $@ $(mkvextract_OBJECTS) $(mkvextract_LDADD) $(Q)$(LINK) -o $@ $(mkvextract_OBJECTS) $(mkvextract_LDADD)
src/base64tool: $(base64tool_OBJECTS) $(base64tool_DEPENDENCIES) src/base64tool@EXEEXT@: $(base64tool_OBJECTS) $(base64tool_DEPENDENCIES)
@echo ' LINK ' $@ @echo ' LINK ' $@
$(Q)$(LINK) -o $@ $(base64tool_OBJECTS) $(base64tool_LDADD) $(Q)$(LINK) -o $@ $(base64tool_OBJECTS) $(base64tool_LDADD)
src/mmg/mmg: $(mmg_OBJECTS) $(mmg_DEPENDENCIES) src/mmg/mmg@EXEEXT@: $(mmg_OBJECTS) $(mmg_DEPENDENCIES)
@echo ' LINK ' $@ @echo ' LINK ' $@
$(Q)$(LINK) -o $@ $(mmg_OBJECTS) $(mmg_LDADD) $(Q)$(LINK) -o $@ $(mmg_OBJECTS) $(mmg_LDADD)

View File

@ -174,10 +174,14 @@ AC_CACHE_CHECK([if being compiled with mingw32],
if test "x$ac_cv_mingw32" = "xyes"; then if test "x$ac_cv_mingw32" = "xyes"; then
export MINGW=1 export MINGW=1
MINGW_GUIAPP=-mwindows MINGW_GUIAPP=-mwindows
LIBMTXCOMMONDLL=1
else
LIBMTXCOMMONDLL=0
fi fi
AC_SUBST(MINGW_LIBS) AC_SUBST(MINGW_LIBS)
AC_SUBST(MINGW_GUIAPP) AC_SUBST(MINGW_GUIAPP)
AC_SUBST(LIBMTXCOMMONDLL)
dnl dnl
@ -186,7 +190,7 @@ dnl can be typedef'ed manually.
dnl dnl
AC_MSG_CHECKING(for int64_t) AC_MSG_CHECKING(for int64_t)
AC_LANG_PUSH(C++) AC_LANG_PUSH(C++)
AC_CACHE_VAL(has_int64_t,[ AC_CACHE_VAL(ac_cv_has_int64_t,[
AC_TRY_COMPILE([ AC_TRY_COMPILE([
#if HAVE_INTTYPES_H #if HAVE_INTTYPES_H
# include <inttypes.h> # include <inttypes.h>
@ -199,13 +203,13 @@ AC_CACHE_VAL(has_int64_t,[
#endif #endif
], ],
[int64_t foo;], [int64_t foo;],
has_int64_t=yes, ac_cv_has_int64_t=yes,
has_int64_t=no) ac_cv_has_int64_t=no)
]) ])
AC_MSG_RESULT($has_int64_t) AC_MSG_RESULT($ac_cv_has_int64_t)
AC_MSG_CHECKING(for uint64_t) AC_MSG_CHECKING(for uint64_t)
AC_CACHE_VAL(has_uint64_t,[ AC_CACHE_VAL(ac_cv_has_uint64_t,[
AC_TRY_COMPILE([ AC_TRY_COMPILE([
#if HAVE_INTTYPES_H #if HAVE_INTTYPES_H
# include <inttypes.h> # include <inttypes.h>
@ -218,17 +222,17 @@ AC_CACHE_VAL(has_uint64_t,[
#endif #endif
], ],
[int64_t foo;], [int64_t foo;],
has_uint64_t=yes, ac_cv_has_uint64_t=yes,
has_uint64_t=no) ac_cv_has_uint64_t=no)
]) ])
AC_MSG_RESULT($has_uint64_t) AC_MSG_RESULT($ac_cv_has_uint64_t)
AC_LANG_POP AC_LANG_POP
AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long) AC_CHECK_SIZEOF(long long)
if test x$has_int64_t = "xyes" ; then if test x$ac_cv_has_int64_t = "xyes" ; then
TYPE64="int64_t" TYPE64="int64_t"
else else
case 8 in case 8 in
@ -241,7 +245,7 @@ else
[the type to define int64_t manually]) [the type to define int64_t manually])
fi fi
if test x$has_uint64_t = "xyes" ; then if test x$ac_cv_has_uint64_t = "xyes" ; then
TYPEU64="int64_t" TYPEU64="int64_t"
else else
case 8 in case 8 in