From 33e9dca022909244cc0f545e841eab3c38024427 Mon Sep 17 00:00:00 2001 From: Blake Romero Date: Sun, 6 Oct 2024 00:34:22 +0100 Subject: Add Makefile & command args to main --- Makefile | 26 ++++++++++++++++++++++++++ src/main.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 Makefile create mode 100644 src/main.c diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6dd9909 --- /dev/null +++ b/Makefile @@ -0,0 +1,26 @@ +# Compiler options +CC=gcc +CFLAGS=-std=c17 -Wall -Werror -g + +# Directory paths +src=src +bin=bin + +# Directives +.PHONY: build +build: $(bin)/ctodo + +.PHONY: clean +clean: + -rm -r $(bin) $(obj) + +# Build executable +$(bin)/ctodo: $(bin) $(src)/main.c + $(CC) $(CFLAGS) -o $@ $(filter-out $<,$^) + +# Make bin directory +$(bin): + mkdir $@ + + + diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..d64de1a --- /dev/null +++ b/src/main.c @@ -0,0 +1,44 @@ +#include // for booleans +#include // for input/output +#include // for STD macros +#include // for getopt + +void print_args(int argc, char* argv[]) { + printf("There are %i arguments\n",argc); + printf("Those arguments are:\n"); + for (int i=0; i\n", argv[0], valid_opts); + exit(EXIT_FAILURE); + } + } + + return 0; +} -- cgit