Updated makefile for a more customized installation

This commit is contained in:
TheDarkBug 2022-01-18 23:04:48 +01:00
parent d84fc73c54
commit b05a9d965f

View file

@ -3,21 +3,22 @@ FILES = uwufetch.c
CFLAGS = -O3 CFLAGS = -O3
CFLAGS_DEBUG = -Wall -Wextra -g -pthread CFLAGS_DEBUG = -Wall -Wextra -g -pthread
CC = cc CC = cc
DESTDIR = /usr
ifeq ($(shell uname), Linux) ifeq ($(shell uname), Linux)
PREFIX = /usr/bin PREFIX = bin
LIBDIR = /usr/lib LIBDIR = lib
MANDIR = /usr/share/man/man1 MANDIR = share/man/man1
else ifeq ($(shell uname), Darwin) else ifeq ($(shell uname), Darwin)
PREFIX = /usr/local/bin PREFIX = local/bin
LIBDIR = /usr/local/lib LIBDIR = local/lib
MANDIR = /usr/local/share/man/man1 MANDIR = local/share/man/man1
else ifeq ($(shell uname), FreeBSD) else ifeq ($(shell uname), FreeBSD)
CFLAGS += -D__FREEBSD__ CFLAGS += -D__FREEBSD__
CFLAGS_DEBUG += -D__FREEBSD__ CFLAGS_DEBUG += -D__FREEBSD__
PREFIX = /usr/bin PREFIX = bin
LIBDIR = /usr/lib LIBDIR = lib
MANDIR = /usr/share/man/man1 MANDIR = share/man/man1
else ifeq ($(shell uname), windows32) else ifeq ($(shell uname), windows32)
CC = gcc CC = gcc
PREFIX = "C:\Program Files" PREFIX = "C:\Program Files"
@ -33,15 +34,15 @@ debug:
./$(NAME) ./$(NAME)
install: install:
mkdir -p $(DESTDIR)$(PREFIX) $(DESTDIR)$(LIBDIR)/uwufetch $(DESTDIR)$(MANDIR) mkdir -p $(DESTDIR)/$(PREFIX) $(DESTDIR)/$(LIBDIR)/uwufetch $(DESTDIR)/$(MANDIR)
cp $(NAME) $(DESTDIR)$(PREFIX)/$(NAME) cp $(NAME) $(DESTDIR)/$(PREFIX)/$(NAME)
cp -r res/* $(DESTDIR)$(LIBDIR)/uwufetch cp -r res/* $(DESTDIR)/$(LIBDIR)/uwufetch
cp ./$(NAME).1.gz $(DESTDIR)$(MANDIR)/ cp ./$(NAME).1.gz $(DESTDIR)/$(MANDIR)/
uninstall: uninstall:
rm -f $(DESTDIR)$(PREFIX)/$(NAME) rm -f $(DESTDIR)/$(PREFIX)/$(NAME)
rm -rf $(DESTDIR)$(LIBDIR)/uwufetch rm -rf $(DESTDIR)/$(LIBDIR)/uwufetch
rm -f $(DESTDIR)$(MANDIR)/$(NAME).1.gz rm -f $(DESTDIR)/$(MANDIR)/$(NAME).1.gz
termux: build termux: build
cp $(NAME) $(DESTDIR)/data/data/com.termux/files$(PREFIX)/$(NAME) cp $(NAME) $(DESTDIR)/data/data/com.termux/files$(PREFIX)/$(NAME)