limine/limine-install/Makefile
2021-04-11 09:56:48 +02:00

37 lines
1.0 KiB
Makefile

CC = cc
OBJCOPY = objcopy
PREFIX = /usr/local
DESTDIR =
OBJCOPY_ARCH = default
LIMINE_HDD_BIN = limine-hdd.bin
BUILD_DIR = $(shell realpath .)
CFLAGS = -O2 -pipe -Wall -Wextra
.PHONY: all clean
all: limine-install
install: all
install -d "$(DESTDIR)$(PREFIX)/bin"
install -s limine-install "$(DESTDIR)$(PREFIX)/bin/"
install -d "$(DESTDIR)$(PREFIX)/share"
install -d "$(DESTDIR)$(PREFIX)/share/limine"
install -m 644 limine.sys "$(DESTDIR)$(PREFIX)/share/limine/"
install -m 644 limine-cd.bin "$(DESTDIR)$(PREFIX)/share/limine/"
install -m 644 limine-eltorito-efi.bin "$(DESTDIR)$(PREFIX)/share/limine/"
install -m 644 limine-pxe.bin "$(DESTDIR)$(PREFIX)/share/limine/"
install -m 644 BOOTX64.EFI "$(DESTDIR)$(PREFIX)/share/limine/"
clean:
rm -f limine-hdd.o limine-install limine-install.exe
limine-install: limine-install.c limine-hdd.o
$(CC) $(CFLAGS) -std=c11 $^ -o $@
limine-hdd.o: $(shell echo "$(LIMINE_HDD_BIN)" | sed 's/ /\\ /g')
cd "`dirname $^`" && \
$(OBJCOPY) -B i8086 -I binary -O $(OBJCOPY_ARCH) "`basename $^`" "$(BUILD_DIR)/$@"