42_libasm/Makefile

40 lines
618 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
ASFLAGS = -f elf64
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
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