[parted-devel] [PATCH] Fix non-srcdir build in git tree

Jim Meyering jim at meyering.net
Tue Jan 10 11:50:43 UTC 2012


Jim Meyering wrote:
> Keshav P R wrote:
>>      I have attached the patch that adds -I$(top_builddir)/include to
>> partedincludedir in all Makefile.am files to fix non-srcdir build. Please apply
>> it. Thanks in advance.
>
> Thanks.
> I'll apply the essence of that shortly.
> It exposed excessive duplication in the fs/*/Makefile.am files,
> which I'm removing with this patch:
>
>>From f8cae064c36d7086d6894a348eb80bcb7fe64835 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering at redhat.com>
> Date: Tue, 10 Jan 2012 11:48:52 +0100
> Subject: [PATCH] maint: hoist libparted/fs/*/Makefile.am into parent
>  Makefile.am
>
> There was no need to have a separate Makefile.am for each file system
> type, and a good reason *not* to do that (reduce duplication).
> * configure.ac (AC_OUTPUT): Remove Makefiles.
> * libparted/fs/Makefile.am (SUBDIRS): Remove.
> (EXTRA_DIST): List the two non-src files: hfs/DOC hfs/HISTORY.
> (libfs_la_SOURCES): Hoist file names to here from...
> * libparted/fs/amiga/Makefile.am: ...here.
> * libparted/fs/ext2/Makefile.am: Likewise.
> * libparted/fs/fat/Makefile.am: Likewise.
> * libparted/fs/hfs/Makefile.am: Likewise.
> * libparted/fs/jfs/Makefile.am: Likewise.
> * libparted/fs/linux_swap/Makefile.am: Likewise.
> * libparted/fs/nilfs2/Makefile.am: Likewise.
> * libparted/fs/ntfs/Makefile.am: Likewise.
> * libparted/fs/reiserfs/Makefile.am: Likewise.
> * libparted/fs/ufs/Makefile.am: Likewise.
> * libparted/fs/xfs/Makefile.am: Likewise.
> * libparted/fs/*/Makefile.am: Remove files.
> * libparted/fs/amiga/a-interface.c: Now that the .o files are all

With those Makefile.am files removed, there's less work required
for your patch.  Also, I've made it so the builddir precedes the
srcdir, in case a developer changes anything in an .in.h file.
Then, we'll use the just-generated file in top_builddir, not
the stale one in top_srcdir.


>From e4f14df66735ad4f9eb2b7cd0a3f07fbf30a02f7 Mon Sep 17 00:00:00 2001
From: Keshav P R <the.ridikulus.rat at gmail.com>
Date: Tue, 10 Jan 2012 12:38:31 +0100
Subject: [PATCH 2/2] build: insert -I$(top_builddir)/include before
 -I$(top_srcdir)/include

everywhere, for those who perform non-srcdir builds from a pristine
cloned directory.  There is no problem when building from a tarball,
since that includes include/parted/*.h files under $(top_srcdir).
* libparted/Makefile.am: Insert it.
* libparted/fs/Makefile.am: Likewise.
* libparted/labels/Makefile.am: Likewise.
* libparted/tests/Makefile.am: Likewise.
* parted/Makefile.am: Likewise.
* partprobe/Makefile.am: Likewise.
* tests/Makefile.am: Likewise.
---
 libparted/Makefile.am        |    5 +++--
 libparted/fs/Makefile.am     |    2 +-
 libparted/labels/Makefile.am |    3 ++-
 libparted/tests/Makefile.am  |    1 +
 parted/Makefile.am           |    3 ++-
 partprobe/Makefile.am        |    3 ++-
 tests/Makefile.am            |    1 +
 7 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/libparted/Makefile.am b/libparted/Makefile.am
index 4bc1939..bb7cc0e 100644
--- a/libparted/Makefile.am
+++ b/libparted/Makefile.am
@@ -18,8 +18,9 @@ AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
 SUBDIRS       = labels fs . $(SUBDIRS_CHECK)


-partedincludedir      = -I$(top_srcdir)/lib -I$(top_srcdir)/include
-lib_LTLIBRARIES	      =	libparted.la
+partedincludedir = \
+  -I$(top_srcdir)/lib -I$(top_builddir)/include -I$(top_srcdir)/include
+lib_LTLIBRARIES	= libparted.la

 # Set the shared library version, per Libtool's guidelines.
 # For details, see the "Updating library version information" section of
diff --git a/libparted/fs/Makefile.am b/libparted/fs/Makefile.am
index 0ce838c..1a3599a 100644
--- a/libparted/fs/Makefile.am
+++ b/libparted/fs/Makefile.am
@@ -3,7 +3,7 @@
 #
 # This file may be modified and/or distributed without restriction.

-partedincludedir      =	-I$(top_srcdir)/include
+partedincludedir = -I$(top_builddir)/include -I$(top_srcdir)/include
 noinst_LTLIBRARIES    =	libfs.la
 libfs_la_LDFLAGS  = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
 			-release $(LT_RELEASE)
diff --git a/libparted/labels/Makefile.am b/libparted/labels/Makefile.am
index 967e537..7fe347b 100644
--- a/libparted/labels/Makefile.am
+++ b/libparted/labels/Makefile.am
@@ -12,7 +12,8 @@ endif
 AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)

 partedincludedir = \
-  -I$(top_srcdir)/lib -I$(top_srcdir)/include -I$(top_srcdir)/libparted
+  -I$(top_srcdir)/lib -I$(top_builddir)/include -I$(top_srcdir)/include \
+  -I$(top_srcdir)/libparted
 noinst_LTLIBRARIES    =	liblabels.la

 liblabels_la_SOURCES = \
diff --git a/libparted/tests/Makefile.am b/libparted/tests/Makefile.am
index de8d03e..d857cdb 100644
--- a/libparted/tests/Makefile.am
+++ b/libparted/tests/Makefile.am
@@ -15,6 +15,7 @@ LDADD = \
 AM_CPPFLAGS = \
   $(CHECK_CFLAGS) \
   -I$(top_srcdir)/lib \
+  -I$(top_builddir)/include \
   -I$(top_srcdir)/include

 label_SOURCES = common.h common.c label.c
diff --git a/parted/Makefile.am b/parted/Makefile.am
index 7b093c6..0b23693 100644
--- a/parted/Makefile.am
+++ b/parted/Makefile.am
@@ -3,7 +3,8 @@ BUILT_SOURCES =
 sbin_PROGRAMS = parted

 AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
-partedincludedir      = -I$(top_srcdir)/lib -I$(top_srcdir)/include
+partedincludedir = \
+  -I$(top_srcdir)/lib -I$(top_builddir)/include -I$(top_srcdir)/include

 parted_SOURCES = command.c	\
 		 command.h	\
diff --git a/partprobe/Makefile.am b/partprobe/Makefile.am
index f140991..7e3dea2 100644
--- a/partprobe/Makefile.am
+++ b/partprobe/Makefile.am
@@ -1,4 +1,5 @@
-partedincludedir      = -I$(top_srcdir)/lib -I$(top_srcdir)/include
+partedincludedir = \
+  -I$(top_srcdir)/lib -I$(top_builddir)/include -I$(top_srcdir)/include

 AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
 sbin_PROGRAMS = partprobe
diff --git a/tests/Makefile.am b/tests/Makefile.am
index f442204..34b3bc5 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -74,6 +74,7 @@ LDADD = \
   $(top_builddir)/libparted/libparted.la
 AM_CPPFLAGS = \
   -I$(top_srcdir)/lib \
+  -I$(top_builddir)/include \
   -I$(top_srcdir)/include
 AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)

--
1.7.9.rc0.2.g4b783



More information about the parted-devel mailing list