-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (37 loc) · 1.07 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
CC = gcc
PREFIX := /usr/local
LIBDIR := $(PREFIX)/lib
INCLUDEDIR := $(PREFIX)/include/coglink
DOCS_DIR = ../CogLinDocs
SRC_DIR = lib external
OBJ_DIR = obj
CFLAGS := -Wall -Wextra -Wpedantic
LDFLAGS := -std=c99 -D_POSIX_C_SOURCE=200112L -Iinclude -Iexternal
LFLAGS := -lcurl -ldiscord
SRCS = $(foreach dir,$(SRC_DIR),$(wildcard $(dir)/*.c))
OBJS = $(patsubst %.c,$(OBJ_DIR)/%.o,$(notdir $(SRCS)))
CogLink: $(OBJS)
ar qv libcoglink.a $(OBJS)
$(OBJ_DIR)/%.o: lib/%.c | $(OBJ_DIR)
$(CC) -c -fPIC $< -o $@ $(LDFLAGS) $(CFLAGS)
$(OBJ_DIR)/%.o: external/%.c | $(OBJ_DIR)
$(CC) -c -fPIC $< -o $@ $(LDFLAGS) $(CFLAGS)
$(OBJ_DIR):
mkdir -p $@
.PHONY: clean
clean:
rm -rf CogLink $(OBJ_DIR)
debug: CFLAGS += -g
debug: CogLink
install:
mkdir -p $(INCLUDEDIR)
cp include/* $(INCLUDEDIR)
mv libcoglink.a $(LIBDIR)
uninstall:
rm -rf $(INCLUDEDIR)
rm -f $(LIBDIR)/libcoglink.a
gen_docs:
rm -rf $(DOCS_DIR)/search $(DOCS_DIR)/*.png $(DOCS_DIR)/*.html $(DOCS_DIR)/*.svg $(DOCS_DIR)/*.js $(DOCS_DIR)/tabs.css
doxygen Doxyfile
mv $(DOCS_DIR)/html/* $(DOCS_DIR)
rm -rf $(DOCS_DIR)/html