aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-06-27 13:14:43 +0200
committerCharles <sircharlesaze@gmail.com>2020-06-27 13:14:43 +0200
commite2c1a8b40787516b9f8f3697a73ac406eae05e6f (patch)
tree6eca534ada1e5bbf0c5401d1d7f6bfa8bd914dbd
downloadhanoi-e2c1a8b40787516b9f8f3697a73ac406eae05e6f.tar.gz
hanoi-e2c1a8b40787516b9f8f3697a73ac406eae05e6f.tar.bz2
hanoi-e2c1a8b40787516b9f8f3697a73ac406eae05e6f.zip
Initial commit
-rw-r--r--.gitignore3
-rw-r--r--Makefile55
-rw-r--r--inc/hanoi.h6
-rw-r--r--src/main.c12
4 files changed, 76 insertions, 0 deletions
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 <charles.cabergs@gmail.com> /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 <ncurses.h>
+
+#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;
+}