minitalk/Makefile

57 lines
1.9 KiB
Makefile
Raw Normal View History

2023-03-01 04:36:01 +01:00
# **************************************************************************** #
# #
# .--. _ #
2023-10-26 18:33:25 +02:00
# Makefile :+: :+: #
2023-03-01 04:36:01 +01:00
# |:_/ || |_ _ ___ __ #
# By: djonker <djonker@student.codam.nl> // \ \ __| | | \ \/ / #
# (| | )|_| |_| |> < #
# Created: 2021/08/19 15:20:20 by djonker /'\_ _/`\__|\__,_/_/\_\ #
2023-10-26 18:33:25 +02:00
# Updated: 2023/10/26 18:01:29 by houtworm ######## odam.nl #
2023-03-01 04:36:01 +01:00
# #
# **************************************************************************** #
NAME =minitalk
CC =gcc
CFLAGS =-Wall -Werror -Wextra# -fsanitize=address
RM =rm -f
SSRC =src/server/server.c
SOBJ =$(SSRC:src/%.c=obj/%.o)
CSRC =src/client/client.c
COBJ =$(CSRC:src/%.c=obj/%.o)
all: $(NAME)
clean:
@$(RM) -r obj
@printf "\e[1;35mCleaned Object Files\n\e[0;00m"
fclean: clean
@$(RM) server client
@printf "\e[1;31mCleaned Executables\n\e[0;00m"
re: fclean all
$(NAME): server client
2023-10-26 18:33:25 +02:00
$(SOBJ): $(SSRC) minitalk.h Makefile
2023-03-01 04:36:01 +01:00
@mkdir -p $(dir $@)
@printf "\e[1;34mBuilding $@\n\e[0;00m"
@$(CC) $(CFLAGS) -c $(@:obj/%.o=src/%.c) -o $@
server: $(SOBJ)
@printf "\e[1;36mCompiling $@\n\e[0;00m"
@$(CC) $(CFLAGS) $^ -o $@
@printf "\e[1;32mDone\e[0;00m\n"
$(COBJ): $(CSRC)
@mkdir -p $(dir $@)
@printf "\e[1;34mBuilding $@\n\e[0;00m"
@$(CC) $(CFLAGS) -c $(@:obj/%.o=src/%.c) -o $@
client: $(COBJ)
@printf "\e[1;36mCompiling $@\n\e[0;00m"
@$(CC) $(CFLAGS) $^ -o $@
@printf "\e[1;32mDone\e[0;00m\n"
.PHONY: all clean fclean re $(NAME)