aboutgitcodelistschat:MatrixIRC
path: root/seitan-cooker
diff options
context:
space:
mode:
Diffstat (limited to 'seitan-cooker')
-rw-r--r--seitan-cooker/Makefile7
-rw-r--r--seitan-cooker/util.c29
-rw-r--r--seitan-cooker/util.h22
3 files changed, 4 insertions, 54 deletions
diff --git a/seitan-cooker/Makefile b/seitan-cooker/Makefile
index 8741879..241ad4b 100644
--- a/seitan-cooker/Makefile
+++ b/seitan-cooker/Makefile
@@ -7,12 +7,13 @@
# Copyright 2023 Red Hat GmbH
# Author: Stefano Brivio <sbrivio@redhat.com>
-SRCS := calls.c emit.c gluten.c main.c parse.c parson.c util.c calls/net.c
-HEADERS := calls.h cooker.h emit.h gluten.h parse.h parson.h util.h calls/net.h
+COMMON_DIR := ../common
+SRCS := calls.c emit.c gluten.c main.c parse.c parson.c $(COMMON_DIR)/util.c calls/net.c
+HEADERS := calls.h cooker.h emit.h gluten.h parse.h parson.h calls/net.h $(COMMON_DIR)/util.h
BIN := $(OUTDIR)cooker
cooker: $(SRCS) $(HEADERS)
- $(CC) -O0 -g -Wall -Wextra -pedantic -std=c99 -o $(BIN) $(SRCS)
+ $(CC) -O0 -g -Wall -Wextra -pedantic -std=c99 -I$(COMMON_DIR) -o $(BIN) $(SRCS)
all: cooker
diff --git a/seitan-cooker/util.c b/seitan-cooker/util.c
deleted file mode 100644
index a2ecce0..0000000
--- a/seitan-cooker/util.c
+++ /dev/null
@@ -1,29 +0,0 @@
-// SPDX-License-Identifier: GPL-3.0-or-later
-
-/* seitan - Syscall Expressive Interpreter, Transformer and Notifier
- *
- * cooker/util.c - Convenience routines
- *
- * Copyright 2023 Red Hat GmbH
- * Author: Stefano Brivio <sbrivio@redhat.com>
- */
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-
-#define logfn(name) \
-void name(const char *format, ...) { \
- va_list args; \
- \
- va_start(args, format); \
- (void)vfprintf(stderr, format, args); \
- va_end(args); \
- if (format[strlen(format)] != '\n') \
- fprintf(stderr, "\n"); \
-}
-
-logfn(err)
-logfn(info)
-logfn(debug)
-
diff --git a/seitan-cooker/util.h b/seitan-cooker/util.h
deleted file mode 100644
index 84dc3db..0000000
--- a/seitan-cooker/util.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* SPDX-License-Identifier: GPL-3.0-or-later
- * Copyright 2023 Red Hat GmbH
- * Author: Stefano Brivio <sbrivio@redhat.com>
- */
-
-#ifndef UTIL_H
-#define UTIL_H
-
-#define BIT(n) (1UL << (n))
-
-void err(const char *format, ...);
-void info(const char *format, ...);
-void debug(const char *format, ...);
-
-#define die(...) \
- do { \
- fprintf(stderr, "%s:%i: ", __FILE__, __LINE__); \
- err(__VA_ARGS__); \
- exit(EXIT_FAILURE); \
- } while (0)
-
-#endif /* UTIL_H */