Module: check_mk
Branch: master
Commit: f2e856648da4047483d173de4ab3422ef14a4383
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f2e856648da404…
Author: Jukka Aro <ja(a)mathias-kettner.de>
Date: Thu Oct 12 13:35:42 2017 +0200
Win-agent build: fix versions, improve cleanup etc
* Increment build_version only when sources have changed.
* Fix setversion target (NEW_VERSION variable was not passed to
chroot).
* Use CLEANFILES for cleaning up stuff.
* Correct dependencies in Makefile.am.
Change-Id: Ib3ce7b4b7b67e4313499536b763f9e26e65b0f08
---
agents/windows/Makefile.am | 36 ++++++++++++++++++------------------
agents/windows/do-chroot | 4 +++-
agents/windows/make-agent | 5 ++++-
3 files changed, 25 insertions(+), 20 deletions(-)
diff --git a/agents/windows/Makefile.am b/agents/windows/Makefile.am
index 7c17ac4..adcbfdd 100644
--- a/agents/windows/Makefile.am
+++ b/agents/windows/Makefile.am
@@ -12,21 +12,17 @@ check_mk_agent_LDADD = check_mk_agent.res $(LD_COMMON)
wmitest_LDADD = $(LD_COMMON)
-# A left-over generated rc file in parent dir may disturb the build process.
-clean_check_mk_agent_rc:
- rm -f ../check_mk_agent.rc
+build_version: $(check_mk_agent_SOURCES:.cc=.o)
+ echo $$(( $$(cat $(VPATH)/build_version) + 1 )) > $(VPATH)/build_version
-check_mk_agent.rc:
- BUILD_VERSION=$$(( $$(cat ../build_version) + 1 )) ; \
- echo $$BUILD_VERSION > ../build_version ; \
- ln -s ../check_mk_agent.ico check_mk_agent.ico ; \
+check_mk_agent.rc: $(VPATH)/check_mk_agent.rc.in build_version
sed -e "s/%VERSION%/$(VERSION)/g" \
-e "s/%YEAR%/$$(date +%Y)/g" \
- -e "s/%BUILD_VERSION%/$$BUILD_VERSION/g" \
- ../check_mk_agent.rc.in > check_mk_agent.rc
+ -e "s/%BUILD_VERSION%/$$(cat $(VPATH)/build_version)/g" $< > $@
-check_mk_agent.res: check_mk_agent.rc | clean_check_mk_agent_rc
- $(WINDRES) $^ -O coff -o $@
+check_mk_agent.res: check_mk_agent.rc $(VPATH)/check_mk_agent.ico
+ cp $(VPATH)/check_mk_agent.ico check_mk_agent.ico
+ $(WINDRES) $< -O coff -o $@
check_mk_agent_SOURCES = \
Configurable.cc \
@@ -51,7 +47,6 @@ check_mk_agent_SOURCES = \
Thread.cc \
WinApi.cc \
check_mk_agent.cc \
- check_mk_agent.rc \
stringutil.cc \
types.cc \
win_error.cc \
@@ -78,11 +73,16 @@ check_mk_agent_SOURCES = \
wmitest_SOURCES = wmitest.cc stringutil.cc WinApi.cc wmiHelper.cc
-clean-local:
- -rm -f check_mk_agent.*
- -rm -f $(addprefix $(bindir)/,$(bin_PROGRAMS)) \
- $(patsubst %$(EXEEXT),%-64$(EXEEXT),$(addprefix $(bindir)/,$(bin_PROGRAMS))) \
- $(patsubst %$(EXEEXT),%.msi,$(addprefix $(bindir)/,$(bin_PROGRAMS)))
+CLEANFILES = \
+ *.ico *.res *.rc config.* stamp-* Makefile \
+ sections/.dirstamp \
+ $$(find .deps/ sections/.deps -type f) \
+ $(addprefix $(bindir)/,$(bin_PROGRAMS)) \
+ $(patsubst %$(EXEEXT),%-64$(EXEEXT),$(addprefix $(bindir)/,$(bin_PROGRAMS))) \
+ $(patsubst %$(EXEEXT),%.msi,$(addprefix $(bindir)/,$(bin_PROGRAMS)))
setversion:
- sed -i 's/^AC_INIT.*/AC_INIT([Check_MK Windows Agent],
['"$(NEW_VERSION)"'], [feedback(a)check-mk.org])/' ../configure.ac
+ package="Check_MK Windows Agent" ; \
+ mail=feedback(a)check-mk.org ; \
+ sed -i "s/^AC_INIT.*/AC_INIT([$$package], [$(NEW_VERSION)], [$$mail])/" \
+ $(VPATH)/configure.ac
diff --git a/agents/windows/do-chroot b/agents/windows/do-chroot
index 560e020..0135be2 100755
--- a/agents/windows/do-chroot
+++ b/agents/windows/do-chroot
@@ -41,7 +41,9 @@ if [ ! -e $CHROOT_PATH/$CHROOT_BUILD_DIR/Makefile ] ; then
fi
if [ -n "$CMD" ] ; then
- chroot $CHROOT_PATH /usr/bin/env CHROOTNAME=$CHROOTNAME bash -c "$CMD"
+ chroot $CHROOT_PATH \
+ /usr/bin/env CHROOTNAME=$CHROOTNAME NEW_VERSION=$NEW_VERSION \
+ bash -c "$CMD"
else
chroot $CHROOT_PATH /usr/bin/env CHROOTNAME=$CHROOTNAME bash -l
fi
diff --git a/agents/windows/make-agent b/agents/windows/make-agent
index fb30f39..c53ae80 100755
--- a/agents/windows/make-agent
+++ b/agents/windows/make-agent
@@ -63,7 +63,10 @@ fi
[[ $njobs -le 0 ]] && njobs=1 # Ensure one core after arithmetic division.
# Build the Windows agent within chroot by calling the 'build-agent' script.
-sudo CHROOT_PATH=$CHROOT_PATH CHROOT_BUILD_DIR=$CHROOT_BUILD_DIR ./do-chroot \
+sudo CHROOT_PATH=$CHROOT_PATH \
+ CHROOT_BUILD_DIR=$CHROOT_BUILD_DIR \
+ NEW_VERSION=$NEW_VERSION \
+ ./do-chroot \
"$CHROOT_BUILD_DIR/agents/windows/build-agent -j${njobs} $targets"
EXIT_CODE=$?