summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2012-01-09 19:42:49 +0100
committerJim Meyering <meyering@redhat.com>2012-01-09 20:39:35 +0100
commite977fafd31d61a6fca60e20b86f536048fdaa68e (patch)
tree54e1d835cae45b7aee8db436368e053174493ed9 /include
parentace74051ebdadd2d6d428948af1982543149ae79 (diff)
downloadparted-e977fafd31d61a6fca60e20b86f536048fdaa68e.tar.gz
maint: rename public .h files to .in.h
Generate .h files from .in.h files, so that we can continue to use _GL_ATTRIBUTE_PURE and _GL_ATTRIBUTE_CONST in the primary sources, without including them in publicly-installed files. Each generated (and later installed) header file gets expansions of those macros. * include/parted/Makefile.am: New rules. * .gitignore: Ignore the generated files. * Makefile.am (SUBDIRS): Reorder so we build in include/ before libparted, i.e., so that we generate the .h files we'll need.
Diffstat (limited to 'include')
-rw-r--r--include/parted/Makefile.am37
-rw-r--r--include/parted/constraint.in.h (renamed from include/parted/constraint.h)0
-rw-r--r--include/parted/crc32.in.h (renamed from include/parted/crc32.h)0
-rw-r--r--include/parted/debug.in.h (renamed from include/parted/debug.h)0
-rw-r--r--include/parted/device.in.h (renamed from include/parted/device.h)0
-rw-r--r--include/parted/disk.in.h (renamed from include/parted/disk.h)0
-rw-r--r--include/parted/endian.in.h (renamed from include/parted/endian.h)0
-rw-r--r--include/parted/exception.in.h (renamed from include/parted/exception.h)0
-rw-r--r--include/parted/fdasd.in.h (renamed from include/parted/fdasd.h)0
-rw-r--r--include/parted/filesys.in.h (renamed from include/parted/filesys.h)0
-rw-r--r--include/parted/geom.in.h (renamed from include/parted/geom.h)0
-rw-r--r--include/parted/natmath.in.h (renamed from include/parted/natmath.h)0
-rw-r--r--include/parted/parted.in.h (renamed from include/parted/parted.h)0
-rw-r--r--include/parted/timer.in.h (renamed from include/parted/timer.h)0
-rw-r--r--include/parted/unit.in.h (renamed from include/parted/unit.h)0
-rw-r--r--include/parted/vtoc.in.h (renamed from include/parted/vtoc.h)0
16 files changed, 35 insertions, 2 deletions
diff --git a/include/parted/Makefile.am b/include/parted/Makefile.am
index 022373f..a5d2687 100644
--- a/include/parted/Makefile.am
+++ b/include/parted/Makefile.am
@@ -4,8 +4,7 @@ else
S390_HDRS =
endif
-partedincludedir = $(includedir)/parted
-
+partedincludedir = $(includedir)/parted
partedinclude_HEADERS = constraint.h \
debug.h \
device.h \
@@ -22,4 +21,38 @@ noinst_HEADERS = crc32.h \
endian.h \
$(S390_HDRS)
+BUILT_SOURCES = \
+ $(partedinclude_HEADERS) \
+ $(noinst_HEADERS) \
+ fdasd.h \
+ vtoc.h
+
+EXTRA_DIST = $(BUILT_SOURCES:%.h=%.in.h)
+
+# We use _GL_ATTRIBUTE_CONST and _GL_ATTRIBUTE_PURE internally,
+# but cannot use those in a published header, so replace each of those
+# strings with its expansion.
+# Technically, attribute const was introduced in gcc-2.95 and
+# attribute pure in 2.96, but to keep it simple, we're testing
+# for 2.96 or newer for both.
+
+hash_if = \n\#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)\n
+subst_const_attr = \
+ s/ _GL_ATTRIBUTE_CONST\b/$(hash_if) __attribute ((__const__))\n\#endif\n/
+subst_pure_attr = \
+ s/ _GL_ATTRIBUTE_PURE\b/$(hash_if) __attribute ((__pure__))\n\#endif\n/
+
+$(BUILT_SOURCES): Makefile.am
+
+SUFFIXES = .in.h .h
+.in.h.h:
+ $(AM_V_GEN)rm -f $@ $@-t
+ $(AM_V_at)perl -p \
+ -e '$(subst_const_attr);' \
+ -e '$(subst_pure_attr);' \
+ $< > $@-t
+ $(AM_V_at)chmod a=r $@-t
+ $(AM_V_at)mv $@-t $@
+
MAINTAINERCLEANFILES = Makefile.in
+MAINTAINERCLEANFILES += $(BUILT_SOURCES)
diff --git a/include/parted/constraint.h b/include/parted/constraint.in.h
index 5f42fa0..5f42fa0 100644
--- a/include/parted/constraint.h
+++ b/include/parted/constraint.in.h
diff --git a/include/parted/crc32.h b/include/parted/crc32.in.h
index 74941f6..74941f6 100644
--- a/include/parted/crc32.h
+++ b/include/parted/crc32.in.h
diff --git a/include/parted/debug.h b/include/parted/debug.in.h
index 09b47ab..09b47ab 100644
--- a/include/parted/debug.h
+++ b/include/parted/debug.in.h
diff --git a/include/parted/device.h b/include/parted/device.in.h
index a3d1737..a3d1737 100644
--- a/include/parted/device.h
+++ b/include/parted/device.in.h
diff --git a/include/parted/disk.h b/include/parted/disk.in.h
index 46bde3f..46bde3f 100644
--- a/include/parted/disk.h
+++ b/include/parted/disk.in.h
diff --git a/include/parted/endian.h b/include/parted/endian.in.h
index 0e7c923..0e7c923 100644
--- a/include/parted/endian.h
+++ b/include/parted/endian.in.h
diff --git a/include/parted/exception.h b/include/parted/exception.in.h
index dd302b8..dd302b8 100644
--- a/include/parted/exception.h
+++ b/include/parted/exception.in.h
diff --git a/include/parted/fdasd.h b/include/parted/fdasd.in.h
index ac30134..ac30134 100644
--- a/include/parted/fdasd.h
+++ b/include/parted/fdasd.in.h
diff --git a/include/parted/filesys.h b/include/parted/filesys.in.h
index 2f74c91..2f74c91 100644
--- a/include/parted/filesys.h
+++ b/include/parted/filesys.in.h
diff --git a/include/parted/geom.h b/include/parted/geom.in.h
index 15ad017..15ad017 100644
--- a/include/parted/geom.h
+++ b/include/parted/geom.in.h
diff --git a/include/parted/natmath.h b/include/parted/natmath.in.h
index e1d09eb..e1d09eb 100644
--- a/include/parted/natmath.h
+++ b/include/parted/natmath.in.h
diff --git a/include/parted/parted.h b/include/parted/parted.in.h
index fbcb9aa..fbcb9aa 100644
--- a/include/parted/parted.h
+++ b/include/parted/parted.in.h
diff --git a/include/parted/timer.h b/include/parted/timer.in.h
index 7f25b2e..7f25b2e 100644
--- a/include/parted/timer.h
+++ b/include/parted/timer.in.h
diff --git a/include/parted/unit.h b/include/parted/unit.in.h
index 584a0c4..584a0c4 100644
--- a/include/parted/unit.h
+++ b/include/parted/unit.in.h
diff --git a/include/parted/vtoc.h b/include/parted/vtoc.in.h
index d79ce39..d79ce39 100644
--- a/include/parted/vtoc.h
+++ b/include/parted/vtoc.in.h