-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·42 lines (33 loc) · 1.16 KB
/
Copy pathMakefile
File metadata and controls
executable file
·42 lines (33 loc) · 1.16 KB
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
CC := cc
# -O0 (for developer) / -O3 (for final binary)
CFLAGS := -Wall -Wextra -g -O0 -Iinclude $(shell pkg-config --cflags dbus-1)
LIBS := -lm -lcurl -lpthread -lavformat -lavcodec -lswresample -lavutil $(shell pkg-config --libs dbus-1)
OBJECT_BUILD_DIR := build
INSTALL_PATH := /usr/local/bin
TOMU_NAME := tomu
TOMU_DIR := src/tomu
TOMU_BUILD_DIR := $(OBJECT_BUILD_DIR)/tomu
TOMU_SRC := $(wildcard $(TOMU_DIR)/*.c)
TOMU_OBJECTS := $(patsubst $(TOMU_DIR)/%.c, $(TOMU_BUILD_DIR)/%.o, $(TOMU_SRC))
# build
all: $(TOMU_NAME)
$(TOMU_NAME): $(TOMU_OBJECTS)
$(CC) $^ -o $@ $(CFLAGS) $(LIBS)
# compile rules (per folder)
$(TOMU_BUILD_DIR)/%.o: $(TOMU_DIR)/%.c
@mkdir -p $(dir $@)
$(CC) -c $< -o $@ $(CFLAGS)
# install
install: all
@echo "\033[0;33mrequesting root permission, for install tomu\033[0m"
sudo install -m755 $(TOMU_NAME) $(INSTALL_PATH)
@echo "\033[0;32mDone\033[0m"
clean:
rm -rf $(OBJECT_BUILD_DIR) $(TOMU_NAME)
update:
@echo "\033[0;32mFetching latest tomu source...\033[0m"
git pull
uninstall:
sudo rm -f /usr/local/bin/tomu
@echo "\033[0;32mUninstalled successfully\033[0m"
.PHONY: all install clean uninstall