Mercurial > octave
changeset 23427:48fd5980e29a
Refactor and normalize generated build info source files
* Makefile.am (build-info-commands): New macro to generate build info source
files containing hg revision.
* libgui/module.mk (EXTRA_libgui_liboctgui_la_SOURCES): Delete variable
referencing unnecessary dummy source file.
(libgui_liboctgui_la_CPPFLAGS, libgui_liboctgui_la_CFLAGS,
libgui_liboctgui_la_CXXFLAGS): New compilation variables.
(libgui_CLEANFILES, libgui_EXTRA_DIST, nodist_libgui_liboctgui_la_SOURCES,
noinst_HEADERS): Include libgui/liboctgui-build-info.* files moved from
libgui/src.
(libgui/liboctgui-build-info.cc): Redefine rule moved from libgui/src/module.mk
using $(build-info-commands).
* libgui/src/module.mk (libgui_CLEANFILES, libgui_EXTRA_DIST,
nodist_libgui_src_libgui_src_la_SOURCES, noinst_HEADERS): Remove
libgui/src/liboctgui-build-info.* files moved to libgui.
(libgui/src/liboctgui-build-info.cc): Delete rule.
* libinterp/module.mk (libinterp/liboctinterp-build-info.cc): Redefine using
$(build-info-commands).
* liboctave/module.mk (EXTRA_liboctave_liboctave_la_SOURCES): Delete variable
referencing unnecessary dummy source file.
(liboctave/liboctave-build-info.cc): Redefine using $(build-info-commands).
* src/module.mk (OCTAVE_GUI_CPPFLAGS): Include -I$(srcdir)/libgui in the list.
(src/octave-build-info.cc): Redefine using $(build-info-commands).
* libgui/liboctgui-build-info.h, libgui/liboctgui-build-info.in.cc: Move from
libgui/src.
* libgui/.dummy_force_cxx_link.cc, liboctave/.dummy_force_cxx_link.cc: Delete.
author | Mike Miller <mtmiller@octave.org> |
---|---|
date | Sat, 22 Apr 2017 14:11:40 -0700 |
parents | 58d56f52d50a |
children | b976347c1341 |
files | Makefile.am libgui/.dummy_force_cxx_link.cc libgui/liboctgui-build-info.h libgui/liboctgui-build-info.in.cc libgui/module.mk libgui/src/liboctgui-build-info.h libgui/src/liboctgui-build-info.in.cc libgui/src/module.mk libinterp/module.mk liboctave/.dummy_force_cxx_link.cc liboctave/module.mk src/module.mk |
diffstat | 10 files changed, 103 insertions(+), 107 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile.am Sat Apr 22 08:12:54 2017 -0400 +++ b/Makefile.am Sat Apr 22 14:11:40 2017 -0700 @@ -456,6 +456,14 @@ fi endef +define build-info-commands + rm -f $@-t && \ + $(SED) \ + -e "s|%NO_EDIT_WARNING%|DO NOT EDIT! Generated automatically by Makefile|" \ + -e "s|%OCTAVE_HG_ID%|$(HG_ID_VAR)|" $< > $@-t && \ + $(simple_move_if_change_rule) +endef + define simple-filter-rule rm -f $@-t $@ && \ ${SHELL} $(1) < $< > $@-t && \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/liboctgui-build-info.h Sat Apr 22 14:11:40 2017 -0700 @@ -0,0 +1,34 @@ +/* + +Copyright (C) 2016-2017 M. Muetzel + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3 of the License, or +(at your option) any later version. + +Octave is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +#if ! defined (octave_liboctgui_build_info_h) +#define octave_liboctgui_build_info_h 1 + +#include "octave-config.h" + +#include <ctime> + +#include <string> + +extern std::string liboctgui_hg_id (void); + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/liboctgui-build-info.in.cc Sat Apr 22 14:11:40 2017 -0700 @@ -0,0 +1,34 @@ +// %NO_EDIT_WARNING% +/* + +Copyright (C) 2016-2017 M. Muetzel + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3 of the License, or +(at your option) any later version. + +Octave is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include "liboctgui-build-info.h" + +std::string +liboctgui_hg_id (void) +{ + return "%OCTAVE_HG_ID%"; +}
--- a/libgui/module.mk Sat Apr 22 08:12:54 2017 -0400 +++ b/libgui/module.mk Sat Apr 22 14:11:40 2017 -0700 @@ -33,16 +33,25 @@ LOCALES = $(patsubst libgui/languages/%.ts, libgui/languages/%.qm, $(TRANSLATIONS)) +noinst_HEADERS += \ + libgui/liboctgui-build-info.h + include libgui/src/module.mk include libgui/graphics/module.mk include libgui/qterminal-module.mk -## liboctgui merely collects a bunch of compiled convenience libraries. -## It has no source code itself. -libgui_liboctgui_la_SOURCES = +nodist_libgui_liboctgui_la_SOURCES = \ + libgui/liboctgui-build-info.cc -# Dummy C++ source to force C++ linking. -EXTRA_libgui_liboctgui_la_SOURCES = libgui/.dummy_force_cxx_link.cc +libgui_liboctgui_la_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + @OCTGUI_DLL_DEFS@ \ + -Ilibgui \ + -I$(srcdir)/libgui + +libgui_liboctgui_la_CFLAGS = $(AM_CFLAGS) $(WARN_CFLAGS) + +libgui_liboctgui_la_CXXFLAGS = $(AM_CXXFLAGS) $(WARN_CXXFLAGS) libgui_liboctgui_la_LIBADD = \ libgui/qterminal/libqterminal.la \ @@ -120,10 +129,14 @@ libgui_EXTRA_DIST += \ $(TRANSLATIONS) \ - libgui/default-qt-settings.in + libgui/default-qt-settings.in \ + libgui/liboctgui-build-info.in.cc EXTRA_DIST += $(libgui_EXTRA_DIST) +libgui_CLEANFILES += \ + libgui/liboctgui-build-info.cc + libgui_DISTCLEANFILES += \ libgui/default-qt-settings \ $(LOCALES) @@ -140,4 +153,7 @@ libgui-maintainer-clean: libgui-distclean rm -f $(libgui_MAINTAINERCLEANFILES) + +libgui/liboctgui-build-info.cc: libgui/liboctgui-build-info.in.cc HG-ID | libgui/$(octave_dirstamp) + $(AM_V_GEN)$(build-info-commands) endif
--- a/libgui/src/liboctgui-build-info.h Sat Apr 22 08:12:54 2017 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* - -Copyright (C) 2016-2017 M. Muetzel - -This file is part of Octave. - -Octave is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 3 of the License, or -(at your option) any later version. - -Octave is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. - -*/ - -#if ! defined (octave_liboctgui_build_info_h) -#define octave_liboctgui_build_info_h 1 - -#include "octave-config.h" - -#include <ctime> - -#include <string> - -extern std::string liboctgui_hg_id (void); - -#endif
--- a/libgui/src/liboctgui-build-info.in.cc Sat Apr 22 08:12:54 2017 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -// %NO_EDIT_WARNING% -/* - -Copyright (C) 2016-2017 M. Muetzel - -This file is part of Octave. - -Octave is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 3 of the License, or -(at your option) any later version. - -Octave is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. - -*/ - -#if defined (HAVE_CONFIG_H) -# include "config.h" -#endif - -#include "liboctgui-build-info.h" - -std::string -liboctgui_hg_id (void) -{ - return "%OCTAVE_HG_ID%"; -}
--- a/libgui/src/module.mk Sat Apr 22 08:12:54 2017 -0400 +++ b/libgui/src/module.mk Sat Apr 22 14:11:40 2017 -0700 @@ -147,7 +147,6 @@ libgui/src/external-editor-interface.h \ libgui/src/files-dock-widget.h \ libgui/src/history-dock-widget.h \ - libgui/src/liboctgui-build-info.h \ libgui/src/m-editor/file-editor-interface.h \ libgui/src/m-editor/file-editor-tab.h \ libgui/src/m-editor/file-editor.h \ @@ -205,7 +204,6 @@ libgui/src/workspace-view.cc nodist_libgui_src_libgui_src_la_SOURCES = \ - libgui/src/liboctgui-build-info.cc \ $(octave_gui_MOC) \ $(octave_gui_RC) @@ -238,7 +236,6 @@ noinst_LTLIBRARIES += libgui/src/libgui-src.la libgui_EXTRA_DIST += \ - libgui/src/liboctgui-build-info.in.cc \ libgui/src/resource.qrc \ $(octave_gui_UI) \ $(octave_gui_ICONS) @@ -246,12 +243,4 @@ libgui_CLEANFILES += \ $(octave_gui_MOC) \ $(octave_gui_UI_H) \ - $(octave_gui_RC) \ - libgui/src/liboctgui-build-info.cc - -libgui/src/liboctgui-build-info.cc: libgui/src/liboctgui-build-info.in.cc HG-ID | libgui/src/$(octave_dirstamp) - $(AM_V_GEN)rm -f $@-t && \ - $(SED) \ - -e "s|%NO_EDIT_WARNING%|DO NOT EDIT! Generated automatically by Makefile|" \ - -e "s|%OCTAVE_HG_ID%|$(HG_ID_VAR)|" $< > $@-t && \ - $(simple_move_if_change_rule) + $(octave_gui_RC)
--- a/libinterp/module.mk Sat Apr 22 08:12:54 2017 -0400 +++ b/libinterp/module.mk Sat Apr 22 14:11:40 2017 -0700 @@ -245,11 +245,7 @@ $(AM_V_GEN)$(call simple-filter-rule,build-aux/mk-version-h.sh) libinterp/liboctinterp-build-info.cc: libinterp/liboctinterp-build-info.in.cc HG-ID | libinterp/$(octave_dirstamp) - $(AM_V_GEN)rm -f $@-t && \ - $(SED) \ - -e "s|%NO_EDIT_WARNING%|DO NOT EDIT! Generated automatically by Makefile|" \ - -e "s|%OCTAVE_HG_ID%|$(HG_ID_VAR)|" $< > $@-t && \ - $(simple_move_if_change_rule) + $(AM_V_GEN)$(build-info-commands) if AMCOND_ENABLE_DYNAMIC_LINKING mkbuiltins_dld_opt =
--- a/liboctave/module.mk Sat Apr 22 08:12:54 2017 -0400 +++ b/liboctave/module.mk Sat Apr 22 14:11:40 2017 -0700 @@ -65,14 +65,9 @@ include liboctave/util/module.mk include liboctave/wrappers/module.mk -## liboctave merely collects a bunch of compiled convenience libraries. -## It has no source code itself. nodist_liboctave_liboctave_la_SOURCES = \ liboctave/liboctave-build-info.cc -# Dummy C++ source to force C++ linking. -EXTRA_liboctave_liboctave_la_SOURCES = liboctave/.dummy_force_cxx_link.cc - liboctave_liboctave_la_LIBADD += \ libgnu/libgnu.la \ $(LIBOCTAVE_LINK_DEPS) @@ -110,11 +105,7 @@ nobase_liboctavetests_DATA = $(LIBOCTAVE_TST_FILES) liboctave/liboctave-build-info.cc: liboctave/liboctave-build-info.in.cc HG-ID | liboctave/$(octave_dirstamp) - $(AM_V_GEN)rm -f $@-t && \ - $(SED) \ - -e "s|%NO_EDIT_WARNING%|DO NOT EDIT! Generated automatically by Makefile|" \ - -e "s|%OCTAVE_HG_ID%|$(HG_ID_VAR)|" $< > $@-t && \ - $(simple_move_if_change_rule) + $(AM_V_GEN)$(build-info-commands) OCTAVE_INTERPRETER_TARGETS += \ $(LIBOCTAVE_TST_FILES)
--- a/src/module.mk Sat Apr 22 08:12:54 2017 -0400 +++ b/src/module.mk Sat Apr 22 14:11:40 2017 -0700 @@ -106,7 +106,7 @@ src_octave_gui_SOURCES = src/main-gui.cc nodist_src_octave_gui_SOURCES = src/octave-build-info.cc OCTAVE_GUI_LIBS = libgui/liboctgui.la - OCTAVE_GUI_CPPFLAGS = -Ilibgui/src -I$(srcdir)/libgui/src + OCTAVE_GUI_CPPFLAGS = -I$(srcdir)/libgui -Ilibgui/src -I$(srcdir)/libgui/src endif src_octave_gui_CPPFLAGS = \ @@ -206,11 +206,7 @@ $(AM_V_GEN)$(call simple-filter-rule,build-aux/subst-default-vals.sh) src/octave-build-info.cc: src/octave-build-info.in.cc HG-ID | src/$(octave_dirstamp) - $(AM_V_GEN)rm -f $@-t && \ - $(SED) \ - -e "s|%NO_EDIT_WARNING%|DO NOT EDIT! Generated automatically by Makefile|" \ - -e "s|%OCTAVE_HG_ID%|$(HG_ID_VAR)|" $< > $@-t && \ - $(simple_move_if_change_rule) + $(AM_V_GEN)$(build-info-commands) ALL_LOCAL_TARGETS += $(OCTAVE_CROSS_TOOLS)