hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile29
1 files changed, 23 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index b98c49f..4ccb778 100644
--- a/Makefile
+++ b/Makefile
@@ -1,26 +1,32 @@
CC := clang
+STD := c17
+
SANITIZE ?= 1
-CFLAGS := -g \
+CFLAGS := -std=$(STD) \
-Wall \
-Wextra \
-Wshadow \
-Wpedantic \
- -std=c17 \
-Wconversion \
-Wstrict-prototypes \
-Wsign-conversion \
- -Wmissing-prototypes \
- -fno-omit-frame-pointer
+ -Wmissing-prototypes
ifeq ($(SANITIZE),1)
-CFLAGS += -fsanitize=address,undefined
+CFLAGS += -g -fno-omit-frame-pointer -fsanitize=address,undefined
LDFLAGS += -fsanitize=address,undefined
+else
+CFLAGS += -O2
endif
TARGET := mkproj
SRC := mkproj.c
+PREFIX ?= /usr/local
+bindir := $(DESTDIR)$(PREFIX)/bin
+mandir := $(DESTDIR)$(PREFIX)/share/man/man1
+
all: $(TARGET)
$(TARGET): $(SRC)
@@ -35,4 +41,15 @@ check:
clean:
rm -f $(TARGET)
-.PHONY: all check clean
+install: mkproj.1
+ $(MAKE) SANITIZE=0 clean all
+ install -d $(bindir)
+ install -m 755 $(TARGET) $(bindir)/$(TARGET)
+ install -d $(mandir)
+ install -m 644 mkproj.1 $(mandir)/mkproj.1
+
+uninstall:
+ rm -f $(bindir)/$(TARGET)
+ rm -f $(mandir)/mkproj.1
+
+.PHONY: all check clean install uninstall