summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile25
1 files changed, 14 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 22883a1..6832bbd 100644
--- a/Makefile
+++ b/Makefile
@@ -1,21 +1,24 @@
+CC = gcc
+CFLAGS ?= -O2 -pipe
+MAKEFLAGS += -L -R -r
+
all: initramfs.img
-initramfs.img:
+initramfs.img: gen_init_cpio
./make
-include initramfs.d
-install: install-initramfs.img
+gen_init_cpio: gen_init_cpio.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $@
-install-initramfs.img: initramfs.img
- rm -f $@.old $@.new
- cp $< $@.new
- if [ -e $@ ]; then mv $@ $@.old; fi
- mv $@.new $@
+install: initramfs.img
+ rm -f /boot/$<.old /boot/$<.new
+ cp $< /boot/$<.new || rm -f /boot/$<.new
+ if [ -e /boot/$< ]; then mv /boot/$< /boot/$<.old; fi
+ mv /boot/$<.new /boot/$<
clean:
- $(RM) -r initramfs.img initramfs.d kernel
-
-.PHONY: all install install-initramfs.img clean
+ rm -f -r initramfs.img initramfs.d gen_init_cpio
-MAKEFLAGS = -L -R -r
+.PHONY: all install clean