Merge "Standardize Makefile for service-mgmt/sm-common"

This commit is contained in:
Zuul 2019-02-27 16:33:25 +00:00 committed by Gerrit Code Review
commit 59bd145f57
4 changed files with 27 additions and 23 deletions

View File

@ -3,12 +3,27 @@
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
ETC_DIR ?= /etc
build: build:
@(cd src; make build VER=$(VER) VER_MJR=$(VER_MJR)) @(cd src; make build VER=$(VER) VER_MJR=$(VER_MJR))
install_non_bb: install:
@(cd src; make DEST_DIR=$(DEST_DIR) BIN_DIR=$(BIN_DIR) LIB_DIR=$(LIB_DIR) INC_DIR=$(INC_DIR) VER=$(VER) VER_MJR=$(VER_MJR) install_non_bb) @(cd src; make DEST_DIR=$(DEST_DIR) BIN_DIR=$(BIN_DIR) LIB_DIR=$(LIB_DIR) INC_DIR=$(INC_DIR) VER=$(VER) VER_MJR=$(VER_MJR) install)
@(cd scripts; make DEST_DIR=$(DEST_DIR) UNIT_DIR=$(UNIT_DIR) install_non_bb) @(cd scripts; make DEST_DIR=$(DEST_DIR) UNIT_DIR=$(UNIT_DIR) install)
install -m 750 -d $(DEST_DIR)/usr
install -m 750 -d $(DEST_DIR)/usr/bin
install -m 750 -p -D $(BUILDSUBDIR)/src/sm_eru $(DEST_DIR)/$(BIN_DIR)/sm-eru
install -m 750 -p -D $(BUILDSUBDIR)/src/sm_eru_dump $(DEST_DIR)/$(BIN_DIR)/sm-eru-dump
install -m 750 -p -D $(BUILDSUBDIR)/src/sm_watchdog $(DEST_DIR)/$(BIN_DIR)/sm-watchdog
install -m 644 -p -D $(BUILDSUBDIR)/scripts/sm-eru.service $(DEST_DIR)/$(UNIT_DIR)/sm-eru.service
install -m 644 -p -D $(BUILDSUBDIR)/scripts/sm-watchdog.service $(DEST_DIR)/$(UNIT_DIR)/sm-watchdog.service
install -m 750 -d $(DEST_DIR)/$(ETC_DIR)/pmon.d
install -m 640 -p -D $(BUILDSUBDIR)/scripts/sm-eru.conf $(DEST_DIR)/$(ETC_DIR)/pmon.d/sm-eru.conf
install -m 640 -p -D $(BUILDSUBDIR)/scripts/sm-watchdog.conf $(DEST_DIR)/$(ETC_DIR)/pmon.d/sm-watchdog.conf
install -m 750 -p -D $(BUILDSUBDIR)/scripts/sm-eru $(DEST_DIR)/$(ETC_DIR)/init.d/sm-eru
install -m 750 -p -D $(BUILDSUBDIR)/scripts/sm-watchdog $(DEST_DIR)/$(ETC_DIR)/init.d/sm-watchdog
clean: clean:
@( cd src; make clean ) @( cd src; make clean )

View File

