-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
48 lines (42 loc) · 1.33 KB
/
Makefile
File metadata and controls
48 lines (42 loc) · 1.33 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
43
44
45
46
47
48
# Compiler
CC = gcc
# Use pkg-config to get cflags and libs for libvlc
CFLAGS = -O3
LDFLAGS = -lsndfile -lm
# Source and output
SRC = src/main.c
OUT = codec
# Default rule
all: $(OUT)
# Linking
$(OUT): $(SRC)
$(CC) $(CFLAGS) -o $(OUT) $(SRC) $(LDFLAGS)
@echo "Done!"
# Clean rule
clean:
rm -f $(OUT)
install: $(OUT)
mkdir -p ~/.local/bin
cp $(OUT) ~/.local/bin/libblos
@echo -e "\e[31m[WARN]\e[0m : Please make sure that ~/.local/bin/ is in your PATH"
@echo "Do you want to add ~/.local/bin/ to your PATH? (y/n)"; \
read -p ":" choice; \
if [ "$$choice" = "y" ] || [ "$$choice" = "Y" ]; then \
echo "You have chosen 'yes'."; \
echo "Adding ~/.local/bin to PATH permanently..."; \
if [ -f "$$HOME/.bashrc" ]; then \
echo 'export PATH="$$HOME/.local/bin:$$PATH"' >> ~/.bashrc; \
fi; \
if [ -f "$$HOME/.zshrc" ]; then \
echo 'export PATH="$$HOME/.local/bin:$$PATH"' >> ~/.zshrc; \
fi; \
if [ -d "$$HOME/.config/fish" ]; then \
echo 'set -U fish_user_paths $$HOME/.local/bin $$fish_user_paths' >> ~/.config/fish/config.fish; \
fi; \
if [ -f "$$HOME/.profile" ]; then \
echo 'export PATH="$$HOME/.local/bin:$$PATH"' >> ~/.profile; \
fi; \
echo "Done! Please restart your terminal or run 'source ~/.bashrc', 'source ~/.zshrc', or 'source ~/.profile' to apply changes."; \
else \
echo "You have chosen 'no'."; \
fi