diff options
| author | hachem <im@hachem.wtf> | 2026-09-07 23:45:10 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-09-07 23:45:10 +0200 |
| commit | a8e40175eac1d7e1cdf89554d10c9b087fd92fb3 (patch) | |
| tree | 7323a211f5915450dc71bff60a7e7ffd77b5e6cd | |
| parent | 95a0f895d9a828a326a0c2b0f80e16028023a97b (diff) | |
feat: add `make install`
| -rw-r--r-- | Makefile | 29 |
1 files changed, 23 insertions, 6 deletions
@@ -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 |
