-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (42 loc) · 1.21 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
CC=clang
override CFLAGS := -Wall -pedantic -std=c23 $(CFLAGS)
override LDFLAGS := $(LDFLAGS)
SRCDIR = src
OUTDIR = build
INCDIR = include
PREFIX = /usr
DOCDIR = docs
DOCS = $(DOCDIR)/html/index.html
CSSURL = https://raw.githubusercontent.com/jothepro/doxygen-awesome-css/main/doxygen-awesome.css
CSSFILE = doxygen-awesome.css
SRCS = $(shell find $(SRCDIR) -type f -name *.c)
OBJS = $(patsubst $(SRCDIR)/%,$(OUTDIR)/%,$(SRCS:.c=.o))
SHOBJS = $(patsubst $(SRCDIR)/%,$(OUTDIR)/lib%,$(SRCS:.c=.so))
INC = -I$(INCDIR)
EXE=list_test
all: libs
libs: $(OBJS) $(SHOBJS)
test:
make -C tests
exe: $(EXE)
$(EXE): $(OBJS)
$(CC) $(LDFLAGS) $^ -o $@
$(OUTDIR)/%.o: $(SRCDIR)/%.c
mkdir -p $(OUTDIR)
$(CC) -c $(CFLAGS) $(INC) $< -o $@
$(OUTDIR)/lib%.so: $(OUTDIR)/%.o
$(CC) $(CFLAGS) -shared -o $@ $<
install: $(SHOBJS)
install -d $(DESTDIR)$(PREFIX)/lib/
install -m 644 $(SHOBJS) $(DESTDIR)$(PREFIX)/lib/
install -d $(DESTDIR)$(PREFIX)/include/xorlist
install -m 644 $(INCDIR)/* $(DESTDIR)$(PREFIX)/include/xorlist/
docs: $(DOCS)
$(CSSFILE):
curl -sL -o $(CSSFILE) $(CSSURL)
$(DOCS): $(OBJS) $(SHOBJS) $(CSSFILE)
@doxygen
clean:
rm -rf $(OUTDIR) list_test docs/
make -C tests clean
.PHONY: all default clean tests install