summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Vu-Brugier <cvubrugier@fastmail.fm>2020-07-02 10:57:22 +0200
committerDavid Howells <dhowells@redhat.com>2020-07-06 18:00:28 +0100
commit991c272062a4300bbd5fe22dce17ab2fb5126e3f (patch)
treec2b3ec87d8c9391855235a275c2f2b7a4eab54e0
parent9b815047340ad7e1d9e3be496b232a29f1b5b232 (diff)
downloadkeyutils-991c272062a4300bbd5fe22dce17ab2fb5126e3f.tar.gz
Check that keyutils.h has valid C++ syntax at build time
Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm> Signed-off-by: David Howells <dhowells@redhat.com>
-rw-r--r--Makefile16
1 files changed, 15 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 18a7231..c7c8ed1 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,6 @@
CPPFLAGS := -I.
CFLAGS := -g -Wall -Werror
+CXXFLAGS := -g -Wall -Werror
INSTALL := install
DESTDIR :=
SPECFILE := keyutils.spec
@@ -99,7 +100,7 @@ endif
# Normal build rule
#
###############################################################################
-all: keyctl request-key key.dns_resolver
+all: keyctl request-key key.dns_resolver cxx
###############################################################################
#
@@ -167,6 +168,18 @@ dns.afsdb.o: dns.afsdb.c key.dns.h
###############################################################################
#
+# Check that the header file has valid C++ syntax
+#
+###############################################################################
+cxx.stamp: keyutils.h Makefile
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -x c++-header -fsyntax-only $<
+ touch $@
+
+cxx: cxx.stamp
+.PHONY: cxx
+
+###############################################################################
+#
# Install everything
#
###############################################################################
@@ -247,6 +260,7 @@ clean:
$(RM) keyctl request-key key.dns_resolver
$(RM) *.o *.os *~
$(RM) debugfiles.list debugsources.list
+ $(RM) cxx.stamp
distclean: clean
$(RM) -r rpmbuild $(TARBALL)