diff options
author | Alex Xu (Hello71) <alex_y_xu@yahoo.ca> | 2020-11-13 20:46:30 -0500 |
---|---|---|
committer | Alex Xu (Hello71) <alex_y_xu@yahoo.ca> | 2020-11-13 20:46:57 -0500 |
commit | eea8da433a73dbfc864d4a1c4594831dbf86e9de (patch) | |
tree | ecf9b54a8da4ee184fbd4831ab6e1d180a8571b5 /Makefile | |
parent | 094d664e6c6ed6b6e122216c7f2a7e988d9d9949 (diff) | |
download | minitramfs-eea8da433a73dbfc864d4a1c4594831dbf86e9de.tar.xz minitramfs-eea8da433a73dbfc864d4a1c4594831dbf86e9de.zip |
Makefile: use install, refactor, POSIXify
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -1,15 +1,19 @@ -MAKEFLAGS += -r CFLAGS += -Wall -Wextra null := space := $(null) $(null) KERNVER ?= $(lastword $(subst /,$(space),$(wildcard /lib/modules/*/))) +# slightly faster +MAKEFLAGS += -r + +FORCE: + all: initramfs.img initramfs.img: gen_init_cpio make modules.dep $(shell awk '$$1 == "file" { print $$3 }' cpio_list.txt) KERNVER=$(KERNVER) COMPRESSOR="zstd -19 -c -T0" ./make -%: %.c +gen_init_cpio: gen_init_cpio.c $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $< -o $@ dropbear_ed25519_host_key: @@ -22,8 +26,7 @@ modules.dep: modules modules.dep.ver /lib/modules/$(KERNVER)/modules.dep awk '!/^#/ { print $$1 }' modules | xargs modinfo -F filename -k $(KERNVER) | sed -e 's:^/lib/modules/$(KERNVER)/:^:' | grep -f - /lib/modules/$(KERNVER)/modules.dep > $@ install: initramfs.img - rm -f /boot/initramfs.img.old /boot/initramfs.img.new - cp initramfs.img /boot/initramfs.img.new || rm -f /boot/initramfs.img.new + install -m644 initramfs.img /boot/initramfs.img.new if [ -e /boot/initramfs.img ]; then mv /boot/initramfs.img /boot/initramfs.img.old; fi mv /boot/initramfs.img.new /boot/initramfs.img @@ -33,4 +36,3 @@ clean: -include initramfs.d .PHONY: all install clean -FORCE: |