Skip to content

Commit

Permalink
build: Add common-rules.mk, common rules for all Makefiles.
Browse files Browse the repository at this point in the history
This file is mainly a central place to:

 - include localenv if it exists, and

 - define the RHEL 5 backwards compatibility macros, instead of
   spreading them over every other file.

(cherry picked from commit 49bdaab)
  • Loading branch information
rwmjones committed Jun 14, 2013
1 parent 92cf512 commit 7bc6702
Show file tree
Hide file tree
Showing 30 changed files with 56 additions and 73 deletions.
1 change: 1 addition & 0 deletions Makefile.am
Expand Up @@ -18,6 +18,7 @@
-include $(top_builddir)/localenv -include $(top_builddir)/localenv


include $(top_srcdir)/subdir-rules.mk include $(top_srcdir)/subdir-rules.mk
include $(top_srcdir)/common-rules.mk


ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4


Expand Down
3 changes: 0 additions & 3 deletions appliance/Makefile.am
Expand Up @@ -15,9 +15,6 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


# Old RHEL 5 autoconf doesn't have builddir.
builddir ?= .

include $(top_srcdir)/subdir-rules.mk include $(top_srcdir)/subdir-rules.mk


EXTRA_DIST = \ EXTRA_DIST = \
Expand Down
29 changes: 29 additions & 0 deletions common-rules.mk
@@ -0,0 +1,29 @@
# libguestfs
# Copyright (C) 2013 Red Hat Inc.
#
# This program 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 2 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

# 'common-rules.mk' should be included in every Makefile.am.
# cf. 'subdir-rules.mk'

-include $(top_builddir)/localenv

# Old RHEL 5 autoconf defines these, but RHEL 5 automake doesn't
# create variables for them. So define them here if they're not
# defined already.
builddir ?= @builddir@
abs_builddir ?= @abs_builddir@
srcdir ?= @srcdir@
abs_srcdir ?= @abs_srcdir@
2 changes: 2 additions & 0 deletions erlang/examples/Makefile.am
Expand Up @@ -15,6 +15,8 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


include $(top_srcdir)/subdir-rules.mk

EXTRA_DIST = \ EXTRA_DIST = \
LICENSE \ LICENSE \
create_disk.erl \ create_disk.erl \
Expand Down
2 changes: 2 additions & 0 deletions examples/Makefile.am
Expand Up @@ -15,6 +15,8 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


include $(top_srcdir)/subdir-rules.mk

EXTRA_DIST = \ EXTRA_DIST = \
LICENSE \ LICENSE \
guestfs-examples.pod \ guestfs-examples.pod \
Expand Down
9 changes: 1 addition & 8 deletions generator/Makefile.am
Expand Up @@ -15,14 +15,7 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


# Old RHEL 5 autoconf doesn't have abs_builddir. include $(top_srcdir)/subdir-rules.mk
abs_builddir ?= $(shell pwd)

# Old RHEL 5 autoconf doesn't have abs_srcdir.
abs_srcdir ?= $(shell cd $(top_srcdir)/generator && pwd)

# Old RHEL 5 autoconf doesn't have builddir.
builddir ?= .


# In alphabetical order. # In alphabetical order.
sources = \ sources = \
Expand Down
9 changes: 1 addition & 8 deletions gobject/docs/Makefile.am
Expand Up @@ -15,14 +15,7 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


# Old RHEL 5 autoconf doesn't have builddir. include $(top_srcdir)/subdir-rules.mk
builddir ?= .

# Old RHEL 5 autoconf doesn't have abs_srcdir.
abs_srcdir ?= $(shell cd $(top_srcdir)/gobject/docs && pwd)

# Old RHEL 5 autoconf doesn't have abs_builddir.
abs_builddir ?= $(shell pwd)


# The name of the module, e.g. 'glib'. # The name of the module, e.g. 'glib'.
DOC_MODULE=guestfs DOC_MODULE=guestfs
Expand Down
3 changes: 0 additions & 3 deletions inspector/Makefile.am
Expand Up @@ -15,9 +15,6 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


# Old RHEL 5 autoconf doesn't have builddir.
builddir ?= .

include $(top_srcdir)/subdir-rules.mk include $(top_srcdir)/subdir-rules.mk


export EXAMPLE_XML = \ export EXAMPLE_XML = \
Expand Down
3 changes: 0 additions & 3 deletions java/Makefile.am
Expand Up @@ -15,9 +15,6 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


# Old RHEL 5 autoconf doesn't have builddir.
builddir ?= .

include $(top_srcdir)/subdir-rules.mk include $(top_srcdir)/subdir-rules.mk


java_prefix = com/redhat/et/libguestfs java_prefix = com/redhat/et/libguestfs
Expand Down
2 changes: 2 additions & 0 deletions java/examples/Makefile.am
Expand Up @@ -15,6 +15,8 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


