42_libasm/Makefile

39 lines
596 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
2024-08-29 10:15:52 -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-08-28 09:47:11 -04:00
$(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