Last active
October 25, 2020 07:59
-
-
Save hochan222/4fe26730d1851bc57f1a289979de3516 to your computer and use it in GitHub Desktop.
Basic Assembler Makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NAME = libasm.a | |
SAVE = -g3 -fsanitize=address | |
FLAGS = -Wall -Wextra -Werror $(SAVE) | |
DIR_SRCS = ./src/ | |
SRC = ft_strlen.s | |
SRCS = $(addprefix $(DIR_SRCS), $(SRC)) | |
OBJS = $(SRCS:%.s=%.o) | |
%.o: %.s | |
@nasm -f macho64 $< -o $@ | |
@echo "\033[90m[\033[32mOK\033[90m]\033[33m Compiling $<\033[0m" | |
all: $(NAME) | |
$(NAME) : $(OBJS) | |
@ar rcs $(NAME) $(OBJS) | |
@echo "\033[90m[\033[32mSuccess\033[90m]\033[32m Successfully compiled libasm.a .\033[0m" | |
test: all | |
@$(CC) main.c $(NAME) $(FLAGS) | |
@echo "\033[90m[\033[32mSuccess\033[90m]\033[32m Successfully compiled test's .\033[0m" | |
clean: | |
@$(RM) $(OBJS) $(OBJS_BONUS) | |
@echo "\033[90m[\033[91mDeleting\033[90m]\033[31m Object files deleted\033[0m" | |
fclean: clean | |
@$(RM) $(NAME) a.out | |
@echo "\033[90m[\033[91mDeleting\033[90m]\033[31m libasm.a deleted.\033[0m" | |
@echo "\033[90m[\033[91mDeleting\033[90m]\033[31m test deleted.\033[0m" | |
re: fclean bonus test | |
.PHONY: all test clean fclean re bonus |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Basic C Makefile