include $(top_srcdir)/subdir-rules.mk

EXTRA_DIST = \ EXTRA_DIST = \
LICENSE \ LICENSE \
CreateDisk.java \ CreateDisk.java \
Expand Down
2 changes: 2 additions & 0 deletions lua/examples/Makefile.am
Expand Up @@ -15,6 +15,8 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


include $(top_srcdir)/subdir-rules.mk

EXTRA_DIST = \ EXTRA_DIST = \
LICENSE \ LICENSE \
create_disk.lua \ create_disk.lua \
Expand Down
6 changes: 0 additions & 6 deletions ocaml/Makefile.am
Expand Up @@ -15,12 +15,6 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


# Old RHEL 5 autoconf doesn't have builddir.
builddir ?= .

# Old RHEL 5 autoconf doesn't have abs_srcdir.
abs_srcdir ?= $(shell cd $(top_srcdir)/ocaml && pwd)

include $(top_srcdir)/subdir-rules.mk include $(top_srcdir)/subdir-rules.mk


generator_built = \ generator_built = \
Expand Down
2 changes: 2 additions & 0 deletions ocaml/examples/Makefile.am
Expand Up @@ -15,6 +15,8 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


include $(top_srcdir)/subdir-rules.mk

EXTRA_DIST = \ EXTRA_DIST = \
LICENSE \ LICENSE \
create_disk.ml \ create_disk.ml \
Expand Down
2 changes: 2 additions & 0 deletions perl/examples/Makefile.am
Expand Up @@ -15,6 +15,8 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


include $(top_srcdir)/subdir-rules.mk

EXTRA_DIST = \ EXTRA_DIST = \
LICENSE \ LICENSE \
create_disk.pl \ create_disk.pl \
Expand Down
3 changes: 0 additions & 3 deletions php/Makefile.am
Expand Up @@ -17,9 +17,6 @@


include $(top_srcdir)/subdir-rules.mk include $(top_srcdir)/subdir-rules.mk


# Old RHEL 5 autoconf doesn't have abs_srcdir.
abs_srcdir ?= $(shell cd $(top_srcdir)/php && pwd)

generator_built = \ generator_built = \
extension/php_guestfs_php.h \ extension/php_guestfs_php.h \
extension/guestfs_php.c extension/guestfs_php.c
Expand Down
2 changes: 2 additions & 0 deletions po-docs/Makefile.am
Expand Up @@ -15,6 +15,8 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


include $(top_srcdir)/subdir-rules.mk

# XXX The use of po4a is naive here. Also we should integrate this # XXX The use of po4a is naive here. Also we should integrate this
# into the po/ directory and the translations into the usual # into the po/ directory and the translations into the usual
# libguestfs.pot file. # libguestfs.pot file.
Expand Down
2 changes: 2 additions & 0 deletions po-docs/ja/Makefile.am
Expand Up @@ -19,6 +19,8 @@
# identical. If you create a new $lang.po, create the $lang/ # identical. If you create a new $lang.po, create the $lang/
# subdirectory and copy the Makefile.am from an existing language. # subdirectory and copy the Makefile.am from an existing language.


include $(top_srcdir)/subdir-rules.mk

LINGUA = $(shell basename -- `pwd`) LINGUA = $(shell basename -- `pwd`)


CLEANFILES = *.1 *.3 stamp-update-po CLEANFILES = *.1 *.3 stamp-update-po
Expand Down
2 changes: 2 additions & 0 deletions po-docs/uk/Makefile.am
Expand Up @@ -19,6 +19,8 @@
# identical. If you create a new $lang.po, create the $lang/ # identical. If you create a new $lang.po, create the $lang/
# subdirectory and copy the Makefile.am from an existing language. # subdirectory and copy the Makefile.am from an existing language.


include $(top_srcdir)/subdir-rules.mk

LINGUA = $(shell basename -- `pwd`) LINGUA = $(shell basename -- `pwd`)


CLEANFILES = *.1 *.3 stamp-update-po CLEANFILES = *.1 *.3 stamp-update-po
Expand Down
3 changes: 0 additions & 3 deletions po/Makefile.am
Expand Up @@ -17,9 +17,6 @@


include $(top_srcdir)/subdir-rules.mk include $(top_srcdir)/subdir-rules.mk


# Old RHEL 5 autoconf doesn't have abs_srcdir.
abs_srcdir ?= $(shell cd $(top_srcdir)/po && pwd)

DOMAIN = $(PACKAGE_NAME) DOMAIN = $(PACKAGE_NAME)
COPYRIGHT_HOLDER = Red Hat Inc. COPYRIGHT_HOLDER = Red Hat Inc.
MSGID_BUGS_ADDRESS = https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools MSGID_BUGS_ADDRESS = https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools
Expand Down
3 changes: 0 additions & 3 deletions python/Makefile.am
Expand Up @@ -15,9 +15,6 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


