check conditions of make for equality of variables with an empty value

check conditions of  make  for equality of variables with an empty value
instead of check definition.
A defined but empty variable under all these conditions results errors.
This commit is contained in:
Anton Midyukov 2022-11-23 12:39:50 +07:00
parent 38666a5b29
commit 41b065336f
32 changed files with 54 additions and 56 deletions

View File

@ -6,12 +6,12 @@
-include $(HOME)/.mkimage/profiles.mk
# for immediate assignment
ifndef ARCH
ifeq (,$(ARCH))
ARCH := $(shell arch \
| sed 's/i686/i586/; s/armv7.*/armh/; s/armv.*/arm/')
endif
ifndef ARCHES
ifeq (,$(ARCHES))
ARCHES := $(ARCH)
endif

View File

@ -1,10 +1,10 @@
# build asciidoc books
ifdef BUILDDIR
ifneq (,$(BUILDDIR))
DEST = -D "$(BUILDDIR)"
endif
ifdef DEBUG
ifneq (,$(DEBUG))
VERBOSE = --verbose
endif

View File

@ -10,7 +10,7 @@
include $(BUILDDIR)/distcfg.mk
ifndef 00EXAMPLE
ifeq (,$(00EXAMPLE))
$(warning this is an example, who might want to include it? :])
endif

View File

@ -1,7 +1,6 @@
# step 3: copy the needed features to $(BUILDDIR)
# (only regarding the needed subprofiles)
ifndef BUILDDIR
ifeq (,$(BUILDDIR))
help/plus all: banner
@$(call grepper,'^+')

View File

@ -10,7 +10,7 @@ IMAGE_PACKAGES = $(DOT_BASE) \
IMAGE_PACKAGES_REGEXP = $(THE_PACKAGES_REGEXP) \
$(BASE_PACKAGES_REGEXP)
ifdef EFI_BOOTLOADER
ifneq (,$(EFI_BOOTLOADER))
VM_BOOTLOADER=$(EFI_BOOTLOADER)
else
VM_BOOTLOADER=$(BASE_BOOTLOADER)
@ -30,7 +30,7 @@ VM_XZ_COMMAND ?= xz -T0 -f
RECOVERY_LINE ?= Press ENTER to start
# tarball save
ifdef VM_SAVE_TARBALL
ifneq (,$(VM_SAVE_TARBALL))
ifeq (,$(filter-out img img.xz qcow2 qcow2c vdi vmdk vhd,$(IMAGE_TYPE)))
ifeq (,$(filter-out tar tar.gz tar.xz,$(VM_SAVE_TARBALL)))
SAVE_TARBALL := convert-image/$(VM_SAVE_TARBALL)
@ -69,7 +69,7 @@ prepare-tarball-qemu:
tar -rf "$(VM_TARBALL)" ./.host/qemu*) ||:
convert-image/tar:
ifdef SAVE_TARBALL
ifneq (,$(SAVE_TARBALL))
cp "$(VM_TARBALL)" "$(VM_OUT_TARBALL)"
else
mv "$(VM_TARBALL)" "$(VM_OUT_TARBALL)"

View File

@ -30,7 +30,7 @@ ifeq (,$(filter-out x86_64 ,$(ARCH)))
endif
use/dev/builder/full: use/dev use/dev/builder/live use/dev/repo
ifdef BIGRAM
ifneq (,$(BIGRAM))
@$(call set,KFLAVOURS,$(BIGRAM))
endif
@$(call add,THE_LISTS,$(call tags,server extra))

View File

