Simplify Makefile

This commit is contained in:
Holger Obermaier 2023-08-16 15:40:33 +02:00
parent ef49701f14
commit fb480993ed

View File

@ -1,31 +1,33 @@
# LIKWID version # LIKWID version
LIKWID_VERSION = 5.2.2 LIKWID_VERSION := 5.2.2
LIKWID_INSTALLED_FOLDER=$(shell dirname $(shell which likwid-topology 2>/dev/null) 2>/dev/null) LIKWID_INSTALLED_FOLDER := $(shell dirname $$(which likwid-topology 2>/dev/null) 2>/dev/null)
LIKWID_FOLDER="$(shell pwd)/likwid" LIKWID_FOLDER := $(CURDIR)/likwid
all: $(LIKWID_FOLDER)/likwid.h all: likwid
.ONESHELL: .ONESHELL:
.PHONY: $(LIKWID_FOLDER)/likwid.h .PHONY: likwid
$(LIKWID_FOLDER)/likwid.h: likwid:
if [ "$(LIKWID_INSTALLED_FOLDER)" != "" ]; then \ if [ -n "$(LIKWID_INSTALLED_FOLDER)" ]; then
BASE="$(LIKWID_INSTALLED_FOLDER)/../include"; \ # Using likwid include files from system installation
mkdir -p $(LIKWID_FOLDER); \ INCLUDE_DIR="$(LIKWID_INSTALLED_FOLDER)/../include"
cp $$BASE/*.h $(LIKWID_FOLDER); \ mkdir --parents --verbose "$(LIKWID_FOLDER)"
else \ cp "$${INCLUDE_DIR}"/*.h "$(LIKWID_FOLDER)"
BUILD_FOLDER="$${PWD}/likwidbuild"; \ else
if [ -d $(LIKWID_FOLDER) ]; then rm -r $(LIKWID_FOLDER); fi; \ # Using likwid include files from downloaded tar archive
mkdir --parents --verbose $(LIKWID_FOLDER) $${BUILD_FOLDER}; \ if [ -d "$(LIKWID_FOLDER)" ]; then
wget -P "$${BUILD_FOLDER}" http://ftp.rrze.uni-erlangen.de/mirrors/likwid/likwid-$(LIKWID_VERSION).tar.gz; \ rm --recursive "$(LIKWID_FOLDER)"
tar -C $${BUILD_FOLDER} -xf $${BUILD_FOLDER}/likwid-$(LIKWID_VERSION).tar.gz; \ fi
install -Dpm 0644 $${BUILD_FOLDER}/likwid-$(LIKWID_VERSION)/src/includes/likwid*.h $(LIKWID_FOLDER)/; \ BUILD_FOLDER="$${PWD}/likwidbuild"
install -Dpm 0644 $${BUILD_FOLDER}/likwid-$(LIKWID_VERSION)/src/includes/bstrlib.h $(LIKWID_FOLDER)/; \ mkdir --parents --verbose "$${BUILD_FOLDER}"
rm -r $${BUILD_FOLDER}; \ wget --output-document=- http://ftp.rrze.uni-erlangen.de/mirrors/likwid/likwid-$(LIKWID_VERSION).tar.gz |
tar --directory="$${BUILD_FOLDER}" --extract --gz
install -D --verbose --preserve-timestamps --mode=0644 --target-directory="$(LIKWID_FOLDER)" "$${BUILD_FOLDER}/likwid-$(LIKWID_VERSION)/src/includes"/likwid*.h "$${BUILD_FOLDER}/likwid-$(LIKWID_VERSION)/src/includes"/bstrlib.h
rm --recursive "$${BUILD_FOLDER}"
fi fi
.PHONY: clean
clean: clean:
rm -rf likwid rm -rf likwid
.PHONY: clean