From a090c16af5bed8478f3fe03d99896dd74a1dffb5 Mon Sep 17 00:00:00 2001 From: Braiden Vasco Date: Sat, 4 Nov 2017 07:43:03 +0000 Subject: [PATCH] Export common paths --- Makefile | 12 ++++++++---- arch/Makefile | 2 +- iso/Makefile | 4 ++-- test/libk/Makefile | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 94031e0..929fd6e 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,25 @@ include config.mk +export INCLUDE = $(shell pwd)/include +export KERNEL = $(shell pwd)/arch/kernel +export LIBK = $(shell pwd)/libk/libk.a + run: run-iso all: all-kernel all-iso all-libk all-test clean: clean-kernel clean-iso clean-libk clean-test all-kernel: all-libk - make all -C arch I=$(shell pwd)/include LIBK=$(shell pwd)/libk/libk.a + make all -C arch clean-kernel: make clean -C arch run-iso: all-kernel - make run -C iso K=$(shell pwd)/arch/kernel + make run -C iso all-iso: all-kernel - make all -C iso K=$(shell pwd)/arch/kernel + make all -C iso clean-iso: make clean -C iso @@ -27,7 +31,7 @@ clean-libk: make clean -C libk test-libk: all-libk - make run -C test/libk I=$(shell pwd)/include LIBK=$(shell pwd)/libk/libk.a + make run -C test/libk clean-test: make clean -C test/libk diff --git a/arch/Makefile b/arch/Makefile index 2530699..3ecf37c 100644 --- a/arch/Makefile +++ b/arch/Makefile @@ -30,7 +30,7 @@ kernel: $(OBJS) grub-file --is-x86-multiboot2 $@ %.c.o: %.c - $(CC) -c $< -o $@ -std=gnu99 -ffreestanding -nostdinc -fno-builtin -fno-stack-protector -Wall -Wextra -I "$(I)" + $(CC) -c $< -o $@ -std=gnu99 -ffreestanding -nostdinc -fno-builtin -fno-stack-protector -Wall -Wextra -I "$(INCLUDE)" %.s.o: %.s $(AS) $< -o $@ diff --git a/iso/Makefile b/iso/Makefile index 67b3d3a..7f24c23 100644 --- a/iso/Makefile +++ b/iso/Makefile @@ -2,8 +2,8 @@ run: all qemu-system-i386 -cdrom image.iso all: - grub-file --is-x86-multiboot2 "$(K)" - cp "$(K)" rootfs/boot/kernelmq + grub-file --is-x86-multiboot2 "$(KERNEL)" + cp "$(KERNEL)" rootfs/boot/kernelmq grub-mkrescue rootfs -o image.iso clean: diff --git a/test/libk/Makefile b/test/libk/Makefile index 1b3c96a..05d1e09 100644 --- a/test/libk/Makefile +++ b/test/libk/Makefile @@ -15,4 +15,4 @@ run-%.bin: %.bin @./$< && echo "[ OK ] $*" || echo "[FAIL] $*" %.bin: %.c - $(CC) $< -o $@ $(CFLAGS) -I "$(I)" "$(LIBK)" + $(CC) $< -o $@ $(CFLAGS) -I "$(INCLUDE)" "$(LIBK)"