@ -1,4 +1,4 @@
ifdef BUILDDIR
ifneq (,$(BUILDDIR))
# in seconds
DEFAULT_TIMEOUT = 60
@ -8,28 +8,28 @@ DEFAULT_TIMEOUT = 60
include $(BUILDDIR)/distcfg.mk
ifndef BOOTLOADER
ifeq (,$(BOOTLOADER))
$(error grub feature enabled but BOOTLOADER undefined)
endif
STAGE1_INITRD_BOOTARGS := $(STAGE1_INITRD_TYPEARGS)=$(STAGE1_INITRD_BOOTMETHOD)
ifndef GRUB_DIRECT
ifeq (,$(GRUB_DIRECT))
# SUBPROFILES are considered GRUB_CFG too
# (note these can appear like stage2@live);
# 01defaults.cfg is included indefinitely
GRUB_CFG := $(GRUB_CFG) $(SUBPROFILE_DIRS) defaults fwsetup_efi
endif
ifdef GRUB_UI
ifneq (,$(GRUB_UI))
GRUB_CFG := $(GRUB_CFG) gfxterm
endif
ifdef LOCALE
ifneq (,$(LOCALE))
GRUB_CFG := $(GRUB_CFG) lang
endif
ifdef KFLAVOURS
ifneq (,$(KFLAVOURS))
ifneq ($(words $(KFLAVOURS)),1)
GRUB_CFG := $(GRUB_CFG) kernel
endif

View File

@ -1,6 +1,6 @@
# set up initrd-bootchain config
ifdef BUILDDIR
ifneq (,$(BUILDDIR))
include $(BUILDDIR)/distcfg.mk

View File

@ -1,6 +1,6 @@
# stage2 mod: build install2 subprofile (installer "live" part)
ifndef INSTALLER
ifeq (,$(INSTALLER))
$(error install2 feature enabled but INSTALLER undefined)
endif

View File

@ -1,18 +1,18 @@
# set up livecd browser redirection page
ifdef BUILDDIR
ifneq (,$(BUILDDIR))
include $(BUILDDIR)/distcfg.mk
ifndef HOMEPAGE
ifeq (,$(HOMEPAGE))
HOMEPAGE = http://altlinux.org/
endif
ifndef HOMENAME
ifeq (,$(HOMENAME))
HOMENAME = ALT
endif
ifndef HOMEWAIT
ifeq (,$(HOMEWAIT))
HOMEWAIT = 3
endif

View File

@ -1,4 +1,4 @@
ifdef BUILDDIR
ifneq (,$(BUILDDIR))
include $(BUILDDIR)/distcfg.mk

View File

@ -1,4 +1,4 @@
ifdef BUILDDIR
ifneq (,$(BUILDDIR))
# in deciseconds
DEFAULT_TIMEOUT = 600
@ -8,7 +8,7 @@ DEFAULT_TIMEOUT = 600
include $(BUILDDIR)/distcfg.mk
ifndef BOOTLOADER
ifeq (,$(BOOTLOADER))
$(error syslinux feature enabled but BOOTLOADER undefined)
endif
@ -16,14 +16,14 @@ STAGE1_INITRD_BOOTARGS := $(STAGE1_INITRD_TYPEARGS)=$(STAGE1_INITRD_BOOTMETHOD)
# UI is backed by modules in modern syslinux
# (except for built-in text prompt)
ifdef SYSLINUX_UI
ifneq (,$(SYSLINUX_UI))
SYSLINUX_MODULES := $(SYSLINUX_MODULES) $(SYSLINUX_UI)
else
$(warning no syslinux ui configured, default is now none)
SYSLINUX_UI := none
endif
ifndef SYSLINUX_DIRECT
ifeq (,$(SYSLINUX_DIRECT))
# SUBPROFILES are considered SYSLINUX_CFG too
# (note these can appear like stage2@live);
# 01defaults.cfg is included indefinitely

View File

@ -36,7 +36,7 @@ IMAGEDIR := $(wildcard $(IMAGEDIR))
IMAGE_SORTDIR := $(wildcard $(SORTDIR))
# use distro version in image name if defined
ifdef DISTRO_VERSION
ifneq (,$(DISTRO_VERSION))
IMAGE_VERSION := -$(DISTRO_VERSION)
IMAGE_VER_LINK := $(IMAGE_NAME)$(IMAGE_VERSION)-latest-$(ARCH).$(IMAGE_TYPE)
endif

