From 82657735ce6d97ce61cc817241a544a805d94663 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 27 Jul 2010 21:49:51 +0200 Subject: [PATCH] Build system for the 'src/tools' directory --- Rakefile | 64 ++++++++++++++++++++++++++++++++++++++++++++-- src/tools/Makefile | 57 ----------------------------------------- src/tools/Rakefile | 6 +++++ 3 files changed, 68 insertions(+), 59 deletions(-) delete mode 100644 src/tools/Makefile create mode 100644 src/tools/Rakefile diff --git a/Rakefile b/Rakefile index b94e6f1d3..06f88f0bb 100644 --- a/Rakefile +++ b/Rakefile @@ -22,6 +22,7 @@ require "rake.d/library" def setup_globals $programs = %w{mkvmerge mkvinfo mkvextract mkvpropedit} $programs << "mmg" if c?(:USE_WXWIDGETS) + $tools = %w{base64tool diracparser ebml_validator vc1parser} $application_subdirs = { "mmg" => "mmg/" } $applications = $programs.collect { |name| "src/#{$application_subdirs[name]}#{name}" + c(:EXEEXT) } @@ -56,6 +57,8 @@ def setup_globals :manpages => FileList[ "#{$top_srcdir }/doc/man/po4a/po/*.po" ].collect { |name| File.basename name, '.po' }, :guides => FileList[ "#{$top_srcdir }/doc/guide/*/mkvmerge-gui.html" ].collect { |name| File.basename File.dirname(name) }, } + + $build_tools ||= c?(:TOOLS) end def define_default_task @@ -64,6 +67,9 @@ def define_default_task # The applications themselves targets = $applications.clone + # Build the stuff in the 'src/tools' directory only if requested + targets << "apps:tools" if $build_tools + # The tags file -- but only if it exists already targets << "TAGS" if File.exist? "TAGS" @@ -314,11 +320,12 @@ end # Cleaning tasks desc "Remove all compiled files" task :clean do + tools = $tools.collect { |name| "src/tools/#{name}" }.join " " run <<-SHELL, :allow_failure => true - rm -f *.o */*.o */*/*.o */lib*.a */*/lib*.a po/*.mo #{$applications.join(" ")} + rm -f *.o */*.o */*/*.o */lib*.a */*/lib*.a po/*.mo */*.exe */*/*.exe */*/*.dll */*/*.dll.a doc/guide/*/*.hhk src/info/ui/*.h src/info/*.moc.cpp src/common/*/*.o - src/mmg/*/*.o + src/mmg/*/*.o #{$applications.join(" ")} #{tools} SHELL end @@ -453,3 +460,56 @@ if c?(:USE_WXWIDGETS) libraries(:rpcrt4, :ole32, :shell32, "-mwindows", :if => c?(:MINGW)). create end + +# +# Applications in src/tools +# +if $build_tools + namespace :apps do + task :tools => $tools.collect { |name| "apps:tools:#{name}" } + end + + # + # tools: base64tool + # + Application.new("src/tools/base64tool"). + description("Build the base64tool executable"). + aliases("tools:base64tool"). + sources("src/tools/base64tool.cpp"). + libraries(:mtxcommon, :magic, :matroska, :ebml, :expat, :iconv, :intl, :boost_regex). + libraries(:rpcrt4, :if => c?(:MINGW)). + create + + # + # tools: diracparser + # + Application.new("src/tools/diracparser"). + description("Build the diracparser executable"). + aliases("tools:diracparser"). + sources("src/tools/diracparser.cpp"). + libraries(:mtxcommon, :magic, :matroska, :ebml, :expat, :iconv, :intl, :boost_regex). + libraries(:rpcrt4, :if => c?(:MINGW)). + create + + # + # tools: ebml_validator + # + Application.new("src/tools/ebml_validator"). + description("Build the ebml_validator executable"). + aliases("tools:ebml_validator"). + sources("src/tools/ebml_validator.cpp", "src/tools/element_info.cpp"). + libraries(:mtxcommon, :magic, :matroska, :ebml, :expat, :iconv, :intl, :boost_regex). + libraries(:rpcrt4, :if => c?(:MINGW)). + create + + # + # tools: vc1parser + # + Application.new("src/tools/vc1parser"). + description("Build the vc1parser executable"). + aliases("tools:vc1parser"). + sources("src/tools/vc1parser.cpp"). + libraries(:mtxcommon, :magic, :matroska, :ebml, :expat, :iconv, :intl, :boost_regex). + libraries(:rpcrt4, :if => c?(:MINGW)). + create +end diff --git a/src/tools/Makefile b/src/tools/Makefile deleted file mode 100644 index 431577b71..000000000 --- a/src/tools/Makefile +++ /dev/null @@ -1,57 +0,0 @@ -all_with_tools: - +make -C .. TOOLS=1 - -APPLICATIONS += src/tools/base64tool$(EXEEXT) src/tools/diracparser$(EXEEXT) src/tools/vc1parser$(EXEEXT) src/tools/ebml_validator$(EXEEXT) -ALL_SOURCES += $(wildcard src/tools/*.cpp) - -vc1parser_SOURCES = src/tools/vc1parser.cpp -vc1parser_OBJECTS = $(patsubst %.cpp,%.o,$(vc1parser_SOURCES)) -vc1parser_DEPENDENCIES = $(DEP_COMMON) -vc1parser_LDADD = -lmtxcommon $(MAGIC_LIBS) -lmatroska -lebml \ - -lz $(COMPRESSION_LIBRARIES) -lexpat $(ICONV_LIBS) \ - $(LIBINTL_LIBS) $(LIBRPCRT) $(BOOST_REGEX_LIB) - -diracparser_SOURCES = src/tools/diracparser.cpp -diracparser_OBJECTS = $(patsubst %.cpp,%.o,$(diracparser_SOURCES)) -diracparser_DEPENDENCIES = $(DEP_COMMON) -diracparser_LDADD = -lmtxcommon $(MAGIC_LIBS) -lmatroska -lebml \ - -lz $(COMPRESSION_LIBRARIES) -lexpat $(ICONV_LIBS) \ - $(LIBINTL_LIBS) $(LIBRPCRT) $(BOOST_REGEX_LIB) - -base64tool_SOURCES = src/tools/base64tool.cpp -base64tool_OBJECTS = $(patsubst %.cpp,%.o,$(base64tool_SOURCES)) -base64tool_DEPENDENCIES += $(DEP_COMMON) -base64tool_LDADD = -lmtxcommon $(MAGIC_LIBS) -lmatroska -lebml -lexpat $(ICONV_LIBS) \ - $(LIBINTL_LIBS) $(LIBRPCRT) $(BOOST_REGEX_LIB) - -ebml_validator_SOURCES = src/tools/ebml_validator.cpp src/tools/element_info.cpp -ebml_validator_OBJECTS = $(patsubst %.cpp,%.o,$(ebml_validator_SOURCES)) -ebml_validator_DEPENDENCIES = $(DEP_COMMON) -ebml_validator_LDADD = -lmtxcommon $(MAGIC_LIBS) -lmatroska -lebml \ - -lz $(COMPRESSION_LIBRARIES) -lexpat $(ICONV_LIBS) \ - $(LIBINTL_LIBS) $(LIBRPCRT) $(BOOST_REGEX_LIB) - - -base64tool: src/tools/base64tool$(EXEEXT) - -src/tools/base64tool$(EXEEXT): $(base64tool_OBJECTS) $(base64tool_DEPENDENCIES) - @echo ' LINK ' $@ - $(Q)$(LINK) -o $@ $(base64tool_OBJECTS) $(base64tool_LDADD) - -diracparser: src/tools/diracparser$(EXEEXT) - -src/tools/diracparser$(EXEEXT): $(diracparser_OBJECTS) $(diracparser_DEPENDENCIES) - @echo ' LINK ' $@ - $(Q)$(LINK) -o $@ $(diracparser_OBJECTS) $(diracparser_LDADD) - -vc1parser: src/tools/vc1parser$(EXEEXT) - -src/tools/vc1parser$(EXEEXT): $(vc1parser_OBJECTS) $(vc1parser_DEPENDENCIES) - @echo ' LINK ' $@ - $(Q)$(LINK) -o $@ $(vc1parser_OBJECTS) $(vc1parser_LDADD) - -ebml_validator: src/tools/ebml_validator$(EXEEXT) - -src/tools/ebml_validator$(EXEEXT): $(ebml_validator_OBJECTS) $(ebml_validator_DEPENDENCIES) - @echo ' LINK ' $@ - $(Q)$(LINK) -o $@ $(ebml_validator_OBJECTS) $(ebml_validator_LDADD) diff --git a/src/tools/Rakefile b/src/tools/Rakefile new file mode 100644 index 000000000..cdaf003ff --- /dev/null +++ b/src/tools/Rakefile @@ -0,0 +1,6 @@ +#!/usr/bin/env rake +# -*- mode: ruby; -*- + +$build_tools = true + +import File.dirname(__FILE__) + "/../../Rakefile"