35 lines
552 B
Makefile
35 lines
552 B
Makefile
SRCDIR = src
|
|
OBJDIR = obj
|
|
BUILDDIR = build
|
|
|
|
SRC := $(shell find $(SRCDIR) -name '*.c')
|
|
OBJ := $(patsubst $(SRCDIR)/%.c,$(OBJDIR)/%.o,$(SRC))
|
|
|
|
CC = i386-elf-gcc
|
|
CFLAGS = -std=gnu99 -ffreestanding -O2 -Wall -Wextra -iquoteheaders -c
|
|
|
|
AR = ar
|
|
ARFLAGS =
|
|
|
|
NAME = libbozo.a
|
|
|
|
$(OBJDIR)/%.o: $(SRCDIR)/%.c
|
|
mkdir -p $(dir $@)
|
|
$(CC) $(CFLAGS) $< -o $@
|
|
|
|
all : $(NAME)
|
|
|
|
clean :
|
|
rm -rf $(OBJDIR)
|
|
|
|
fclean : clean
|
|
rm -rf $(BUILDDIR)
|
|
|
|
$(NAME) : $(OBJ)
|
|
mkdir -p $(BUILDDIR)
|
|
$(AR) -rc $(BUILDDIR)/$(NAME) $(OBJ)
|
|
|
|
re: fclean all
|
|
|
|
.PHONY: clean fclean test all re
|