View File

@ -1,7 +1,7 @@
ifneq (clean,$(MAKECMDGOALS))
ifneq (distclean,$(MAKECMDGOALS))
ifndef INCLUDED_FUNCTIONS_MK
ifeq (,$(INCLUDED_FUNCTIONS_MK))
INCLUDED_FUNCTIONS_MK = 1
# globals

View File

@ -1,4 +1,4 @@
ifndef MKIMAGE_PROFILES
ifeq (,$(MKIMAGE_PROFILES))
$(error this makefile is designed to be included in toplevel one)
endif

View File

@ -6,12 +6,12 @@ MAX_LINES = 200
MAX_ERRORS = 5
GOTCHA := ^(((\*\* )?(E:|[Ee]rror|[Ww]arning).*)|(.* (FAILURE|FATAL|ERROR|conflicts|Conflicts:|Depends:) .*)|(.* (Stop|failed|not found)\.)|(not allowed))$$
ifndef MKIMAGE_PROFILES
ifeq (,$(MKIMAGE_PROFILES))
$(error this makefile is designed to be included in toplevel one)
endif
# try not to bog down the system, both CPU and I/O wise
ifdef NICE
ifneq (,$(NICE))
START := nice $(shell ionice -c3 echo "ionice -c3" 2>/dev/null)
endif

View File

@ -1,4 +1,4 @@
ifndef MKIMAGE_PROFILES
ifeq (,$(MKIMAGE_PROFILES))
$(error this makefile is designed to be included in toplevel one)
endif

View File

@ -8,12 +8,12 @@ SYMLINK = build
# tmpfs-sparing extra rule: cleanup workdir after completing each stage
# (as packed results are saved this only lowers RAM pressure)
# NB: it's useful enough to be enabled by default in DEBUG abscence
ifndef DEBUG
ifeq (,$(DEBUG))
CLEAN ?= 1
endif
ifdef CLEAN
ifneq (,$(CLEAN))
export GLOBAL_CLEAN_WORKDIR = clean-current
ifdef DEBUG
ifneq (,$(DEBUG))
WARNING = (NB: DEBUG scope is limited when CLEAN is enabled)
endif
endif

View File

@ -1,6 +1,6 @@
# step 2: build up distribution's configuration
ifndef MKIMAGE_PROFILES
ifeq (,$(MKIMAGE_PROFILES))
$(error this makefile is designed to be included in toplevel one)
endif

View File

@ -2,7 +2,7 @@
# you can add plain $(LOG) to a rule recipe line to moderate it
# (logfile is automatically truncated during profile/init)
ifndef MKIMAGE_PROFILES
ifeq (,$(MKIMAGE_PROFILES))
$(error this makefile is designed to be included in toplevel one)
endif
@ -17,7 +17,7 @@ endif
BUILDLOG ?= $(BUILDDIR)/$(BUILD_LOG)
# LOG holds a redirecting postprocessor
ifdef DEBUG
ifneq (,$(DEBUG))
# 1) makefile target; 2) also passed to script hooks
GLOBAL_DEBUG := debug
GLOBAL_VERBOSE ?= $(DEBUG)

View File

