diff --git a/Makefile b/Makefile index 348b02a..ff5e242 100644 --- a/Makefile +++ b/Makefile @@ -21,23 +21,43 @@ V ?= 2 ifeq ($(V),0) - Q := @ - MAKEFLAGS += --silent - MAKE += -s +Q := @ +MAKEFLAGS += --silent +MAKE += -s endif ifeq ($(V),1) - MAKEFLAGS += --silent - MAKE += -s +MAKEFLAGS += --silent +MAKE += -s endif +# +# If we can use git to get a version, we use that. If not, we have +# no repository and set a static version number. +# +HAS_GIT = $(shell git describe > /dev/null 2>&1 && echo y || echo n) + +ifeq (${HAS_GIT},y) +VERSION ?= $(shell git describe --abbrev=4 --dirty --always --tags) +RPMVERSION ?= $(shell git describe --abbrev=0 --tags) +else +VERSION=4.0.11 +RPMVERSION=$(VERSION) +endif + +PLATFORM ?= $(shell uname -i) + distro = $(shell lsb_release -d | cut -f2) -subdirs += lib tools init +subdirs += lib tools +ifeq ($(PLATFORM),ppc64le) +subdirs += init +endif targets += $(subdirs) UDEV_RULES_D ?= /etc/udev/rules.d MODPROBE_D ?= /etc/modprobe.d + all: $(targets) tools: lib diff --git a/config.mk b/config.mk index 395c841..b4f9b41 100644 --- a/config.mk +++ b/config.mk @@ -31,9 +31,6 @@ STRIP = $(CROSS)strip NM = $(CROSS)nm HELP2MAN = help2man -VERSION=4.0.11 -RPMVERSION=$(VERSION) - ifeq ($(V),0) Q := @ MAKEFLAGS += --silent @@ -52,7 +49,7 @@ else CLEAN = echo -n endif -PLATFORM = $(shell uname -i) +PLATFORM ?= $(shell uname -i) CFLAGS = -W -Wall -Werror -Wwrite-strings -Wextra -Os -g \ -DGIT_VERSION=\"$(VERSION)\" \ diff --git a/init/Makefile b/init/Makefile index a0cd9c2..e8f71a2 100644 --- a/init/Makefile +++ b/init/Makefile @@ -1,5 +1,5 @@ # -# Copyright 2015, International Business Machines +# Copyright 2016, International Business Machines # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,14 @@ # limitations under the License. # -SYSTEMD_UNIT_DIR?=$(DESTDIR)/usr/lib/systemd/system +SYSTEMD_UNIT_DIR?=$(DESTDIR)/lib/systemd/system all: clean: install: - install -D -m 644 genwqe_maint.service $(SYSTEMD_UNIT_DIR)/genwqe_maint.service + install -D -m 644 genwqe_maint.service \ + $(SYSTEMD_UNIT_DIR)/genwqe_maint.service uninstall: -rm $(SYSTEMD_UNIT_DIR)/genwqe_maint.service diff --git a/spec/genwqe.spec b/spec/genwqe.spec index 7a6b6da..2d24a0a 100644 --- a/spec/genwqe.spec +++ b/spec/genwqe.spec @@ -78,16 +78,45 @@ GenWQE adapter VPD tools %files -n genwqe-tools %doc LICENSE %defattr(0755,root,root) -%{_bindir}/genwqe_* -%{_bindir}/zlib_mt_perf -%{_bindir}/genwqe_mt_perf -%{_bindir}/genwqe_test_gz %{_bindir}/genwqe/gunzip %{_bindir}/genwqe/gzip +%{_bindir}/genwqe_echo +%{_bindir}/genwqe_ffdc +%{_bindir}/genwqe_gunzip +%{_bindir}/genwqe_gzip +%{_bindir}/genwqe_cksum +%{_bindir}/genwqe_memcopy +%{_bindir}/genwqe_mt_perf +%{_bindir}/genwqe_peek +%{_bindir}/genwqe_poke +%{_bindir}/genwqe_test_gz +%{_bindir}/genwqe_update +%{_bindir}/zlib_mt_perf -%{_mandir}/man1/genwqe_*.gz +%{_mandir}/man1/genwqe_echo.1.gz +%{_mandir}/man1/genwqe_ffdc.1.gz +%{_mandir}/man1/genwqe_gunzip.1.gz +%{_mandir}/man1/genwqe_gzip.1.gz +%{_mandir}/man1/genwqe_cksum.1.gz +%{_mandir}/man1/genwqe_memcopy.1.gz +%{_mandir}/man1/genwqe_peek.1.gz +%{_mandir}/man1/genwqe_poke.1.gz +%{_mandir}/man1/genwqe_update.1.gz %{_mandir}/man1/zlib_mt_perf.1.gz +# Not yet working with help2man +#%{_mandir}/man1/genwqe_mt_perf.1.gz +#%{_mandir}/man1/genwqe_test_gz.1.gz + +%ifarch ppc64le +%{_bindir}/genwqe_maint +%{_prefix}/lib/systemd/system/genwqe_maint.service +%{_bindir}/genwqe_loadtree +%{_mandir}/man1/genwqe_maint.1.gz +%{_mandir}/man1/genwqe_loadtree.1.gz +%endif + + %files -n genwqe-zlib %doc LICENSE %defattr(0755,root,root) @@ -100,6 +129,7 @@ GenWQE adapter VPD tools %{_bindir}/genwqe_csv2vpd %{_bindir}/genwqe_vpdconv %{_bindir}/genwqe_vpdupdate + %{_mandir}/man1/genwqe_csv2vpd.1.gz %{_mandir}/man1/genwqe_vpdconv.1.gz %{_mandir}/man1/genwqe_vpdupdate.1.gz diff --git a/tools/Makefile b/tools/Makefile index 03af8ce..e2dc6e9 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -36,12 +36,12 @@ zlib_mt_perf_libs = ../lib/libzADC.a -ldl # statically link our libz projs = genwqe_update genwqe_gzip genwqe_gunzip zlib_mt_perf genwqe_memcopy \ genwqe_echo genwqe_peek genwqe_poke genwqe_cksum \ - genwqe_vpdconv genwqe_vpdupdate genwqe_csv2vpd genwqe_loadtree \ + genwqe_vpdconv genwqe_vpdupdate genwqe_csv2vpd \ genwqe_ffdc # Do this only on platforms where we have a libcxl available e.g. System p ifneq ($(CONFIG_LIBCXL_PATH),) -projs += genwqe_maint +projs += genwqe_maint genwqe_loadtree endif all: $(projs) @@ -53,7 +53,7 @@ $(projs): $(libs) objs = force_cpu.o genwqe_vpd_common.o $(projs:=.o) -manpages = $(projs:=.1) +manpages = $(projs:=.1.gz) manpages: all $(manpages) @@ -75,6 +75,9 @@ genwqe_gunzip.o: genwqe_gzip.c %.1: % $(HELP2MAN) -N --output=$@ --name "IBM Hardware Accelerator Tool." ./$< +%.1.gz: %.1 + gzip --best -c $< > $@ + # # Tools for card maintenance # diff --git a/tools/genwqe_test_gz b/tools/genwqe_test_gz index 7a7f3fe..0747841 100755 --- a/tools/genwqe_test_gz +++ b/tools/genwqe_test_gz @@ -30,7 +30,7 @@ export ZLIB_ACCELERATOR=GENWQE export ZLIB_CARD=-1 # Directories used -INSTALL_DIR="/opt/genwqe" # Tool RPM install directory +INSTALL_DIR="/usr" # Tool RPM install directory TOOLS_DIR="${INSTALL_DIR}/bin/genwqe" # gzip, gunzip install directory TMP_DIR="/tmp" # Temporary directory to use DATA_DIR="${TMP_DIR}/$$_testdata" # directory for testdata