summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Moore <pmoore@redhat.com>2013-01-28 16:11:30 -0500
committerPaul Moore <pmoore@redhat.com>2013-01-28 16:11:30 -0500
commit6e1c0839056e853f5503625d50b65a75294e6d25 (patch)
tree9f8810f0d1aee53d7a424dddc4addb14a5e373ee
parente6e6a278be9a922945e916df640665e7269e0269 (diff)
downloadlibseccomp-6e1c0839056e853f5503625d50b65a75294e6d25.tar.gz
api: add an API to query version information
Signed-off-by: Paul Moore <pmoore@redhat.com>
-rw-r--r--Makefile11
-rw-r--r--include/.gitignore1
-rw-r--r--include/Makefile20
-rw-r--r--include/seccomp.h.in (renamed from include/seccomp.h)8
4 files changed, 33 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 12ee82f..84a1fb1 100644
--- a/Makefile
+++ b/Makefile
@@ -38,8 +38,8 @@ include install.mk
#
CONFIGS = configure.mk configure.h version_info.mk libseccomp.pc
-SUBDIRS_BUILD = src tests tools
-SUBDIRS_INSTALL = src include doc
+SUBDIRS_BUILD = include src tests tools
+SUBDIRS_INSTALL = include src doc
.PHONY: tarball install ctags cstags clean dist-clean $(SUBDIRS_BUILD)
@@ -69,8 +69,15 @@ $(VERSION_HDR): version_info.mk
$(ECHO) "#ifndef _VERSION_H" >> $$hdr; \
$(ECHO) "#define _VERSION_H" >> $$hdr; \
$(ECHO) "#define VERSION_RELEASE \"$(VERSION_RELEASE)\"" >> $$hdr; \
+ $(ECHO) "#define VERSION_MAJOR $(VERSION_MAJOR)" >> $$hdr; \
+ $(ECHO) "#define VERSION_MINOR $(VERSION_MINOR)" >> $$hdr; \
+ $(ECHO) "#define VERSION_MICRO $(VERSION_MICRO)" >> $$hdr; \
$(ECHO) "#endif" >> $$hdr;
+include: $(VERSION_HDR) $(CONFIGS)
+ @$(ECHO_INFO) "building in directory $@/ ..."
+ @$(MAKE) -C $@
+
src: $(VERSION_HDR) $(CONFIGS)
@$(ECHO_INFO) "building in directory $@/ ..."
@$(MAKE) -C $@
diff --git a/include/.gitignore b/include/.gitignore
new file mode 100644
index 0000000..57ec972
--- /dev/null
+++ b/include/.gitignore
@@ -0,0 +1 @@
+seccomp.h
diff --git a/include/Makefile b/include/Makefile
index 2cd0e56..aba3f71 100644
--- a/include/Makefile
+++ b/include/Makefile
@@ -33,15 +33,25 @@ include $(TOPDIR)/version_info.mk
include $(TOPDIR)/configure.mk
include $(TOPDIR)/install.mk
+HDR_BUILD = seccomp.h
+
#
# targets
#
-.PHONY: all install install_hdr
-
-all:
+.PHONY: all install clean
-install: install_hdr
+all: $(HDR_BUILD)
-install_hdr: seccomp.h
+install: $(HDR_BUILD)
$(INSTALL_INC_MACRO)
+
+seccomp.h: seccomp.h.in
+ @$(ECHO) " GEN $@"
+ $(CAT) $< | \
+ $(SED) -e 's/%%VERSION_MAJOR%%/$(VERSION_MAJOR)/g' | \
+ $(SED) -e 's/%%VERSION_MINOR%%/$(VERSION_MINOR)/g' | \
+ $(SED) -e 's/%%VERSION_MICRO%%/$(VERSION_MICRO)/g' > $@
+
+clean:
+ @$(RM) $(HDR_BUILD)
diff --git a/include/seccomp.h b/include/seccomp.h.in
index 8a70a72..b21205c 100644
--- a/include/seccomp.h
+++ b/include/seccomp.h.in
@@ -31,6 +31,14 @@ extern "C" {
#endif
/*
+ * version information
+ */
+
+#define SCMP_VER_MAJOR %%VERSION_MAJOR%%
+#define SCMP_VER_MINOR %%VERSION_MINOR%%
+#define SCMP_VER_MICRO %%VERSION_MICRO%%
+
+/*
* types
*/