@ -1,4 +1,4 @@
ifndef MKIMAGE_PROFILES
ifeq (,$(MKIMAGE_PROFILES))
$(error this makefile is designed to be included in toplevel one)
endif
@ -6,7 +6,7 @@ ifneq (,$(filter-out $(DIRECT_TARGETS),$(MAKECMDGOALS)))
# this could have come from env; or could be symlinked; or is made anew
# (the reuse rationale is avoiding extra tmpdir lookups)
# NB: immediate assignment matters
ifndef BUILDDIR
ifeq (,$(BUILDDIR))
BUILDLINK := $(realpath $(SYMLINK))
BUILDDIR := $(shell \
if [ -s "$(SYMLINK)" -a "$(NUM_TARGETS)" = 1 ] && \

View File

@ -1,6 +1,6 @@
# step 2: build up virtual environment's configuration
ifndef MKIMAGE_PROFILES
ifeq (,$(MKIMAGE_PROFILES))
$(error this makefile is designed to be included in toplevel one)
endif

View File

@ -1,6 +1,6 @@
# step 2: build up virtual machine's configuration
ifndef MKIMAGE_PROFILES
ifeq (,$(MKIMAGE_PROFILES))
$(error this makefile is designed to be included in toplevel one)
endif

View File

@ -46,7 +46,7 @@ include conf.d/*.mk
include features.in/*/config.mk
# ensure the outdir is created and globbable
ifdef IMAGEDIR
ifneq (,$(IMAGEDIR))
$(shell mkdir -p $(IMAGEDIR))
IMAGEDIR := $(wildcard $(IMAGEDIR))
endif

View File

@ -2,7 +2,7 @@
# referenced in distro configuration (and only those!)
# over to $(BUILDDIR)
ifndef BUILDDIR
ifeq (,$(BUILDDIR))
$(error BUILDDIR not defined)
endif

View File

@ -1,7 +1,7 @@
# step 3: copy package groups referenced in distro configuration
# (and only those!) over to $(BUILDDIR)
ifndef BUILDDIR
ifeq (,$(BUILDDIR))
check all: check-parents check-echo check-pkglists; @:

View File

@ -1,7 +1,6 @@
# step 3: copy package lists referenced in distro configuration
# (and only those!) over to $(BUILDDIR)
ifndef BUILDDIR
ifeq (,$(BUILDDIR))
pkgdups:
@find -type f ! -name README ! -name Makefile \
| grep -v '~$$' \

View File

@ -1,7 +1,7 @@
# step 3: copy package profiles referenced in distro configuration
# (and only those!) over to $(BUILDDIR)
ifndef BUILDDIR
ifeq (,$(BUILDDIR))
$(error BUILDDIR not defined)
endif

View File

@ -1,6 +1,6 @@
# step 3: copy the needed subprofiles to $(BUILDDIR)
ifndef BUILDDIR
ifeq (,$(BUILDDIR))
$(error BUILDDIR not defined)
endif

View File

@ -1,6 +1,6 @@
# step 4: build main subprofile (requisite + optional packages for media)
ifndef GLOBAL_BUILDDIR
ifeq (,$(GLOBAL_BUILDDIR))
$(error GLOBAL_BUILDDIR not defined)
endif

View File

@ -1,6 +1,6 @@
# step 4: build stage1 subprofile (installer bootstrap)
ifndef GLOBAL_BUILDDIR
ifeq (,$(GLOBAL_BUILDDIR))
$(error GLOBAL_BUILDDIR not defined)
endif
@ -8,7 +8,7 @@ include $(GLOBAL_BUILDDIR)/distcfg.mk
include $(GLOBAL_BUILDDIR)/functions.mk
include $(MKIMAGE_PREFIX)/config.mk
ifndef BOOTLOADER
ifeq (,$(BOOTLOADER))
$(error BOOTLOADER not defined)
endif
GLOBAL_BOOTLOADER := $(BOOTLOADER)

View File

@ -3,7 +3,7 @@
# NB: stage2 is not standalone but rather a common base
# for all livecd images (installer, live, rescue)
ifndef GLOBAL_BUILDDIR
ifeq (,$(GLOBAL_BUILDDIR))
$(error GLOBAL_BUILDDIR not defined)
endif
@ -54,7 +54,7 @@ IMAGE_PACKAGES_REGEXP += $(call kpackages, \
-include $(sort $(wildcard lib/*.mk))
# see also ./scripts.d/99-elf-stats
ifdef GLOBAL_SQUASHFS_SORT
ifneq (,$(GLOBAL_SQUASHFS_SORT))
ifeq (tight,$(SQUASHFS))
CHROOT_PACKAGES += file
pack-image: PACK_SQUASHFS_OPTS += -sort /.our/elf.lst