39 lines
632 B
Makefile
39 lines
632 B
Makefile
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))
|
|
|
|
CC := i386-elf-gcc
|
|
CFLAGS := -std=gnu99 -ffreestanding -O2 -Wall -Wextra -iquoteheaders -c
|
|
|
|
AS := i386-elf-as
|
|
ASFLAGS :=
|
|
AR := ar
|
|
ARFLAGS :=
|
|
|
|
NAME = libbozo.a
|
|
|
|
obj/%.o: src/%.s
|
|
mkdir -p $(dir $@)
|
|
$(AS) $(ASFLAGS) $< -o $@
|
|
|
|
obj/%.o: src/%.c
|
|
mkdir -p $(dir $@)
|
|
$(CC) $(CFLAGS) $< -o $@
|
|
|
|
all : $(NAME)
|
|
|
|
clean :
|
|
rm -rf obj
|
|
|
|
fclean : clean
|
|
rm -rf build
|
|
|
|
$(NAME) : $(OBJ)
|
|
mkdir -p build
|
|
$(AR) -rc build/$(NAME) $(OBJ)
|
|
|
|
re: fclean all
|
|
|
|
.PHONY: clean fclean all re
|