forked from ad-oliviero/uwufetch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
76 lines (68 loc) · 1.53 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
NAME = uwufetch
FILES = uwufetch.c
CFLAGS = -O3
CFLAGS_DEBUG = -Wall -Wextra -g -pthread
CC = cc
DESTDIR = /usr
PLATFORM = $(shell uname)
ifeq ($(PLATFORM), Linux)
PREFIX = bin
LIBDIR = lib
ifeq ($(shell uname -o), Android)
DESTDIR = /data/data/com.termux/files/usr
endif
ifneq ($(DESTDIR), /usr)
ETC_DIR = $(DESTDIR)/etc
else
ETC_DIR = /etc
endif
MANDIR = share/man/man1
else ifeq ($(PLATFORM), Darwin)
PREFIX = local/bin
LIBDIR = local/lib
ifneq ($(DESTDIR), /usr)
ETC_DIR = $(DESTDIR)/etc
else
ETC_DIR = /etc
endif
MANDIR = local/share/man/man1
else ifeq ($(PLATFORM), FreeBSD)
CFLAGS += -D__FREEBSD__
CFLAGS_DEBUG += -D__FREEBSD__
PREFIX = bin
LIBDIR = lib
ifneq ($(DESTDIR), /usr)
ETC_DIR = $(DESTDIR)/etc
else
ETC_DIR = /etc
endif
MANDIR = share/man/man1
else ifeq ($(PLATFORM), windows32)
CC = gcc
PREFIX = "C:\Program Files"
LIBDIR =
MANDIR =
endif
build: $(FILES)
$(CC) $(CFLAGS) -o $(NAME) $(FILES)
debug:
$(CC) $(CFLAGS_DEBUG) -o $(NAME) $(FILES)
./$(NAME)
install: build
mkdir -p $(DESTDIR)/$(PREFIX) $(DESTDIR)/$(LIBDIR)/uwufetch $(DESTDIR)/$(MANDIR) $(ETC_DIR)/uwufetch
cp $(NAME) $(DESTDIR)/$(PREFIX)/$(NAME)
cp -r res/* $(DESTDIR)/$(LIBDIR)/uwufetch
cp default.config $(ETC_DIR)/uwufetch/config
cp ./$(NAME).1.gz $(DESTDIR)/$(MANDIR)/
uninstall:
rm -f $(DESTDIR)/$(PREFIX)/$(NAME)
rm -rf $(DESTDIR)/$(LIBDIR)/uwufetch
rm -rf $(ETC_DIR)/uwufetch
rm -f $(DESTDIR)/$(MANDIR)/$(NAME).1.gz
clean:
rm $(NAME)
man:
gzip --keep $(NAME).1
man_debug:
@clear
man -P cat ./uwufetch.1