summaryrefslogtreecommitdiff
path: root/Makefile
blob: 6832bbd28b917ed98e21e944dd5c455a9af037cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
CC = gcc
CFLAGS ?= -O2 -pipe
MAKEFLAGS += -L -R -r

all: initramfs.img

initramfs.img: gen_init_cpio
	./make

-include initramfs.d

gen_init_cpio: gen_init_cpio.c
	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $@

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 -f -r initramfs.img initramfs.d gen_init_cpio

.PHONY: all install clean