summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util/nvmutil/Makefile28
-rw-r--r--util/nvmutil/nvmutil.c7
2 files changed, 30 insertions, 5 deletions
diff --git a/util/nvmutil/Makefile b/util/nvmutil/Makefile
index 025e87e1..5e705d3c 100644
--- a/util/nvmutil/Makefile
+++ b/util/nvmutil/Makefile
@@ -7,21 +7,39 @@ CSTD?=-std=c90
WERROR?=-Werror
CWARN?=-Wall -Wextra -pedantic
COPT?=-Os
-CFLAGS?=$(CWARN) $(CSTD)
+CFLAGS?=
LDFLAGS?=
DESTDIR?=
PREFIX?=/usr/local
INSTALL?=install
LDIR?=-I.
-OPTS=$(LDIR) $(COPT) $(WERROR) $(CFLAGS) $(LDFLAGS)
+OPTS?=$(LDIR) $(CFLAGS) $(LDFLAGS)
+STRICTWARN?=$(OPTS) $(CWARN) $(CSTD) $(COPT)
+
+STRICT?=$(STRICTWARN) $(WERROR)
+
+# clang static analyser
+HELLFLAGS?=$(STRICT) -Weverything
+
+# program name
PROG=nvmutil
all: $(PROG)
-$(PROG): nvmutil.c
- $(CC) $(OPTS) nvmutil.c -o $(PROG)
+$(PROG): $(PROG).c
+ $(CC) $(OPTS) $(PROG).c -o $(PROG)
+
+strictwarn: $(PROG).c
+ $(CC) $(STRICTWARN) $(PROG).c -o $(PROG)
+
+strict: $(PROG).c
+ $(CC) $(STRICT) $(PROG).c -o $(PROG)
+
+#clang static analyser
+hell: $(PROG).c
+ $(CC) $(HELLFLAGS) $(PROG).c -o $(PROG)
install: $(PROG)
$(INSTALL) -d $(DESTDIR)$(PREFIX)/bin
@@ -36,4 +54,4 @@ clean:
distclean: clean
-.PHONY: all install uninstall clean distclean
+.PHONY: all strictwarn strict hell install uninstall clean distclean
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index eea06ed0..2eee7a42 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -2682,6 +2682,13 @@ x_c_strrchr(const char *s, int c)
}
/*
+ * non-atomic rename
+ *
+ * commented because i can't sacrifice
+ * exactly this property. nvmutil tries
+ * to protect files against e.g. power loss
+ */
+/*
int
x_i_rename(const char *src, const char *dst)
{