From e2c1a8b40787516b9f8f3697a73ac406eae05e6f Mon Sep 17 00:00:00 2001 From: Charles Date: Sat, 27 Jun 2020 13:14:43 +0200 Subject: Initial commit --- .gitignore | 3 +++ Makefile | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ inc/hanoi.h | 6 ++++++ src/main.c | 12 ++++++++++++ 4 files changed, 76 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 inc/hanoi.h create mode 100644 src/main.c diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..19aaa58 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.o +a.out +hanoi diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ba4a74b --- /dev/null +++ b/Makefile @@ -0,0 +1,55 @@ +# ############################################################################ # +# # +# . # +# Makefile / \ # +# / \ # +# By: charles /o o \ # +# / v \ # +# Created: 2020/06/27 13:12:43 by charles / _ \ # +# Updated: 2020/06/27 13:12:48 by charles '-----------' # +# # +# ############################################################################ # + +RM = rm -f + +INCDIR = inc +SRCDIR = src +OBJDIR = obj +OBJDIRS = $(shell find $(SRCDIR) -type d | sed 's/src/$(OBJDIR)/') + +INC = $(shell find $(INCDIR) -name "*.h") +SRC = $(shell find $(SRCDIR) -name "*.c") +OBJ = $(SRC:$(SRCDIR)/%.c=$(OBJDIR)/%.o) + +CC = gcc +CCFLAGS = -I$(INCDIR) -Wall -Wextra #-Werror +LDFLAGS = -lncurses + +NAME = hanoi + +all: prebuild $(NAME) + +prebuild: + @for subdir in $(OBJDIRS); do mkdir -vp $$subdir; done + +$(NAME): $(OBJ) + @echo "Linking: $@" + $(CC) -o $@ $(OBJ) $(LDFLAGS) + +$(OBJDIR)/%.o: $(SRCDIR)/%.c $(INC) + @echo "Compiling: $@" + @$(CC) $(CCFLAGS) -c -o $@ $< + +clean: + @echo "Removing objects" + @$(RM) -r $(OBJDIR) + +fclean: + @echo "Removing objects" + @$(RM) -r $(OBJDIR) + @echo "Removing exectable" + @$(RM) $(NAME) + +re: fclean all + +.PHONY: all prebuild clean fclean re diff --git a/inc/hanoi.h b/inc/hanoi.h new file mode 100644 index 0000000..7f93e21 --- /dev/null +++ b/inc/hanoi.h @@ -0,0 +1,6 @@ +#ifndef HANOI_H +# define HANOI_H + +# include + +#endif diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..465b5ca --- /dev/null +++ b/src/main.c @@ -0,0 +1,12 @@ +#include "hanoi.h" + +int main() +{ + initscr(); + + refresh(); + getch(); + + endwin(); + return 0; +} -- cgit