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