hazel/user/Makefile

35 lines
575 B
Makefile
Raw Normal View History

2024-07-28 10:11:15 -04:00
CC = i686-elf-gcc
ASM = nasm
# Flags
CFLAGS = -ffreestanding -nostdlib -Wall -Wextra
ASMFLAGS = -f elf32
# Source files
C_SOURCES = $(wildcard *.c)
ASM_SOURCES = $(wildcard *.asm)
# Object files
C_OBJECTS = $(C_SOURCES:.c=.o)
ASM_OBJECTS = $(ASM_SOURCES:.asm=.o)
OBJECTS = $(C_OBJECTS) $(ASM_OBJECTS)
# Output binary
OUTPUT = ../boot/initrd
.PHONY: all clean
all: $(OUTPUT)
$(OUTPUT): $(OBJECTS)
$(CC) -ffreestanding -nostdlib $(OBJECTS) -o $(OUTPUT)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
%.o: %.asm
$(ASM) $(ASMFLAGS) -o $@ $<
clean:
rm -f $(OBJECTS) $(OUTPUT)