@ -85,27 +85,11 @@ make VER=${VER} VER_MJR=$MAJOR %{?_smp_mflags}
%global _buildsubdir %{_builddir}/%{name}-%{version} %global _buildsubdir %{_builddir}/%{name}-%{version}
%install %install
rm -rf $RPM_BUILD_ROOT rm -rf %{buildroot}
VER=%{version} VER=%{version}
MAJOR=`echo $VER | awk -F . '{print $1}'` MAJOR=`echo $VER | awk -F . '{print $1}'`
MINOR=`echo $VER | awk -F . '{print $2}'` MINOR=`echo $VER | awk -F . '{print $2}'`
make DEST_DIR=$RPM_BUILD_ROOT BIN_DIR=%{_bindir} UNIT_DIR=%{_unitdir} LIB_DIR=%{_libdir} INC_DIR=%{_includedir} VER=$VER VER_MJR=$MAJOR install_non_bb make DEST_DIR=%{buildroot} BIN_DIR=%{_bindir} UNIT_DIR=%{_unitdir} LIB_DIR=%{_libdir} INC_DIR=%{_includedir} BUILDSUBDIR=%{_buildsubdir} VER=$VER VER_MJR=$MAJOR install
install -m 750 -d %{buildroot}/usr
install -m 750 -d %{buildroot}/usr/bin
install -m 750 -p -D %{_buildsubdir}/src/sm_eru %{buildroot}%{_bindir}/sm-eru
install -m 750 -p -D %{_buildsubdir}/src/sm_eru_dump %{buildroot}%{_bindir}/sm-eru-dump
install -m 750 -p -D %{_buildsubdir}/src/sm_watchdog %{buildroot}%{_bindir}/sm-watchdog
install -m 644 -p -D %{_buildsubdir}/scripts/sm-eru.service %{buildroot}%{_unitdir}/sm-eru.service
install -m 644 -p -D %{_buildsubdir}/scripts/sm-watchdog.service %{buildroot}%{_unitdir}/sm-watchdog.service
install -m 750 -d %{buildroot}%{_sysconfdir}/pmon.d
install -m 640 -p -D %{_buildsubdir}/scripts/sm-eru.conf %{buildroot}%{_sysconfdir}/pmon.d/sm-eru.conf
install -m 640 -p -D %{_buildsubdir}/scripts/sm-watchdog.conf %{buildroot}%{_sysconfdir}/pmon.d/sm-watchdog.conf
install -m 750 -p -D %{_buildsubdir}/scripts/sm-eru %{buildroot}%{_sysconfdir}/init.d/sm-eru
install -m 750 -p -D %{_buildsubdir}/scripts/sm-watchdog %{buildroot}%{_sysconfdir}/init.d/sm-watchdog
%post %post
/usr/bin/systemctl enable sm-watchdog.service >/dev/null 2>&1 /usr/bin/systemctl enable sm-watchdog.service >/dev/null 2>&1

View File

@ -1,4 +1,8 @@
install_non_bb: #
# SPDX-License-Identifier: Apache-2.0
#
install:
install -d $(DEST_DIR)$(UNIT_DIR) install -d $(DEST_DIR)$(UNIT_DIR)
install -m 644 *.service $(DEST_DIR)$(UNIT_DIR) install -m 644 *.service $(DEST_DIR)$(UNIT_DIR)
install -d $(DEST_DIR)/etc/init.d install -d $(DEST_DIR)/etc/init.d

View File

@ -3,6 +3,7 @@
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
INCLUDES =-I$(STAGING_DIR)/usr/include/glib-2.0 INCLUDES =-I$(STAGING_DIR)/usr/include/glib-2.0
INCLUDES+=-I$(STAGING_DIR)/usr/lib64/glib-2.0/include -I. INCLUDES+=-I$(STAGING_DIR)/usr/lib64/glib-2.0/include -I.
@ -64,7 +65,7 @@ sm_eru: libsm_common.so
sm_eru_dump: libsm_common.so sm_eru_dump: libsm_common.so
$(CXX) $(INCLUDES) $(CCFLAGS) $(EXTRACCFLAGS) $(OBJS) sm_eru_dump.c $(LDLIBS) -L./ -lsm_common -o sm_eru_dump $(CXX) $(INCLUDES) $(CCFLAGS) $(EXTRACCFLAGS) $(OBJS) sm_eru_dump.c $(LDLIBS) -L./ -lsm_common -o sm_eru_dump
install_non_bb: install:
# install of these 3 are in the .spec file so that they can be # install of these 3 are in the .spec file so that they can be
# renamed with '-' like they are in the bitbake file. # renamed with '-' like they are in the bitbake file.
# #