Permalink
Browse files

Move 'make install' responsibility from RPM to Makefile

Simplify RPM SPEC file and move responsibility of 'make install'
into the Makefile

Signed-off-by: Mark Harvey <markh794@gmail.com>
  • Loading branch information...
1 parent e8c899f commit aa767e7ecbe32fe77ee71f2f93863336579a77cf @markh794 committed with Mark Harvey Aug 1, 2012
Showing with 34 additions and 49 deletions.
  1. +7 −5 Makefile
  2. +3 −3 etc/Makefile
  3. +9 −26 mhvtl-utils.spec
  4. +15 −15 usr/Makefile
View
@@ -10,8 +10,8 @@
# kernel to build kernel module
#
-VER = $(shell grep Version mhvtl-utils.spec|awk '{print $$2}')
-REL = $(shell grep Release mhvtl-utils.spec|awk '{print $$2}')
+VER = $(shell awk '/Version/ {print $$2}' mhvtl-utils.spec)
+REL = $(shell awk '/Release/ {print $$2}' mhvtl-utils.spec | sed s/%{?dist}//g)
VERSION ?= $(VER).$(REL)
EXTRAVERSION = $(if $(shell git show-ref 2>/dev/null),-git-$(shell git branch |awk '/\*/ {print $$2}'))
@@ -23,6 +23,7 @@ SUSER ?=root
GROUP ?= vtl
MHVTL_HOME_PATH ?= /opt/mhvtl
MHVTL_CONFIG_PATH ?= /etc/mhvtl
+LIBDIR ?= /usr/lib
CHECK_CC = cgcc
CHECK_CC_FLAGS = '$(CHECK_CC) -Wbitwise -Wno-return-void -no-compile $(ARCH)'
@@ -69,11 +70,13 @@ distclean:
install:
$(MAKE) usr
- $(MAKE) -C usr install $(PREFIX) $(DESTDIR)
+ $(MAKE) -C usr install $(LIBDIR) $(PREFIX) $(DESTDIR)
$(MAKE) scripts
$(MAKE) -C scripts install $(PREFIX) $(DESTDIR)
$(MAKE) etc
- $(MAKE) -C etc install USR=$(USR)
+ $(MAKE) -i -C etc install $(DESTDIR) USR=$(USR)
+ $(MAKE) -C man install $(PREFIX) $(DESTDIR) USR=$(USR)
+ test -d $(DESTDIR)/opt/mhvtl || mkdir -p $(DESTDIR)/opt/mhvtl
tar:
$(MAKE) distclean
@@ -89,6 +92,5 @@ tar:
$(PARENTDIR)/Makefile \
$(PARENTDIR)/README \
$(PARENTDIR)/INSTALL \
- $(PARENTDIR)/mhvtl-1.3.ebuild \
$(PARENTDIR)/mhvtl-utils.spec)
View
@@ -3,6 +3,7 @@ RCFILE = mhvtl
USR ?= vtl
MHVTL_CONFIG_PATH ?= /etc/mhvtl
MHVTL_HOME_PATH ?= /opt/mhvtl
+INITD ?= /etc/init.d
CONFIG_PATH = $(shell echo $(MHVTL_CONFIG_PATH) | sed -e s'/\//\\\//g')
HOME_PATH = $(shell echo $(MHVTL_HOME_PATH) | sed -e s'/\//\\\//g')
@@ -26,8 +27,7 @@ clean:
.PHONY: install
install:
- install -d -m 755 /etc
- install -d -m 755 /etc/init.d
- install -m 700 $(RCFILE) /etc/init.d/
+ install -d -m 755 $(DESTDIR)$(INITD)
+ install -m 700 $(RCFILE) $(DESTDIR)$(INITD)
test ! -x /sbin/insserv || /sbin/insserv $(RCFILE)
View
@@ -39,36 +39,12 @@ The SSC/SMC target daemons have been written from scratch.
%build
%{__make} RPM_OPT_FLAGS="%{optflags}" VERSION="%{version}.%{release}" usr
-%{__make} RPM_OPT_FLAGS="%{optflags}" VERSION="%{version}.%{release}" etc
+%{__make} RPM_OPT_FLAGS="%{optflags}" VERSION="%{version}.%{release}" INITD="%{_initrddir}" etc
%{__make} RPM_OPT_FLAGS="%{optflags}" VERSION="%{version}.%{release}" scripts
%install
%{__rm} -rf %{buildroot}
-%{__install} -d -m0755 %{buildroot}/opt/mhvtl/
-
-%{__install} -Dp -m0750 etc/mhvtl %{buildroot}%{_initrddir}/mhvtl
-
-%{__install} -Dp -m0700 usr/build_library_config %{buildroot}%{_bindir}/build_library_config
-%{__install} -Dp -m0750 usr/dump_tape %{buildroot}%{_bindir}/dump_tape
-%{__install} -Dp -m0700 usr/make_vtl_media %{buildroot}%{_bindir}/make_vtl_media
-%{__install} -Dp -m0750 usr/mktape %{buildroot}%{_bindir}/mktape
-%{__install} -Dp -m0750 usr/vtlcmd %{buildroot}%{_bindir}/vtlcmd
-%{__install} -Dp -m0750 usr/vtllibrary %{buildroot}%{_bindir}/vtllibrary
-%{__install} -Dp -m0750 usr/vtltape %{buildroot}%{_bindir}/vtltape
-%{__install} -Dp -m0700 usr/tapeexerciser %{buildroot}%{_bindir}/tapeexerciser
-
-%{__install} -Dp -m0755 usr/libvtlcart.so %{buildroot}%{_libdir}/libvtlcart.so
-%{__install} -Dp -m0755 usr/libvtlscsi.so %{buildroot}%{_libdir}/libvtlscsi.so
-
-%{__install} -Dp -m0644 man/build_library_config.1 %{buildroot}%{_mandir}/man1/build_library_config.1
-%{__install} -Dp -m0644 man/mhvtl.1 %{buildroot}%{_mandir}/man1/mhvtl.1
-%{__install} -Dp -m0644 man/mktape.1 %{buildroot}%{_mandir}/man1/mktape.1
-%{__install} -Dp -m0644 man/vtlcmd.1 %{buildroot}%{_mandir}/man1/vtlcmd.1
-%{__install} -Dp -m0644 man/vtllibrary.1 %{buildroot}%{_mandir}/man1/vtllibrary.1
-%{__install} -Dp -m0644 man/vtltape.1 %{buildroot}%{_mandir}/man1/vtltape.1
-
-%{__install} -Dp -m0644 man/device.conf.5 %{buildroot}%{_mandir}/man5/device.conf.5
-%{__install} -Dp -m0644 man/library_contents.5 %{buildroot}%{_mandir}/man5/library_contents.5
+%{__make} install DESTDIR="%{buildroot}" INITD="%{_initrddir}" LIBDIR="%{_libdir}"
%pre
if ! getent group vtl &>/dev/null; then
@@ -102,7 +78,9 @@ fi
%doc %{_mandir}/man1/vtlcmd.1*
%doc %{_mandir}/man1/vtllibrary.1*
%doc %{_mandir}/man1/vtltape.1*
+%doc %{_mandir}/man1/make_vtl_media.1*
%doc %{_mandir}/man5/device.conf.5*
+%doc %{_mandir}/man5/mhvtl.conf.5*
%doc %{_mandir}/man5/library_contents.5*
%config %{_initrddir}/mhvtl
%{_bindir}/vtlcmd
@@ -111,6 +89,7 @@ fi
%{_bindir}/tapeexerciser
%{_bindir}/build_library_config
%{_bindir}/make_vtl_media
+%{_bindir}/update_device.conf
%{_libdir}/libvtlscsi.so
%{_libdir}/libvtlcart.so
@@ -122,6 +101,10 @@ fi
/opt/mhvtl/
%changelog
+* Wed Aug 1 2012 Mark Harvey <markh794@gmail.com> - 1.4-0
+- Updated to release 1.4 (2012-08-01).
+- install using Makefile
+
* Thu Jun 21 2012 Dag Wieers <dag@wieers.com> - 1.3-1
- Updated to release 1.3 (2012-06-15).
View
@@ -16,22 +16,11 @@
#
VER = $(shell awk '/Version/ {print $$2}' ../mhvtl-utils.spec)
-REL = $(shell awk '/Release/ {print $$2}' ../mhvtl-utils.spec)
+REL = $(shell awk '/Release/ {print $$2}' ../mhvtl-utils.spec | sed 's/%{?dist}//g')
VERSION ?= $(VER).$(REL)
EXTRAVERSION = $(if $(shell git show-ref 2>/dev/null),-git-$(shell git show-ref --head --abbrev|head -1|awk '{print $$1}'))
-ifeq ($(shell uname -m),x86_64)
-LIBDIR=lib64
-else
-LIBDIR=lib
-endif
-
-# Ubuntu / mint seem to have stopped using /lib64/
-ifeq ($(shell grep lib64 /etc/ld.so.conf.d/* | wc -l),0)
-LIBDIR=lib
-endif
-
PREFIX ?= /usr
USR ?= vtl
SUSER = root
@@ -41,6 +30,17 @@ MHVTL_CONFIG_PATH ?= /etc/mhvtl
CONFIG_PATH = $(shell echo $(MHVTL_CONFIG_PATH) | sed -e s'/\//\\\//g')
HOME_PATH = $(shell echo $(MHVTL_HOME_PATH) | sed -e s'/\//\\\//g')
+ifeq ($(shell uname -m),x86_64)
+LIBDIR ?= $(PREFIX)/lib64
+else
+LIBDIR ?= $(PREFIX)/lib
+endif
+
+# Ubuntu / mint seem to have stopped using /lib64/
+ifeq ($(shell grep lib64 /etc/ld.so.conf /etc/ld.so.conf.d/* | wc -l),0)
+LIBDIR = $(PREFIX)/lib
+endif
+
CFLAGS=-Wall -Wshadow -g -O2 -D_LARGEFILE64_SOURCE $(RPM_OPT_FLAGS) -I../kernel
CFLAGS += -DMHVTL_VERSION=\"$(VERSION)$(EXTRAVERSION)\"
CFLAGS += -DMHVTL_DEBUG
@@ -169,9 +169,9 @@ distclean:
vtllibrary vtllibrary.o
install:
- install -d -m 755 $(DESTDIR)$(PREFIX)/$(LIBDIR)
- install -o $(SUSER) -g bin -m 755 libvtlscsi.so $(DESTDIR)$(PREFIX)/$(LIBDIR)/
- install -o $(SUSER) -g bin -m 755 libvtlcart.so $(DESTDIR)$(PREFIX)/$(LIBDIR)/
+ install -d -m 755 $(DESTDIR)$(LIBDIR)
+ install -o $(SUSER) -g bin -m 755 libvtlscsi.so $(DESTDIR)$(LIBDIR)/
+ install -o $(SUSER) -g bin -m 755 libvtlcart.so $(DESTDIR)$(LIBDIR)/
install -d -m 755 $(DESTDIR)$(PREFIX)/bin
install -o $(SUSER) -g $(GROUP) -m 4750 vtltape $(DESTDIR)$(PREFIX)/bin/
install -o $(SUSER) -g $(GROUP) -m 4750 vtllibrary $(DESTDIR)$(PREFIX)/bin/

0 comments on commit aa767e7

Please sign in to comment.