hachem.wtf
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-09-07 23:45:10 +0200
committerhachem <im@hachem.wtf>2026-09-07 23:45:10 +0200
commita8e40175eac1d7e1cdf89554d10c9b087fd92fb3 (patch)
tree7323a211f5915450dc71bff60a7e7ffd77b5e6cd
parent95a0f895d9a828a326a0c2b0f80e16028023a97b (diff)
feat: add `make install`
-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