Standardize makefile for guest-scale-agent

Changes done:
  - install target created in makefile.
  - install commands moved from specfile into makefile
  - cleanup in specfile

Story: 2004043
Task: 27556

Change-Id: Ie2008b62e156e7c4aebace5a061f36b343d10955
Signed-off-by: Erich Cordoba <erich.cordoba.malibran@intel.com>
This commit is contained in:
Erich Cordoba 2019-02-06 18:30:24 -06:00
parent 97524fee3a
commit 8b0487aec5
2 changed files with 38 additions and 26 deletions

View File

@ -64,33 +64,13 @@ MINOR=`echo $VER | awk -F . '{print $2}'`
PATCH=%{patchlevel}
make all VER=${VER} MAJOR=${MAJOR} MINOR=${MINOR} PATCH=${PATCH}
%global _buildsubdir %{_builddir}/%{name}-%{version}
%install
install -d 750 -d %{buildroot}/usr/sbin
install -d 750 -d %{buildroot}%{_sysconfdir}/init.d
install -m 750 -d %{buildroot}/usr
install -m 750 -d %{buildroot}/usr/src
install -m 750 -d %{buildroot}/usr/src/debug
install -m 750 -d %{buildroot}/usr/src/debug/%{name}-%{version}
install -d 750 -d %{buildroot}/usr/sbin/.debug
install -m 750 %{_buildsubdir}/scripts/app_scale_helper %{buildroot}/usr/sbin/app_scale_helper
install -m 750 %{_buildsubdir}/scripts/offline_cpus %{buildroot}/usr/sbin/offline_cpus
install -m 750 %{_buildsubdir}/bin/guest_scale_helper %{buildroot}/usr/sbin/guest_scale_helper
install -m 750 %{_buildsubdir}/bin/guest_scale_agent %{buildroot}/usr/sbin/guest_scale_agent
install -m 750 %{_buildsubdir}/scripts/init_offline_cpus %{buildroot}/etc/init.d/offline_cpus
install -m 750 %{_buildsubdir}/bin/guest_scale_agent %{buildroot}/usr/sbin/.debug/guest_scale_agent
install -d %{buildroot}%{_unitdir}
install -m 750 %{_buildsubdir}/scripts/offline-cpus.service %{buildroot}%{_unitdir}/offline-cpus.service
install -m 750 %{_buildsubdir}/scripts/guest-scale-agent.service %{buildroot}%{_unitdir}/guest-scale-agent.service
# Deploy to the SDK deployment directory
install -d %{buildroot}%{cgcs_sdk_deploy_dir}
install -m 644 sdk/wrs-guest-scale-%{version}.%{patchlevel}.tgz %{buildroot}%{cgcs_sdk_deploy_dir}/wrs-guest-scale-%{version}.%{patchlevel}.tgz
make install \
DESTDIR=%{buildroot} \
SYSCONFDIR=%{buildroot}%{_sysconfdir} \
VERSION=%{version} PATCH=%{tis_patch_ver}\
UNITDIR=%{buildroot}%{_unitdir} \
SDK_DEPLOY_DIR=%{buildroot}%{cgcs_sdk_deploy_dir}
%post
%systemd_post offline-cpus.service

View File

@ -34,6 +34,13 @@
EXECS = guest_scale_helper guest_scale_agent
DESTDIR ?= /
SYSCONFDIR ?= $(DESTDIR)/etc
UNITDIR ?= $(DESTDIR)/usr/lib/systemd/system
SDK_DEPLOY_DIR ?= /opt/deploy/cgcs_sdk
VERSION ?= 2.0
PATCH ?= 0
CFLAGS= -g -Wall -Wformat -Wformat-security
ODIR=obj
BINDIR=bin
@ -104,6 +111,31 @@ $(BINDIR)/guest_scale_agent: $(GUEST_SCALE_AGENT_OBJ)
$(BINDIR)/guest_scale_helper: $(GUEST_SCALE_HELPER_OBJ)
$(CC) -o $@ $^ $(LDFLAGS) -lhostguestmsg -ljson-c
install:
install -d 750 -d $(DESTDIR)/usr/sbin
install -d 750 -d $(SYSCONFDIR)/init.d
install -m 750 -d $(DESTDIR)/usr
install -m 750 -d $(DESTDIR)/usr/src
install -m 750 -d $(DESTDIR)/usr/src/debug
install -m 750 -d $(DESTDIR)/usr/src/debug/guest-scale-agent-$(VERSION)
install -d 750 -d $(DESTDIR)/usr/sbin/.debug
install -m 750 scripts/app_scale_helper $(DESTDIR)/usr/sbin/app_scale_helper
install -m 750 scripts/offline_cpus $(DESTDIR)/usr/sbin/offline_cpus
install -m 750 bin/guest_scale_helper $(DESTDIR)/usr/sbin/guest_scale_helper
install -m 750 bin/guest_scale_agent $(DESTDIR)/usr/sbin/guest_scale_agent
install -m 750 scripts/init_offline_cpus $(SYSCONFDIR)/init.d/offline_cpus
install -m 750 bin/guest_scale_agent $(DESTDIR)/usr/sbin/.debug/guest_scale_agent
install -d $(UNITDIR)
install -m 750 scripts/offline-cpus.service $(UNITDIR)/offline-cpus.service
install -m 750 scripts/guest-scale-agent.service $(UNITDIR)/guest-scale-agent.service
install -d $(SDK_DEPLOY_DIR)
install -m 644 sdk/wrs-guest-scale-$(VERSION).$(PATCH).tgz $(SDK_DEPLOY_DIR)/wrs-guest-scale-$(VERSION).$(PATCH).tgz
# Add the host clean as a dependency to the SDK stuff
clean: host_clean
host_clean: