commit ec24e658ab893c65e8931676d3035292ca7f8bb2
parent 4ef8ce9f3b2ddf311eb5f3413609affb72b1c20a
Author: Louis Burda <quent.burda@gmail.com>
Date: Sun, 17 Jan 2021 00:18:34 +0100
Remove binary blobs files
Diffstat:
12 files changed, 53 insertions(+), 46 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -1,3 +1,4 @@
compile_commands.json
main
.cache
+build
diff --git a/data/helper/template/Makefile b/data/helper/template/Makefile
@@ -1,5 +1,5 @@
-CFLAGS = -I ../../libs/include
-LDLIBS =
+CFLAGS = -I ../../libs/include -L ../../libs/build
+LDLIBS = -laoc
all: lib main
diff --git a/data/helper/template/main.c b/data/helper/template/main.c
@@ -5,13 +5,11 @@
#include "util.h"
void
-part1(struct PartInfo *p) {
+part1(struct partinfo *p) {
}
void
-part2(struct PartInfo *p) {
+part2(struct partinfo *p) {
}
-
-#include "main.h"
diff --git a/libs/Makefile b/libs/Makefile
@@ -3,11 +3,14 @@ LDLIBS =
all: build/libaoc.a
+clean:
+ rm -rf build
+
build:
mkdir build
-build/util.o: src/util.c | build
- $(CC) -c -o $@ $^ $(CFLAGS) $(LDLIBS)
+build/%.o: src/%.c include/%.h | build
+ $(CC) -c -o $@ $< $(CFLAGS) $(LDLIBS)
-build/libaoc.a: build/util.o
+build/libaoc.a: build/util.o build/wrapper.o
ar rcs $@ $^
diff --git a/libs/build/libaoc.a b/libs/build/libaoc.a
Binary files differ.
diff --git a/libs/build/util.o b/libs/build/util.o
Binary files differ.
diff --git a/libs/include/main.h b/libs/include/main.h
@@ -1,29 +0,0 @@
-#include "util.h"
-
-int
-main(int argc, const char **argv)
-{
- struct PartInfo info;
- const char *envvar;
- FILE *f;
-
- if (argc <= 1) die("Supply the part number to solve\n");
- info.args = &argv[2];
-
- info.inputfile = getenv("AOCINPUT");
- if (!info.inputfile) info.inputfile = "input";
- else debug("Using input file: '%s'\n", info.inputfile);
-
- envvar = getenv("AOCDEBUG");
- info.debug = envvar ? atoi(envvar) : 0;
-
- if (!(f = fopen("input", "r"))) die("Failed to open input file\n");
- if (readall(fileno(f), (void**) &info.input, &info.input_size) == FAILURE)
- die("Failed to read from input file\n");
- fclose(f);
-
- info.part = atoi(argv[1]);
- if (info.part == 1) part1(&info);
- else if (info.part == 2) part2(&info);
- else die("Invalid part number\n");
-}
diff --git a/libs/include/partinfo.h b/libs/include/partinfo.h
@@ -3,7 +3,7 @@
#include <stdlib.h>
-struct PartInfo {
+struct partinfo {
int debug;
int part;
diff --git a/libs/include/wrapper.h b/libs/include/wrapper.h
@@ -0,0 +1,7 @@
+#include "util.h"
+#include "partinfo.h"
+
+void part1(struct partinfo *p);
+void part2(struct partinfo *p);
+
+
diff --git a/libs/src/wrapper.c b/libs/src/wrapper.c
@@ -0,0 +1,29 @@
+#include "wrapper.h"
+
+int
+main(int argc, const char **argv)
+{
+ struct partinfo info;
+ const char *envvar;
+ FILE *f;
+
+ if (argc <= 1) die("Supply the part number to solve\n");
+ info.args = &argv[2];
+
+ info.inputfile = getenv("AOCINPUT");
+ if (!info.inputfile) info.inputfile = "input";
+ else debug("Using input file: '%s'\n", info.inputfile);
+
+ envvar = getenv("AOCDEBUG");
+ info.debug = envvar ? atoi(envvar) : 0;
+
+ if (!(f = fopen("input", "r"))) die("Failed to open input file\n");
+ if (readall(fileno(f), (void**) &info.input, &info.input_size) == FAILURE)
+ die("Failed to read from input file\n");
+ fclose(f);
+
+ info.part = atoi(argv[1]);
+ if (info.part == 1) part1(&info);
+ else if (info.part == 2) part2(&info);
+ else die("Invalid part number\n");
+}
diff --git a/src/day1/Makefile b/src/day1/Makefile
@@ -1,5 +1,5 @@
-CFLAGS = -I ../../libs/include
-LDLIBS = -L ../../libs/build -laoc
+CFLAGS = -I ../../libs/include -laoc
+LDLIBS = -L ../../libs/build
all: lib main
diff --git a/src/day1/main.c b/src/day1/main.c
@@ -5,13 +5,11 @@
#include "util.h"
void
-part1(struct PartInfo *p) {
-
+part1(struct partinfo *p) {
+
}
void
-part2(struct PartInfo *p) {
+part2(struct partinfo *p) {
}
-
-#include "main.h"