-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
34 lines (26 loc) · 855 Bytes
/
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
PREFIX = /usr
CC = gcc
DEBUG = 0
SRCS = $(wildcard src/*.c)
OBJS = $(patsubst src/%.c,dist/%.o,$(SRCS))
HDRS = $(wildcard include/*.h)
CFLAGS = -O3 -march=native -fstack-protector-strong -fcf-protection=full -fstack-clash-protection
LIBS = -lpthread -levent -lcjson
dist/libctorm.so: $(OBJS)
mkdir -p dist
$(CC) -shared -o $@ $^ $(LIBS) $(CFLAGS)
dist/%.o: src/%.c
mkdir -p dist
$(CC) -c -Wall -fPIC -o $@ $^ $(LIBS) $(CFLAGS) -DDEBUG=${DEBUG}
install:
install -m755 dist/libctorm.so $(DESTDIR)$(PREFIX)/lib/libctorm.so
mkdir -pv $(DESTDIR)/usr/include/ctorm
cp $(HDRS) $(DESTDIR)/usr/include/ctorm
uninstall:
rm $(DESTDIR)$(PREFIX)/lib/libctorm.so
rm -r $(DESTDIR)/usr/include/ctorm
format:
clang-format -i -style=file src/*.c include/*.h example/*/*.c
example:
$(MAKE) -C $@
.PHONY: test install uninstall format example