New : Makefile and empty program [0.0.0]
This commit is contained in:
parent
2dfcee01c8
commit
69756e36d1
|
@ -1,3 +1,5 @@
|
|||
# Binary name
|
||||
ncurses
|
||||
# ---> C
|
||||
# Prerequisites
|
||||
*.d
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
#ifndef __NCURSES__
|
||||
#define __NCURSES__
|
||||
|
||||
|
||||
#include "macros.h"
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#include "ncurses.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
return (SUCCESS);
|
||||
}
|
Loading…
Reference in New Issue