nut-debian/include/Makefile.am

35 lines
1.3 KiB
Makefile
Raw Normal View History

2010-03-26 01:20:59 +02:00
EXTRA_DIST = attribute.h common.h extstate.h parseconf.h proto.h \
2011-06-01 23:31:49 +03:00
state.h timehead.h upsconf.h nut_stdint.h
2010-03-26 01:20:59 +02:00
# http://www.gnu.org/software/automake/manual/automake.html#Clean
2011-06-01 23:31:49 +03:00
BUILT_SOURCES = nut_version.h
2010-03-26 01:20:59 +02:00
CLEANFILES = nut_version.h
# magic to include SVN revision number in NUT version string
nut_version.h: FORCE
2012-01-24 12:22:33 +02:00
@GITREV=`git describe --tags 2>/dev/null | sed 's/^v\([0-9]\)/\1/' `; \
if [ -z "$$GITREV" ]; \
then SVNREV=`LANG=C svnversion -n $(top_srcdir) 2>/dev/null`; \
if [ -z "$$SVNREV" -o "$$SVNREV" = "exported" ]; \
then NUT_VERSION="$(PACKAGE_VERSION)"; \
else NUT_VERSION="$(PACKAGE_VERSION)-$$SVNREV"; \
fi ; \
else NUT_VERSION="$$GITREV"; \
2010-03-26 01:20:59 +02:00
fi ; \
echo '/* Autogenerated file. Do not change. */' > _nut_version.h ; \
echo '/* This file was generated by "make". */' >> _nut_version.h ; \
echo "#define NUT_VERSION_MACRO \"$$NUT_VERSION\"" >> _nut_version.h ; \
echo "NUT_VERSION: \"$$NUT_VERSION\""
-test -f nut_version.h || cp _nut_version.h nut_version.h
-cmp -s _nut_version.h nut_version.h || cp _nut_version.h nut_version.h
-rm -f _nut_version.h
FORCE:
2012-06-01 16:55:19 +03:00
# counter part of BUILT_SOURCES: since nut_version is not a direct
# deps of a local target, we must clean it by ourself before the
# distribution
dist-hook:
rm -f $(distdir)/nut_version.h