From a8e40175eac1d7e1cdf89554d10c9b087fd92fb3 Mon Sep 17 00:00:00 2001 From: hachem Date: Mon, 7 Sep 2026 23:45:10 +0200 Subject: feat: add `make install` --- Makefile | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'Makefile') 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 -- cgit v1.3