From 6771fd440673d87c4004de2c61d073c3abb21169 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Stelmach?= Date: Tue, 25 Feb 2014 08:15:13 +0100 Subject: [PATCH] makefile improvements Using $(libdir) variable instead of $(prefix)/lib. This helps maintain consistency between paths used in Makefile and those provided by the build system used in spec (e.g. %_libdir). Make sure that Makefile.inc is created before its inclusion in Makefile. Since Makefile is already build, it's not quite obvious that configure script needs to be run for Makefile.inc to be generated. Fixed configure script to correctly generate datadir variable. --- Makefile | 17 +++++++++++------ configure | 3 ++- hwdata.spec | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 23ebbcf..810c9d7 100644 --- a/Makefile +++ b/Makefile @@ -3,8 +3,6 @@ VERSION=$(shell awk '/Version:/ { print $$2 }' hwdata.spec) RELEASE=$(shell rpm -q --define 'dist %{nil}' --specfile --qf "%{release}" hwdata.spec) SOURCEDIR := $(shell pwd) -include Makefile.inc - CVSROOT = $(shell cat CVS/Root 2>/dev/null || :) CVSTAG = $(NAME)-r$(subst .,-,$(VERSION)) @@ -14,15 +12,22 @@ FILES = pci.ids usb.ids oui.txt pnp.ids .PHONY: all install tag force-tag check commit create-archive archive srpm-x \ clean clog new-pci-ids new-usb-ids new-pnp-ids -all: +include Makefile.inc + +all: + +Makefile.inc: configure + ./configure + @echo "$@ generated. Run the make again." + @exit 1 -install: +install: Makefile.inc mkdir -p -m 755 $(DESTDIR)$(datadir)/$(NAME) for foo in $(FILES) ; do \ install -m 644 $$foo $(DESTDIR)$(datadir)/$(NAME) ;\ done - mkdir -p -m 755 $(DESTDIR)$(prefix)/lib/modprobe.d - install -m 644 -T blacklist.conf $(DESTDIR)$(prefix)/lib/modprobe.d/dist-blacklist.conf + mkdir -p -m 755 $(DESTDIR)$(libdir)/modprobe.d + install -m 644 -T blacklist.conf $(DESTDIR)$(libdir)/modprobe.d/dist-blacklist.conf commit: git commit -a ||: diff --git a/configure b/configure index 5f87c77..8ea4e69 100755 --- a/configure +++ b/configure @@ -5,6 +5,7 @@ # Licensed under the new-BSD license (http://www.opensource.org/licenses/bsd-license.php) prefix=/usr +datarootdir=${datarootdir:-${prefix}/share} # Little helper function for reading args from the commandline. # it automatically handles -a b and -a=b variants, and returns 1 if @@ -53,7 +54,7 @@ prefix ?= ${prefix} bindir ?= ${bindir:-${prefix}/bin} sbindir ?= ${sbindir:-${prefix}/sbin} libexecdir ?= ${libexecdir:-${prefix}/libexec} -datarootdir ?= ${datarootdir:-${prefix}/share} +datarootdir ?= ${datarootdir} datadir ?= ${datadir:-${datarootdir}} sysconfdir ?= ${sysconfdir:-${prefix}/etc} libdir ?= ${libdir:-${prefix}/lib} diff --git a/hwdata.spec b/hwdata.spec index d7b9b88..6d071c5 100644 --- a/hwdata.spec +++ b/hwdata.spec @@ -21,7 +21,7 @@ such as the pci.ids and usb.ids databases. %install rm -rf $RPM_BUILD_ROOT -make install DESTDIR=$RPM_BUILD_ROOT +make install DESTDIR=$RPM_BUILD_ROOT libdir=%{_prefix}/lib %clean rm -rf $RPM_BUILD_ROOT -- 2.25.1