-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
36 lines (26 loc) · 805 Bytes
/
Makefile
File metadata and controls
36 lines (26 loc) · 805 Bytes
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
SRC_DIR = src
OBJ_DIR = obj
BIN_DIR = bin
ifeq ($(PREFIX),)
PREFIX := $(HOME)/.local
endif
SRC = $(wildcard $(SRC_DIR)/*.c)
OBJ = $(SRC:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.o)
OUT = $(BIN_DIR)/bot
CC = gcc
CFLAGS = -D_GNU_SOURCE -D_DEFAULT_SOURCE -Iinclude -Wall -Wextra -g $(shell pkg-config --cflags openssl sqlite3 libconfig) $(shell pcre2-config --cflags)
LDFLAGS =
LIBS = $(shell pkg-config --libs openssl sqlite3 libconfig) $(shell pcre2-config --libs8) -lpthread
all: $(OUT)
$(OUT): $(OBJ) | $(BIN_DIR)
$(CC) $(LDFLAGS) $^ -o $@ $(LIBS)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c | $(OBJ_DIR)
$(CC) $(CFLAGS) -c $< -o $@
$(BIN_DIR) $(OBJ_DIR):
mkdir -p $@
.PHONY: clean install
clean:
$(RM) -rv $(OBJ_DIR) $(OUT)
install: $(OUT)
install -d $(PREFIX)/bin/
install -m 0755 $(OUT) $(PREFIX)/bin/