-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
48 lines (37 loc) · 1.39 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
CFLAGS = -O3 -std=c11 -Wall -Werror -Wpedantic -Wextra -g -D _DEFAULT_SOURCE -DNCURSES_STATIC
BIN = terminal-bird
PREFIX = /usr/local
INSTALLPATH = ${DESTDIR}${PREFIX}/games
LIBS = -lncursesw -lsqlite3 -lcjson
DEPS = src/common.h src/configuration.h src/leaderboard_db.h src/menu.h src/pipe_nodes.h src/visuals.h
OBJ = src/main.o src/pipe_nodes.o src/visuals.o src/menu.o src/leaderboard_db.o src/configuration.o
HOME_DIR := $(shell echo ~$(SUDO_USER))
%.o: %.c $(DEPS)
@echo "*** Creating object ***"
$(CC) -c -o $@ $< $(CFLAGS)
${BIN}: $(OBJ)
@echo
@echo "*** Creating directory $(HOME_DIR)/.Terminal-Bird ***"
mkdir -p $(HOME_DIR)/.Terminal-Bird
cp configurations.json $(HOME_DIR)/.Terminal-Bird
@echo "*** Building the executable file ***"
$(CC) -o $@ $(OBJ) $(CFLAGS) $(LIBS)
install: ${BIN}
@echo
@echo "*** Installing binary file to ${INSTALLPATH}/${BIN} ***"
mkdir -p ${INSTALLPATH}
cp ${BIN} ${INSTALLPATH}
chmod 0755 ${INSTALLPATH}/${BIN}
@echo
@echo "*** Installed ${BIN} successfully ***"
uninstall:
@echo "*** uninstalling directory $(HOME_DIR)/.Terminal-Bird ***"
rm -rf $(HOME_DIR)/.Terminal-Bird
@echo "*** uninstalling binary file ${INSTALLPATH}/${BIN} ***"
rm -f ${INSTALLPATH}/${BIN}
@echo "*** uninstalled ${BIN} successfully***"
.PHONY: clean
clean:
@echo "*** Cleaning up $(BIN) and $(OBJ) ***"
rm -f ${BIN} src/*.o
@echo "*** Cleaned ***"