From 46f47e711de9bd61495e7e1093d1be1ef742dba4 Mon Sep 17 00:00:00 2001 From: Federico Vaga <federico.vaga@cern.ch> Date: Tue, 22 Oct 2019 10:08:14 +0200 Subject: [PATCH] [sw] install dkms sources Signed-off-by: Federico Vaga <federico.vaga@cern.ch> --- software/Makefile | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/software/Makefile b/software/Makefile index 21482cb2..52354ab5 100644 --- a/software/Makefile +++ b/software/Makefile @@ -1,3 +1,9 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright (C) 2019 CERN + +TOP_DIR ?= $(shell pwd)/.. + -include Makefile.specific # include parent_common.mk for buildsystem's defines @@ -5,11 +11,36 @@ REPO_PARENT ?= $(shell /bin/pwd)/.. -include $(REPO_PARENT)/parent_common.mk +GCORES ?= $(TOP_DIR) +include $(GCORES)/common.mk +DIR_NAME := general-cores-$(VERSION) +DST := $(PREFIX)/usr/src/$(DIR_NAME)/ + DIRS := i2c-ocores DIRS += spi-ocores DIRS += htvic -.PHONY: all clean modules install modules_install +GIT ?= git +ifeq (,$(shell which $(GIT))) +$(error "Missing git") +endif + +.PHONY: all clean modules install modules_install dkms_install all clean modules install modules_install: for D in $(DIRS); do $(MAKE) -C $$D $@; done + +dkms_install: + $(eval $@_dst := $(shell mktemp -d)) + @mkdir -p $($@_dst) + @mkdir -p $(DST) + @$(GIT) archive --format=tar -o $($@_dst)/$(DIR_NAME).tar --prefix=$(DIR_NAME)/ HEAD + @cd $($@_dst) && tar -xf $(DIR_NAME).tar + @mv $($@_dst)/$(DIR_NAME)/* $(DST) && rm -rf $($@_dst) + @cp $(GCORES)/common.mk $(DST) + @sed -e '2,$$d' -i $(DST)/common.mk + @sed -r -i -e "s/@PKGVER@/$(VERSION)/" $(DST)/dkms.conf + @sed -e "15d" -e "6,13d" -e "23,26d" -e '33,$$d' \ + -i $(DST)/Makefile + @find $(DST) -name Makefile -exec \ + sed -r -e "s,^(TOP_DIR.*)[.]{2}/?$$,\1," -i {} \; -- GitLab