2024-09-21 06:17:27 -04:00
|
|
|
SSRC := $(shell find src -name '*.s')
|
|
|
|
CSRC := $(shell find src -name '*.c')
|
|
|
|
OBJ := $(patsubst src/%.c,obj/%.o,$(CSRC))\
|
|
|
|
$(patsubst src/%.s,obj/%.o,$(SSRC))
|
2024-09-07 08:40:46 -04:00
|
|
|
|
2024-09-21 06:17:27 -04:00
|
|
|
CC := i386-elf-gcc
|
|
|
|
CFLAGS := -std=gnu99 -ffreestanding -O2 -Wall -Wextra -iquoteheaders -c
|
2024-09-07 08:40:46 -04:00
|
|
|
|
2024-09-21 06:17:27 -04:00
|
|
|
AS := i386-elf-as
|
|
|
|
ASFLAGS :=
|
|
|
|
AR := ar
|
|
|
|
ARFLAGS :=
|
2024-09-07 08:40:46 -04:00
|
|
|
|
|
|
|
NAME = libbozo.a
|
|
|
|
|
2024-09-21 06:17:27 -04:00
|
|
|
obj/%.o: src/%.s
|
|
|
|
mkdir -p $(dir $@)
|
|
|
|
$(AS) $(ASFLAGS) $< -o $@
|
|
|
|
|
|
|
|
obj/%.o: src/%.c
|
2024-09-07 08:40:46 -04:00
|
|
|
mkdir -p $(dir $@)
|
|
|
|
$(CC) $(CFLAGS) $< -o $@
|
|
|
|
|
|
|
|
all : $(NAME)
|
|
|
|
|
|
|
|
clean :
|
2024-09-21 06:17:27 -04:00
|
|
|
rm -rf obj
|
2024-09-07 08:40:46 -04:00
|
|
|
|
|
|
|
fclean : clean
|
2024-09-21 06:17:27 -04:00
|
|
|
rm -rf build
|
2024-09-07 08:40:46 -04:00
|
|
|
|
|
|
|
$(NAME) : $(OBJ)
|
2024-09-21 06:17:27 -04:00
|
|
|
mkdir -p build
|
|
|
|
$(AR) -rc build/$(NAME) $(OBJ)
|
2024-09-07 08:40:46 -04:00
|
|
|
|
|
|
|
re: fclean all
|
|
|
|
|
2024-09-21 06:17:27 -04:00
|
|
|
.PHONY: clean fclean all re
|