-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·75 lines (53 loc) · 1.82 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
PREFIX := /usr/local
CC := gcc
CFLAGS := -Wextra -Wall -Wshadow -std=gnu11 -DSHAREDIR=\"$(PREFIX)/share\"
DEBUG_FLAGS := -ggdb -g3 -DDEBUG
REL_FLAGS := -O2
REL_PREFIX := release
DEBUG_PREFIX := debug
ifeq ($(RELEASE), 1)
BUILD_DIR := build/$(REL_PREFIX)
CFLAGS += $(REL_FLAGS)
else
BUILD_DIR := build/$(DEBUG_PREFIX)
CFLAGS += $(DEBUG_FLAGS)
endif
BIN_PATH := $(BUILD_DIR)/bin
OBJ_PATH := $(BUILD_DIR)/bin
DEP_PATH := $(BUILD_DIR)/dep
SRC_PATH := src
INCLUDE_PATH := ./src/include
TARGET_NAME := bor
TARGET := $(BIN_PATH)/$(TARGET_NAME)
SRC := main.c util.c
OBJ := $(addprefix $(OBJ_PATH)/, $(SRC:.c=.o))
DEPS := $(addprefix $(DEP_PATH)/, $(notdir $(OBJ:.o=.d)))
all: prebuild $(TARGET)
prebuild:
@mkdir -p $(BIN_PATH) $(SRC_PATH) $(DEP_PATH) $(OBJ_PATH) $(INCLUDE_PATH) $(BUILD_PREFIX)
rebuild: clean all
clean:
rm -fr build/release/*/*
rm -fr build/debug/*/*
$(TARGET): $(OBJ)
$(CC) $(CFLAGS) -o $@ $^
$(OBJ_PATH)/%.o: $(SRC_PATH)/%.c
$(CC) $(CFLAGS) -I$(INCLUDE_PATH) -MD -MP -MF $(DEP_PATH)/$(notdir $(basename $@).d) -o $@ -c $<
install:
install -dm 755 $(PREFIX)/share/bor/scripts
install -dm 755 $(PREFIX)/lib/systemd/user
install -Dm 755 $(BUILD_DIR)/bin/bor $(PREFIX)/bin/bor
install -Dm 644 scripts/browsers/*.sh $(PREFIX)/share/bor/scripts
install -Dm 644 systemd/* $(PREFIX)/lib/systemd/user
test: all
test/start-test $(BUILD_DIR)/bin/bor
sync: all
$(BUILD_DIR)/bin/bor -v -c test/config/bor -d test/share/bor -t test/tmpfs/bor --sync
unsync: all
$(BUILD_DIR)/bin/bor -v -c test/config/bor -d test/share/bor -t test/tmpfs/bor --unsync
resync: all
$(BUILD_DIR)/bin/bor -v -c test/config/bor -d test/share/bor -t test/tmpfs/bor --resync
status: all
$(BUILD_DIR)/bin/bor -v -c test/config/bor -d test/share/bor -t test/tmpfs/bor --status
-include $(DEPS)
.PHONY: all clean prebuild install rebuild test sync unsync resync