Beautified makefile output

This commit is contained in:
lucic71 2020-06-23 13:57:54 +03:00
parent 8a1fb40613
commit 80faf143d2
3 changed files with 40 additions and 22 deletions

View File

@ -57,15 +57,20 @@ all: lib_all | module_all kernel.elf
# module_all - Recursively build all modules.
module_all:
$(MAKE) -C $(MODULES_ROOT_DIR)
@$(call print_banner, "Building modules")
@$(MAKE) -C $(MODULES_ROOT_DIR)
@echo
lib_all:
$(MAKE) -C $(LIB_DIR)
@$(call print_banner, "Building the library")
@$(MAKE) -C $(LIB_DIR)
@echo
# kernel.elf - Link all root objects and module objects to create the
# kernel.elf executable
kernel.elf: $(OBJ)
@$(call print_banner, "Building the kernel")
$(LD) $(LDFLAGS) $(OBJ) $(MODULE_OBJ) -o kernel.elf
# os.iso - Create the OS image and place the kernel fiel in GRUB directory.
@ -99,17 +104,21 @@ run: os.iso
$(AS) $(ASFLAGS) $< -o $@
clean: mclean lclean
@$(call print_banner, "Cealning root directory")
@$(RM) *.o kernel.elf os.iso bochslog.txt iso/boot/kernel.elf
mclean:
@$(call print_banner, "Cleaning the modules")
$(MAKE) -C $(MODULES_ROOT_DIR) clean
lclean:
@$(call print_banner, "Cleaning the library")
$(MAKE) -C $(LIB_DIR) clean
# Function declarations
# Functions
define print_info
@echo ""
@echo $(1)
define print_banner
@echo
@echo "*************** $(1) ***************"
@echo
endef

View File

@ -31,18 +31,22 @@ all: rbuild
# Build all libraries recursively.
rbuild:
for dir in $(LIB_DIR); do \
cp $(SCRIPTS_DIR)/MakefileLib $$dir/Makefile; \
$(MAKE) -C $$dir; \
$(RM) $$dir/Makefile; \
done
@echo
@$(foreach LIB, $(LIB_DIR), \
cp $(SCRIPTS_DIR)/MakefileLib $(LIB)/Makefile; \
$(MAKE) -C $(LIB); \
$(RM) $(LIB)/Makefile; \
echo; \
)
# Clean all libraries recursively.
clean:
for dir in $(LIB_DIR); do \
cp $(SCRIPTS_DIR)/MakefileLib $$dir/Makefile; \
$(MAKE) -C $$dir clean; \
$(RM) $$dir/Makefile; \
done
@echo
@$(foreach LIB, $(LIB_DIR), \
cp $(SCRIPTS_DIR)/MakefileLib $(LIB)/Makefile; \
$(MAKE) -C $(LIB) clean; \
$(RM) $(LIB)/Makefile; \
echo; \
)
@$(RM) -rv $(SO_DIR)/$(SO)

View File

@ -6,11 +6,16 @@ MODULE_INC_DIR = include/
MODULE_DIR := $(filter-out $(MODULE_INC_DIR), $(MODULE_DIR))
all:
for dir in $(MODULE_DIR); do \
$(MAKE) -C $$dir; \
done
@echo
@$(foreach MODULE, $(MODULE_DIR), \
$(MAKE) -C $(MODULE); \
echo ""; \
)
clean:
for dir in $(MODULE_DIR); do \
$(MAKE) -C $$dir clean; \
done
@echo
@$(foreach MODULE, $(MODULE_DIR), \
$(MAKE) -C $(MODULE) clean; \
echo ""; \
)