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 |
Author
hochan222
commented
Oct 25, 2020
•
Basic C Makefile
CC = gcc
FLAGS = -Wall -Wextra -Werror -g
RM = rm -rf
DIR_HEADERS = ./includes/
DIR_SRCS = ./srcs/
DIR_OBJS = ./
LIBFT = -L ./library/libft -lft
GNL = -L ./library/gnl -lgnl
MLX = -L ./library/mlx -lmlx -framework OpenGL -framework AppKit
SAVE = -g3 -fsanitize=address
SRC = cub3d.c \
init.c \
init_window.c \
init_sprite.c \
key_events.c \
key_events2.c \
calc.c \
sprite_casting.c \
sprite_sort.c \
wall_casting.c \
wall_casting2.c \
error.c \
parse_cub.c \
parse_cub2.c \
parse_map.c \
parse_map2.c \
free.c \
save.c \
SRCS = $(addprefix $(DIR_SRCS), $(SRC))
COMPIL = $(FLAGS) $(SAVE)
OBJS = $(SRCS:.c=.o)
NAME = cub3D
all: $(NAME)
$(NAME) : $(OBJS)
@$(MAKE) -C ./library/libft all
@$(MAKE) -C ./library/gnl all
@$(MAKE) -C ./library/mlx all
@cp ./library/libft/libft.a ${NAME}
@cp ./library/gnl/libgnl.a ${NAME}
$(CC) $(COMPIL) -I $(DIR_HEADERS) $(MLX) $(LIBFT) $(GNL) $(OBJS) -o $(NAME)
%.o: %.c
gcc $(FLAGS) -I $(DIR_HEADERS) -c $< -o $@
echo "Compiled "$<" successfully!"
bonus:
norme:
norminette $(DIR_SRCS)
norminette $(DIR_HEADERS)
clean:
$(RM) $(OBJS)
@$(MAKE) -C ./library/libft clean
@$(MAKE) -C ./library/gnl clean
@$(MAKE) -C ./library/mlx clean
fclean: clean
@$(MAKE) -C ./library/libft fclean
@$(MAKE) -C ./library/gnl fclean
@$(MAKE) -C ./library/mlx clean
$(RM) $(NAME)
re: fclean all
.PHONY: all, clean, fclean, re, bonus
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment