Merge "Stardardize makefile for fm-mgr"

This commit is contained in:
Zuul 2018-12-10 14:30:40 +00:00 committed by Gerrit Code Review
commit 93f316da16
2 changed files with 30 additions and 18 deletions

View File

@ -29,14 +29,19 @@ MINOR=`echo $VER | awk -F . '{print $2}'`
make MAJOR=$MAJOR MINOR=$MINOR %{?_smp_mflags}
%install
rm -rf $RPM_BUILD_ROOT
rm -rf %{buildroot}
VER=%{version}
MAJOR=`echo $VER | awk -F . '{print $1}'`
MINOR=`echo $VER | awk -F . '{print $2}'`
make DEST_DIR=$RPM_BUILD_ROOT BIN_DIR=%{local_bindir} LIB_DIR=%{_libdir} INC_DIR=%{_includedir} MAJOR=$MAJOR MINOR=$MINOR install_non_bb
make DESTDIR=%{buildroot} \
BINDIR=%{local_bindir} \
SYSCONFDIR=%{_sysconfdir} \
UNITDIR=%{_unitdir} \
MAJOR=$MAJOR MINOR=$MINOR \
install
%clean
rm -rf $RPM_BUILD_ROOT
rm -rf %{buildroot}
%files
@ -46,4 +51,3 @@ rm -rf $RPM_BUILD_ROOT
%_sysconfdir/init.d/fminit
%{_unitdir}/fminit.service
%config(noreplace) %{_sysconfdir}/logrotate.d/fm.logrotate

View File

@ -5,6 +5,15 @@ OBJS = $(SRCS:.cpp=.o)
INCLUDES = -I.
CCFLAGS = -g -O2 -Wall -Werror
MAJOR ?= 1
MINOR ?= 0
DESTDIR ?= /
BINDIR ?= /usr/local/bin
SYSCONFDIR ?= /etc
UNITDIR ?= /usr/lib/systemd/system
build: fmManager
.cpp.o:
@ -16,14 +25,13 @@ fmManager: $(OBJS)
clean:
@rm -f $(OBJS)
install_non_bb:
mkdir -p $(DEST_DIR)/usr/lib/systemd/system
install -m 755 -d $(DEST_DIR)/etc
install -m 755 -d $(DEST_DIR)/etc/init.d
install -m 755 -d $(DEST_DIR)/etc/logrotate.d
install -m 755 -d $(DEST_DIR)/usr/local
install -m 755 -d $(DEST_DIR)/usr/local/bin
install -m 755 fminit $(DEST_DIR)/etc/init.d/fminit
install -m 755 fmManager $(DEST_DIR)/usr/local/bin/fmManager
install -m 644 fm.logrotate $(DEST_DIR)/etc/logrotate.d/fm.logrotate
install -m 644 fminit.service $(DEST_DIR)/usr/lib/systemd/system/fminit.service
install:
mkdir -p $(DESTDIR)/usr/lib/systemd/system
install -m 755 -d $(DESTDIR)$(SYSCONFDIR)
install -m 755 -d $(DESTDIR)$(SYSCONFDIR)/init.d
install -m 755 -d $(DESTDIR)$(SYSCONFDIR)/logrotate.d
install -m 755 -d $(DESTDIR)$(BINDIR)
install -m 755 fminit $(DESTDIR)$(SYSCONFDIR)/init.d/fminit
install -m 755 fmManager $(DESTDIR)$(BINDIR)/fmManager
install -m 644 fm.logrotate $(DESTDIR)$(SYSCONFDIR)/logrotate.d/fm.logrotate
install -m 644 fminit.service $(DESTDIR)$(UNITDIR)/fminit.service