Blame Makefile

Packit Service 6a4ea0
default : all
Packit Service 6a4ea0
Packit Service 6a4ea0
TOPDIR = $(shell echo $$PWD)
Packit Service 6a4ea0
Packit Service 6a4ea0
include $(TOPDIR)/Makefile.version
Packit Service 6a4ea0
Packit Service 6a4ea0
DESTDIR ?=
Packit Service 6a4ea0
RPM = $(shell command -v rpm)
Packit Service 6a4ea0
ifeq (${RPM},)
Packit Service 6a4ea0
$(error rpm could not be found)
Packit Service 6a4ea0
endif
Packit Service 6a4ea0
MACRODIR = $(shell ${RPM} --eval '%{_rpmmacrodir}')
Packit Service 6a4ea0
ifeq (${MACRODIR},)
Packit Service 6a4ea0
$(error rpm macro directory could not be found)
Packit Service 6a4ea0
endif
Packit Service 6a4ea0
Packit Service 6a4ea0
EFI_ESP_ROOT	?= /boot/efi
Packit Service 6a4ea0
EFI_ARCHES	?= x86_64 aarch64 %{arm} %{ix86}
Packit Service 6a4ea0
EFI_VENDOR	?=
Packit Service 6a4ea0
Packit Service 6a4ea0
# TARGETS = macros.efi macros.efi-srpm efi-rpm-macros.spec
Packit Service 6a4ea0
TARGETS = macros.efi-srpm efi-rpm-macros.spec
Packit Service 6a4ea0
Packit Service 6a4ea0
check_efi_vendor :
Packit Service 6a4ea0
ifeq ($(EFI_VENDOR),)
Packit Service 6a4ea0
	$(error EFI_VENDOR must be set)
Packit Service 6a4ea0
endif
Packit Service 6a4ea0
Packit Service 6a4ea0
all : | check_efi_vendor
Packit Service 6a4ea0
all : $(TARGETS)
Packit Service 6a4ea0
Packit Service 6a4ea0
clean :
Packit Service 6a4ea0
	@rm -vf $(TARGETS)
Packit Service 6a4ea0
Packit Service 6a4ea0
install : | check_efi_vendor
Packit Service 6a4ea0
install : $(TARGETS)
Packit Service 6a4ea0
	install -d -m 0755 $(DESTDIR)/$(MACRODIR)
Packit Service 6a4ea0
	# install -m 0644 macros.efi $(DESTDIR)/$(MACRODIR)/
Packit Service 6a4ea0
	install -m 0644 macros.efi-srpm $(DESTDIR)/$(MACRODIR)/
Packit Service 6a4ea0
	if [[ "$(EFI_ESP_ROOT)" != /boot ]] ; then \
Packit Service 6a4ea0
		install -d -m 0755 $(DESTDIR)/boot ; \
Packit Service 6a4ea0
	fi
Packit Service 6a4ea0
	install -d -m 0700 $(DESTDIR)/$(EFI_ESP_ROOT)
Packit Service 6a4ea0
	install -d -m 0700 $(DESTDIR)/$(EFI_ESP_ROOT)/EFI/BOOT
Packit Service 6a4ea0
	install -d -m 0700 $(DESTDIR)/$(EFI_ESP_ROOT)/EFI/$(EFI_VENDOR)
Packit Service 6a4ea0
Packit Service 6a4ea0
$(TARGETS) :
Packit Service 6a4ea0
% : %.in
Packit Service 6a4ea0
	@echo creating $@
Packit Service 6a4ea0
	@sed	\
Packit Service 6a4ea0
		-e 's,@@EFI_ESP_ROOT@@,$(EFI_ESP_ROOT),g' \
Packit Service 6a4ea0
		-e 's,@@EFI_ARCHES@@,$(EFI_ARCHES),g' \
Packit Service 6a4ea0
		-e 's,@@EFI_VENDOR@@,$(EFI_VENDOR),g' \
Packit Service 6a4ea0
		-e 's,@@EFI_RPM_MACROS_VERSION@@,$(VERSION),g' \
