42_libasm/Makefile

41 lines
642 B
Makefile
Raw Permalink 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
2024-09-03 08:35:27 -04:00
CFLAGS = -g
2024-08-28 09:47:11 -04:00
AS = nasm
2024-08-29 10:19:20 -04:00
ASFLAGS = -f elf64 -g
2024-08-28 09:47:11 -04:00
AR = ar
ARFLAGS =
NAME = libasm.a
$(OBJDIR)/%.o: $(SRCDIR)/%.asm
mkdir -p $(OBJDIR)
$(AS) $(ASFLAGS) $< -o $@
all : $(NAME)
test : $(NAME)
2024-08-29 10:15:52 -04:00
$(CC) $(CFLAGS) test/test.c $(BUILDDIR)/$(NAME) -o $(BUILDDIR)/test
2024-09-11 14:20:49 -04:00
valgrind --leak-check=full $(BUILDDIR)/test
2024-08-28 09:47:11 -04:00
clean :
rm -rf $(OBJDIR)
fclean : clean
rm -rf $(BUILDDIR)
$(NAME) : $(OBJ)
mkdir -p $(BUILDDIR)
$(AR) -rc $(BUILDDIR)/$(NAME) $(OBJ)
2024-08-29 10:20:03 -04:00
re: fclean all
.PHONY: clean fclean test all re