From 8068e598188d57cac6e94d6c4936eed03d9d5d3b Mon Sep 17 00:00:00 2001 From: Thomas Roehl Date: Fri, 13 May 2022 13:14:47 +0200 Subject: [PATCH] Update handling of LIKWID headers. Download only if not already present in the system. Fixes #73 --- collectors/Makefile | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/collectors/Makefile b/collectors/Makefile index b07bccd..20418ed 100644 --- a/collectors/Makefile +++ b/collectors/Makefile @@ -1,22 +1,28 @@ - -all: likwid - - # LIKWID version LIKWID_VERSION = 5.2.1 +LIKWID_INSTALLED_FOLDER=$(shell dirname $(shell which likwid-topology 2>/dev/null)) + +LIKWID_FOLDER="$(shell pwd)/likwid" + +all: $(LIKWID_FOLDER)/likwid.h .ONESHELL: -.PHONY: likwid -likwid: - INSTALL_FOLDER="$${PWD}/likwid" - BUILD_FOLDER="$${PWD}/likwidbuild" - if [ -d $${INSTALL_FOLDER} ]; then rm -r $${INSTALL_FOLDER}; fi - mkdir --parents --verbose $${INSTALL_FOLDER} $${BUILD_FOLDER} - wget -P "$${BUILD_FOLDER}" ftp://ftp.rrze.uni-erlangen.de/mirrors/likwid/likwid-$(LIKWID_VERSION).tar.gz - tar -C $${BUILD_FOLDER} -xf $${BUILD_FOLDER}/likwid-$(LIKWID_VERSION).tar.gz - install -Dpm 0644 $${BUILD_FOLDER}/likwid-$(LIKWID_VERSION)/src/includes/likwid*.h $${INSTALL_FOLDER}/ - install -Dpm 0644 $${BUILD_FOLDER}/likwid-$(LIKWID_VERSION)/src/includes/bstrlib.h $${INSTALL_FOLDER}/ - rm -r $${BUILD_FOLDER} +.PHONY: $(LIKWID_FOLDER)/likwid.h +$(LIKWID_FOLDER)/likwid.h: + if [ "$(LIKWID_INSTALLED_FOLDER)" != "" ]; then \ + BASE="$(LIKWID_INSTALLED_FOLDER)/../include"; \ + mkdir -p $(LIKWID_FOLDER); \ + cp $$BASE/*.h $(LIKWID_FOLDER); \ + else \ + BUILD_FOLDER="$${PWD}/likwidbuild"; \ + if [ -d $(LIKWID_FOLDER) ]; then rm -r $(LIKWID_FOLDER); fi; \ + mkdir --parents --verbose $(LIKWID_FOLDER) $${BUILD_FOLDER}; \ + wget -P "$${BUILD_FOLDER}" ftp://ftp.rrze.uni-erlangen.de/mirrors/likwid/likwid-$(LIKWID_VERSION).tar.gz; \ + tar -C $${BUILD_FOLDER} -xf $${BUILD_FOLDER}/likwid-$(LIKWID_VERSION).tar.gz; \ + install -Dpm 0644 $${BUILD_FOLDER}/likwid-$(LIKWID_VERSION)/src/includes/likwid*.h $(LIKWID_FOLDER)/; \ + install -Dpm 0644 $${BUILD_FOLDER}/likwid-$(LIKWID_VERSION)/src/includes/bstrlib.h $(LIKWID_FOLDER)/; \ + rm -r $${BUILD_FOLDER}; \ + fi clean: