From e0e9557e7144e9dd08469b2bbd26ef205e2effa8 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sun, 13 Nov 2022 17:34:17 +0100 Subject: [PATCH] add makefile and main fn --- .gitignore | 3 +++ Makefile | 26 ++++++++++++++++++++++++++ src/main.c | 1 + 3 files changed, 30 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 src/main.c diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..68b48b0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.o + +othello diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5665c29 --- /dev/null +++ b/Makefile @@ -0,0 +1,26 @@ +CXX = gcc +CXXFLAGS = -std=c99 -pedantic +RM = rm + +SOURCES = $(wildcard src/*.c) +OBJETS = $(patsubst %.c,%.c.o,$(notdir $(SOURCES))) + +EXE = othello + +%.c.o: src/%.c + $(CXX) -c -o $@ $< $(CXXFLAGS) $(DEVFLAGS) + +main: CXXFLAGS += -O3 +main: compilation + +dev: CXXFLAGS += -Wall -Wextra -Wshadow -Wcast-align -Wstrict-prototypes -fanalyzer -fsanitize=undefined -g +dev: compilation + +compilation: $(OBJETS) + $(CXX) -o $(EXE) $(OBJETS) + +all: + main + +clean: + $(RM) $(OBJETS) $(EXE) diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..b552c8e --- /dev/null +++ b/src/main.c @@ -0,0 +1 @@ +int main(void) {}