I am building a bare bones freestanding kernel in ASM and C. My make file is below.CFLAGS= -ffreestanding -nostdlib -gdwarf-4 -m32 -ggdb3 -Wall -Wextra -Werror -std=c11ASMCFLAGS= -f elf32 -F dwarf -g -w+allLDFLAGS= --nmagic -m elf_i386 --script=os.ldsBUILD_DIR=../build/osBUILD_DIR_IMM=$(BUILD_DIR)/immBUILD_DIR_IMM_ASM=$(BUILD_DIR_IMM)/asmBUILD_DIR_IMM_C=$(BUILD_DIR_IMM)/cBUILD_OUTPUT=$(BUILD_DIR)/osOS_C_SRCS := $(wildcard *.c)OS_C_OBJS := $(patsubst %.c, $(BUILD_DIR_IMM_C)/%.o, $(OS_C_SRCS))OS_ASM_SRCS := $(wildcard *.asm)OS_ASM_OBJS := $(patsubst %.asm, $(BUILD_DIR_IMM_ASM)/%.o, $(OS_ASM_SRCS))OS_SRCS := $(OS_C_SRCS) $(OS_ASM_SRCS)OS_OBJS := $(OS_ASM_OBJS) $(OS_C_OBJS)all: $(BUILD_OUTPUT)prepdir:    mkdir -p $(BUILD_DIR_IMM_C)    mkdir -p $(BUILD_DIR_IMM_ASM)$(OS_C_OBJS): $(OS_C_SRCS) $(OS_ASM_OBJS) prepdir    $(CC) $(CFLAGS) -c $< -o $@$(BUILD_DIR_IMM_ASM)/__init.o: __init.asm prepdir    nasm $(ASMCFLAGS) __init.asm -o $@$(BUILD_DIR_IMM_ASM)/kinit.o: kinit.asm prepdir    nasm $(ASMCFLAGS) kinit.asm -o $@$(BUILD_DIR_IMM_ASM)/keyboard.o: keyboard.asm prepdir    nasm $(ASMCFLAGS) keyboard.asm -o $@$(BUILD_DIR_IMM_ASM)/interrupt.o: interrupt.asm prepdir    nasm $(ASMCFLAGS) interrupt.asm -o $@$(BUILD_DIR_IMM_ASM)/string.o: string.asm prepdir    nasm $(ASMCFLAGS) string.asm -o $@$(BUILD_DIR_IMM_ASM)/vid.o: vid.asm prepdir    nasm $(ASMCFLAGS) vid.asm -o $@$(BUILD_OUTPUT): $(OS_C_OBJS) $(OS_ASM_OBJS)    ld $(LDFLAGS) $(OS_OBJS) -o $@clean:    rm -rf $(BUILD_DIR)This makefile is used as a child makefile.My primary concern is that I cannot pass multiple files to NASM, so I need a rule for each assembly file I have. My secondary concern is cross dependencies on other files, for instance, my C files should be rebuild if any C header files change.
Makefile for building ASM/C project
c;makefile