From 2006cfcf744ab57a5c81ed63c3ebe1d3adb3e562 Mon Sep 17 00:00:00 2001 From: Braiden Vasco Date: Thu, 9 Nov 2017 06:01:31 +0000 Subject: [PATCH] Makefile refactoring --- Makefile | 4 +++- arch/Makefile | 5 ++--- test/Makefile | 8 ++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 0c445c0..d61272e 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,8 @@ export MODULES = $(addprefix $(shell pwd)/modules/, dummy1.bin dummy2.bin) export CFLAGS = -std=gnu99 -ffreestanding -nostdinc -fno-builtin -fno-stack-protector -Wall -Wextra -I $(INCLUDE) +SUBDIRS = arch iso libk modules src test + ifeq (none, $(ARCH)) run: all-kernel @$(KERNEL) @@ -23,7 +25,7 @@ endif all: all-kernel -clean: clean-kernel clean-iso clean-libk clean-arch clean-src clean-test clean-modules +clean: clean-kernel $(addprefix clean-, $(SUBDIRS)) test: run-test diff --git a/arch/Makefile b/arch/Makefile index e251fe2..70a07a9 100644 --- a/arch/Makefile +++ b/arch/Makefile @@ -1,12 +1,11 @@ export OUTPUT = kernelmq -ARCHES = $(shell ls -d */) -ARCHES := $(ARCHES:/=) +SUBDIRS = none x86 all: make all -C $(ARCH) -clean: $(addprefix clean-, $(ARCHES)) +clean: $(addprefix clean-, $(SUBDIRS)) clean-%: make clean -C $* diff --git a/test/Makefile b/test/Makefile index 7971148..8e550b1 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,8 +1,8 @@ -SUITES = libk +SUBDIRS = libk -run: $(addprefix run-, $(SUITES)) -all: $(addprefix all-, $(SUITES)) -clean: $(addprefix clean-, $(SUITES)) +run: $(addprefix run-, $(SUBDIRS)) +all: $(addprefix all-, $(SUBDIRS)) +clean: $(addprefix clean-, $(SUBDIRS)) run-%: all-% make run -C $*