42_libasm/Makefile

40 lines
604 B
Makefile
Raw Normal View History

2024-08-28 09:47:11 -04:00
SRCDIR = src
OBJDIR = obj
BUILDDIR = build
SRC := $(wildcard $(SRCDIR)/*.asm)
OBJ := $(patsubst $(SRCDIR)/%.asm,$(OBJDIR)/%.o,$(SRC))
CC = gcc
CFLAGS =
AS = nasm
ASFLAGS = -f elf64
AR = ar
ARFLAGS =
NAME = libasm.a
$(OBJDIR)/%.o: $(SRCDIR)/%.asm
mkdir -p $(OBJDIR)
$(AS) $(ASFLAGS) $< -o $@
all : $(NAME)
test : $(NAME)
$(CC) $(CFLAGS) test/test.c $(NAME) -o $(BUILDDIR)/test
$(BUILDDIR)/test
rm -rf $(BUILDDIR)/test
clean :
rm -rf $(OBJDIR)
fclean : clean
rm -rf $(BUILDDIR)
$(NAME) : $(OBJ)
mkdir -p $(BUILDDIR)
$(AR) -rc $(BUILDDIR)/$(NAME) $(OBJ)
.PHONY: clean fclean test all