-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
70 lines (54 loc) · 1.66 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
CC := gcc
CFLAGS := -I Lib/ -no-pie
LIBS := $(shell pkg-config --cflags --libs gtk+-3.0)
SRC := AutoLand.c
TARGET := build/AutoLand
OUT := AutoLand
BUILDDIR := build
CACHE := $(BUILDDIR)/cache
OBJ := $(CACHE)/AutoLand.o
# ANSI color codes
RED := \033[0;31m
GREEN := \033[0;32m
YELLOW := \033[0;33m
PURPLE := \033[0;35m
BUIL := \033[0;36m
NC := \033[0m
.PHONY: all clean copybuild clean_all install_env
all: $(TARGET)
$(TARGET): $(OBJ)
@echo "$(YELLOW)Compiling $@$(NC)"
@$(CC) $(CFLAGS) $^ -o $@ $(LIBS)
@echo "$(GREEN)Compiled $@$(NC)"
@echo "$(YELLOW)Copying $(TARGET) to project root...$(NC)"
@cp $(TARGET) ./;
@echo "$(GREEN)Copying done.$(NC)";
@echo "$(GREEN)Now you can using $(NC) $(BUIL)./AutoLand $(NC) $(GREEN)to use it$(NC)"
$(CACHE)/AutoLand.o: $(SRC)
@mkdir -p $(dir $@)
@echo "$(YELLOW)Compiling $@$(NC)"
@$(CC) $(CFLAGS) -c $< -o $@ $(LIBS)
@echo "$(GREEN)Compiled $@$(NC)"
copybuild: $(TARGET)
@echo "$(YELLOW)Copying $(TARGET) to project root...$(NC)"
@cp $(TARGET) ./;
@echo "$(GREEN)Copying done.$(NC)";
@echo "$(GREEN)Now you can using $(NC) $(BUIL)./AutoLand $(NC) $(GREEN)to use it$(NC)"
clean:
@echo "$(YELLOW)Cleaning...$(NC)"
@rm -rf $(BUILDDIR) AutoLand
@echo "$(GREEN)Cleaning done$(NC)";
clean_all:
@echo "$(YELLOW)Cleaning...$(NC)"
@rm -rf $(BUILDDIR) AutoLand $(SCRIPT)
@echo "$(GREEN)Cleaning done$(NC)";
install_env:
@echo "$(PURPLE)Installing dependencies...$(NC)"
@sudo apt-get update
@sudo apt-get upgrade -y
@sudo apt-get install -y libgtk-3-dev devhelp
@echo "$(PURPLE)Installed dependencies.$(NC)"
# Ensure cache directory exists
$(shell mkdir -p $(CACHE))
# Ensure build directory exists
$(shell mkdir -p $(BUILDDIR))