Code

build system: Define the 'version' target in the toplevel Makefile.
[template.git] / src / Makefile.am
index 4e77ae3988e9333458a7b4ac566aa92cf6b64d6c..86e78ee586f511a7c64fb41cbe161ca3712f117f 100644 (file)
@@ -1,13 +1,27 @@
 AM_CFLAGS = @STRICT_CFLAGS@
 
-include_HEADERS = foobar.h
+include_HEADERS = foobar.h fb_features.h
 lib_LTLIBRARIES = libfoobar.la
 
-libfoobar_la_SOURCES = foobar.c foobar.h
+BUILT_SOURCES = fb_features.h
+
+libfoobar_la_SOURCES = foobar.c foobar.h fb_features.h
 libfoobar_la_LDFLAGS = -version-info 0:0:0
 
 bin_PROGRAMS = fb
 
 fb_SOURCES = fb.c foobar.h
+fb_CFLAGS = $(AM_CFLAGS) -DBUILD_DATE="\"$$( date --utc '+%F %T' ) (UTC)\""
 fb_LDADD = libfoobar.la
 
+fb_features.h: fb_features.h.in ../version
+       source ../version; sed \
+           -e "s/@FB_VERSION_MAJOR@/$$VERSION_MAJOR/g" \
+           -e "s/@FB_VERSION_MINOR@/$$VERSION_MINOR/g" \
+           -e "s/@FB_VERSION_PATCH@/$$VERSION_PATCH/g" \
+           -e "s/@FB_VERSION_EXTRA@/$$VERSION_EXTRA/g" \
+           -e "s/@FB_VERSION_STRING@/$$VERSION_STRING/g" \
+           fb_features.h.in > fb_features.h
+
+.PHONY: FORCE
+