From 69756e36d1f3d992f645b54910246d403b057fbe Mon Sep 17 00:00:00 2001 From: gbrochar Date: Thu, 9 Sep 2021 10:23:52 +0200 Subject: [PATCH] New : Makefile and empty program [0.0.0] --- .gitignore | 2 ++ Makefile | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 1 + inc/macros.h | 14 +++++++++++++ inc/ncurses.h | 9 ++++++++ src/main.c | 8 +++++++ 6 files changed, 92 insertions(+) create mode 100644 Makefile create mode 100644 inc/macros.h create mode 100644 inc/ncurses.h create mode 100644 src/main.c diff --git a/.gitignore b/.gitignore index cd531cf..a2017da 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +# Binary name +ncurses # ---> C # Prerequisites *.d diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4e7c8b1 --- /dev/null +++ b/Makefile @@ -0,0 +1,58 @@ +NAME = ncurses + +SRC_FILE = \ + main.c \ + +OBJ_FILE = $(SRC_FILE:.c=.o) + +INC_FILE = \ + ncurses.h \ + macros.h \ + +SRC_DIR = src/ +OBJ_DIR = obj/ +INC_DIR = inc/ + +SRC = $(addprefix $(SRC_DIR), $(SRC_FILE)) +OBJ = $(addprefix $(OBJ_DIR), $(OBJ_FILE)) +INC = $(addprefix $(INC_DIR), $(INC_FILE)) + +LIB = + +CC = gcc + +CFLAGS = -Wall -Werror -Wextra + +RED = \033[31m +GREEN = \033[32m +YELLOW = \033[33m +BLUE = \033[34m +CYAN = \033[36m +WHITE = \033[0m + +all: $(NAME) + +$(NAME): $(OBJ) $(INC) + @$(CC) $(CFLAGS) -c $(SRC) -I $(INC_DIR) + @mv $(OBJ_FILE) $(OBJ_DIR) + @$(CC) $(CFLAGS) $(OBJ) -o $(NAME) $(LIB) + @echo -e "$(GREEN)[OK]$(WHITE) $(NAME)" + +$(OBJ_DIR)%.o: $(SRC_DIR)%.c inc/ + @if [ ! -d ./obj ]; then \ + mkdir -p ./obj; \ + fi; + @$(CC) $(CFLAGS) -I $(INC_DIR) -o $@ -c $< + @echo -e "$(CYAN)[CC]$(WHITE) $<" + +clean: + @rm -rf $(OBJ_DIR) + @echo -e "$(RED)[REMOVED]$(WHITE) obj files" + +fclean: clean + @rm -f $(NAME) + @echo -e "$(RED)[REMOVED]$(WHITE) $(NAME)" + +re: fclean all + +.PHONY: all clean fclean re diff --git a/README.md b/README.md index 58931b0..b9f0a45 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # ncurses +ncurses experiment project. \ No newline at end of file diff --git a/inc/macros.h b/inc/macros.h new file mode 100644 index 0000000..677c1cd --- /dev/null +++ b/inc/macros.h @@ -0,0 +1,14 @@ +#ifndef __MACROS__ + #define __MACROS__ + + + #define FAILURE -1 + #define SUCCESS 0 + #define FALSE 0 + #define NO 0 + #define TRUE 1 + #define YES 1 + + + #endif + \ No newline at end of file diff --git a/inc/ncurses.h b/inc/ncurses.h new file mode 100644 index 0000000..0fc96cf --- /dev/null +++ b/inc/ncurses.h @@ -0,0 +1,9 @@ +#ifndef __NCURSES__ + #define __NCURSES__ + + + #include "macros.h" + + + #endif + \ No newline at end of file diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..ff5ed9a --- /dev/null +++ b/src/main.c @@ -0,0 +1,8 @@ +#include "ncurses.h" + +int main(int argc, char **argv) +{ + (void)argc; + (void)argv; + return (SUCCESS); +}