summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorPÁLI Gábor János <pali.gabor@gmail.com>2022-03-27 19:08:25 +0200
committerPÁLI Gábor János <pali.gabor@gmail.com>2022-03-27 19:08:25 +0200
commita34a05c190508bb69a7455ffddd90d99a1899e52 (patch)
tree99efe13cee4735805605f43d03ce33af27ce9156 /Makefile
parentb5f65a62cff5703b4ea2a78197e70c1a6408b800 (diff)
downloadfreebsd-wifibox-alpine-a34a05c190508bb69a7455ffddd90d99a1899e52.zip
Make creation of `initramfs` optional.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile27
1 files changed, 22 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index bdebb9b..b3f287a 100644
--- a/Makefile
+++ b/Makefile
@@ -11,11 +11,13 @@ MANDIR=$(DESTDIR)$(PREFIX)/man
RUNDIR=$(DESTDIR)/var/run/wifibox
WORKDIR?=$(PWD)/work
-GUESTDIR?=$(WORKDIR)/image-contents
-INITRDDIR?=$(WORKDIR)/initrd-contents
+GUESTDIR=$(WORKDIR)/image-contents
+
+.if !empty(INITRD_FILES)
+INITRDDIR=$(WORKDIR)/initrd-contents
+.endif
BOOTDIR=$(GUESTDIR)/boot
-MKINITFSDIR=$(GUESTDIR)/usr/share/mkinitfs
SHAREMODE?=0644
@@ -43,7 +45,9 @@ APK= sbin/apk
_APK= $(GUESTDIR)/$(APK)
+.if !empty(INITRD_FILES)
INITRD_IMG= $(BOOTDIR)/initramfs
+.endif
SQUASHFS_COMP?= lzo
SQUASHFS_IMG= $(PWD)/alpine-$(VERSION).squashfs.img
@@ -122,6 +126,9 @@ $(GUESTDIR)/.done:
image-contents: $(GUESTDIR)/.done
+.if defined(INITRD_IMG)
+MKINITFSDIR=$(GUESTDIR)/usr/share/mkinitfs
+
$(INITRD_IMG): image-contents $(INITRD_FILES)
$(RM) -rf $(INITRDDIR)
(cd $(GUESTDIR) \
@@ -139,6 +146,7 @@ $(INITRD_IMG): image-contents $(INITRD_FILES)
&& $(FIND) . \
| $(CPIO) -o -y --format newc --owner root:wheel \
> $(INITRD_IMG))
+.endif
.if defined(EXCLUDED_FILES)
_EXCLUDE_FILES= -ef $(EXCLUDED_FILES)
@@ -158,7 +166,7 @@ _EXCLUDE_FW_FILES= -ef $(EXCLUDE_FIRMWARE_FILES)
_EXCLUDE_FW_FILES=
.endif
-$(SQUASHFS_IMG): image-contents $(INITRD_IMG)
+$(SQUASHFS_IMG): image-contents
.if defined(_FW_FILES)
(cd $(GUESTDIR) \
&& $(FIND) lib/firmware -not -type d -and $(_FW_FILES) \
@@ -174,11 +182,18 @@ $(SQUASHFS_IMG): image-contents $(INITRD_IMG)
$(_EXCLUDE_FW_FILES) \
-e boot -e .done -e "var/*"
-all: $(SQUASHFS_IMG)
+_TARGETS= $(SQUASHFS_IMG)
+.if defined(INITRD_IMG)
+_TARGETS+= $(INITRD_IMG)
+.endif
+
+all: $(_TARGETS)
install:
$(MKDIR) -p $(SHAREDIR)
+.if defined(INITRD_IMG)
$(INSTALL_DATA) $(INITRD_IMG) $(SHAREDIR)
+.endif
$(INSTALL_DATA) $(SQUASHFS_VMLINUZ) $(SHAREDIR)/vmlinuz
$(INSTALL_DATA) $(SQUASHFS_IMG) $(SHAREDIR)/disk.img
$(SED) ${_SUB_LIST_EXP} share/grub.cfg > $(SHAREDIR)/grub.cfg
@@ -197,7 +212,9 @@ install:
clean:
$(RM) -rf $(GUESTDIR)
+.if defined(INITRDDIR)
$(RM) -rf $(INITRDDIR)
+.endif
$(RM) -f $(SQUASHFS_IMG)
.MAIN: all