init: poweroff program

This commit is contained in:
Matheus
2024-09-01 22:53:37 -03:00
parent d42572b041
commit a876a61d08
5 changed files with 190 additions and 45 deletions
+12 -3
View File
@@ -1,13 +1,22 @@
.phony: all install
CC=x86_64-astral-gcc
LD=x86_64-astral-gcc
all: init
all: init poweroff
install:
cp init "$(DESTDIR)/init"
mkdir -pv "$(DESTDIR)/usr/sbin"
cp -v init "$(DESTDIR)/init"
cp -v poweroff "$(DESTDIR)/usr/sbin/poweroff"
init: main.o
$(LD) $(LDFLAGS) -o $@ $^
poweroff: poweroff.o
$(LD) $(LDFLAGS) -o $@ $^
main.o: main.c
$(CC) -c $(CFLAGS) -o $@ $<
$(CC) -c $(CFLAGS) -o $@ $<
poweroff.o: poweroff.c
$(CC) -c $(CFLAGS) -o $@ $<