# Old RHEL 5 autoconf doesn't have builddir.
builddir ?= .

include $(top_srcdir)/subdir-rules.mk include $(top_srcdir)/subdir-rules.mk


generator_built = \ generator_built = \
Expand Down
2 changes: 2 additions & 0 deletions python/examples/Makefile.am
Expand Up @@ -15,6 +15,8 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


include $(top_srcdir)/subdir-rules.mk

EXTRA_DIST = \ EXTRA_DIST = \
LICENSE \ LICENSE \
create_disk.py \ create_disk.py \
Expand Down
6 changes: 0 additions & 6 deletions resize/Makefile.am
Expand Up @@ -15,12 +15,6 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


# Old RHEL 5 autoconf doesn't have builddir.
builddir ?= .

# Old RHEL 5 autoconf doesn't have abs_srcdir.
abs_srcdir ?= $(shell cd $(top_srcdir)/resize && pwd)

include $(top_srcdir)/subdir-rules.mk include $(top_srcdir)/subdir-rules.mk


EXTRA_DIST = \ EXTRA_DIST = \
Expand Down
3 changes: 0 additions & 3 deletions ruby/Makefile.am
Expand Up @@ -15,9 +15,6 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


# Old RHEL 5 autoconf doesn't have builddir.
builddir ?= .

include $(top_srcdir)/subdir-rules.mk include $(top_srcdir)/subdir-rules.mk


generator_built = \ generator_built = \
Expand Down
2 changes: 2 additions & 0 deletions ruby/examples/Makefile.am
Expand Up @@ -15,6 +15,8 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


include $(top_srcdir)/subdir-rules.mk

EXTRA_DIST = \ EXTRA_DIST = \
LICENSE \ LICENSE \
create_disk.rb \ create_disk.rb \
Expand Down
6 changes: 0 additions & 6 deletions sparsify/Makefile.am
Expand Up @@ -17,12 +17,6 @@


include $(top_srcdir)/subdir-rules.mk include $(top_srcdir)/subdir-rules.mk


# Old RHEL 5 autoconf doesn't have builddir.
builddir ?= .

# Old RHEL 5 autoconf doesn't have abs_srcdir.
abs_srcdir ?= $(shell cd $(top_srcdir)/sparsify && pwd)

EXTRA_DIST = \ EXTRA_DIST = \
$(SOURCES) \ $(SOURCES) \
virt-sparsify.pod \ virt-sparsify.pod \
Expand Down
2 changes: 2 additions & 0 deletions subdir-rules.mk
Expand Up @@ -15,6 +15,8 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


include $(top_srcdir)/common-rules.mk

# Define a force dependency which will always be rebuilt # Define a force dependency which will always be rebuilt
.PHONY: force .PHONY: force


Expand Down
9 changes: 0 additions & 9 deletions sysprep/Makefile.am
Expand Up @@ -15,15 +15,6 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


# Old RHEL 5 autoconf doesn't have builddir.
builddir ?= .

# Old RHEL 5 autoconf doesn't have abs_srcdir.
abs_srcdir ?= $(shell cd $(top_srcdir)/sysprep && pwd)

# Old RHEL 5 autoconf doesn't have abs_builddir.
abs_builddir ?= $(shell pwd)

include $(top_srcdir)/subdir-rules.mk include $(top_srcdir)/subdir-rules.mk


EXTRA_DIST = \ EXTRA_DIST = \
Expand Down
3 changes: 0 additions & 3 deletions tests/data/Makefile.am
Expand Up @@ -15,9 +15,6 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


# Old RHEL 5 autoconf doesn't have builddir.
builddir ?= .

include $(top_srcdir)/subdir-rules.mk include $(top_srcdir)/subdir-rules.mk


EXTRA_DIST = \ EXTRA_DIST = \
Expand Down
3 changes: 0 additions & 3 deletions tests/guests/Makefile.am
Expand Up @@ -15,9 +15,6 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


# Old RHEL 5 autoconf doesn't have builddir.
builddir ?= .

include $(top_srcdir)/subdir-rules.mk include $(top_srcdir)/subdir-rules.mk


EXTRA_DIST = \ EXTRA_DIST = \
Expand Down
3 changes: 0 additions & 3 deletions tests/xml/Makefile.am
Expand Up @@ -15,9 +15,6 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


# Old RHEL 5 autoconf doesn't have abs_srcdir.
abs_srcdir ?= $(shell cd $(top_srcdir)/tests/xml && pwd)

include $(top_srcdir)/subdir-rules.mk include $(top_srcdir)/subdir-rules.mk


if HAVE_LIBVIRT if HAVE_LIBVIRT
Expand Down

0 comments on commit 7bc6702

Please sign in to comment.