Packit Service 6a4ea0
		<$^ >$@
Packit Service 6a4ea0
Packit Service 6a4ea0
test-archive: efi-rpm-macros.spec
Packit Service 6a4ea0
	@rm -rf /tmp/efi-rpm-macros-$(VERSION) /tmp/efi-rpm-macros-$(VERSION)-tmp
Packit Service 6a4ea0
	@mkdir -p /tmp/efi-rpm-macros-$(VERSION)-tmp
Packit Service 6a4ea0
	@git archive --format=tar $(shell git branch | awk '/^*/ { print $$2 }') | ( cd /tmp/efi-rpm-macros-$(VERSION)-tmp/ ; tar x )
Packit Service 6a4ea0
	@git diff | ( cd /tmp/efi-rpm-macros-$(VERSION)-tmp/ ; patch -s -p1 -b -z .gitdiff )
Packit Service 6a4ea0
	@mv /tmp/efi-rpm-macros-$(VERSION)-tmp/ /tmp/efi-rpm-macros-$(VERSION)/
Packit Service 6a4ea0
	@cp efi-rpm-macros.spec /tmp/efi-rpm-macros-$(VERSION)/
Packit Service 6a4ea0
	@dir=$$PWD; cd /tmp; tar -c --bzip2 -f $$dir/efi-rpm-macros-$(VERSION).tar.bz2 efi-rpm-macros-$(VERSION)
Packit Service 6a4ea0
	@rm -rf /tmp/efi-rpm-macros-$(VERSION)
Packit Service 6a4ea0
	@echo "The archive is in efi-rpm-macros-$(VERSION).tar.bz2"
Packit Service 6a4ea0
Packit Service 6a4ea0
GITTAG ?= $(shell bash -c "echo $$(($(VERSION) + 1))")
Packit Service 6a4ea0
Packit Service 6a4ea0
bumpver :
Packit Service 6a4ea0
	@echo VERSION ?= $(GITTAG) > Makefile.version
Packit Service 6a4ea0
	@git add Makefile.version
Packit Service 6a4ea0
	git commit -m "Bump version to $(GITTAG)" -s
Packit Service 6a4ea0
Packit Service 6a4ea0
tag:
Packit Service 6a4ea0
	git tag -s $(GITTAG) refs/heads/master
Packit Service 6a4ea0
Packit Service 6a4ea0
archive: bumpver tag
Packit Service 6a4ea0
	@rm -vf efi-rpm-macros.spec
Packit Service 6a4ea0
	@$(MAKE) VERSION=$(GITTAG) efi-rpm-macros.spec
Packit Service 6a4ea0
	@rm -rf /tmp/efi-rpm-macros-$(GITTAG) /tmp/efi-rpm-macros-$(GITTAG)-tmp
Packit Service 6a4ea0
	@mkdir -p /tmp/efi-rpm-macros-$(GITTAG)-tmp
Packit Service 6a4ea0
	@git archive --format=tar $(GITTAG) | ( cd /tmp/efi-rpm-macros-$(GITTAG)-tmp/ ; tar x )
Packit Service 6a4ea0
	@mv /tmp/efi-rpm-macros-$(GITTAG)-tmp/ /tmp/efi-rpm-macros-$(GITTAG)/
Packit Service 6a4ea0
	@cp efi-rpm-macros.spec /tmp/efi-rpm-macros-$(GITTAG)/
Packit Service 6a4ea0
	@dir=$$PWD; cd /tmp; tar -c --bzip2 -f $$dir/efi-rpm-macros-$(GITTAG).tar.bz2 efi-rpm-macros-$(GITTAG)
Packit Service 6a4ea0
	@rm -rf /tmp/efi-rpm-macros-$(GITTAG)
Packit Service 6a4ea0
	@echo "The archive is in efi-rpm-macros-$(GITTAG).tar.bz2"
Packit Service 6a4ea0
Packit Service 6a4ea0
.PHONY : default all clean install test-archive bumpver tag archive