-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
52 lines (41 loc) · 1 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
.PHONY: all clean test
NAME = uuid
VERSION := $(shell git describe --tags --always --dirty --match v* | sed 's/^v//')
PLATFORM := $(shell uname -s)
CFLAGS = -g -fPIC -Wall -Wextra -Wno-unused-parameter -O2 -lcrypto
LDFLAGS = -shared
DIST_DIR = dist
SOURCES := $(wildcard src/*.c)
ifeq ($(PLATFORM),Darwin)
SO_EXT = dylib
USE_COMMONCRYPTO = implicit
LIB := $(DIST_DIR)/$(NAME).$(VERSION).$(SO_EXT)
else
SO_EXT = so
USE_OPENSSL = implicit
LDFLAGS += -luuid
LIB := $(DIST_DIR)/$(NAME).$(SO_EXT).$(VERSION)
endif
ifneq ($(USE_OPENSSL),)
CFLAGS += -DUSE_OPENSSL
endif
ifneq ($(USE_COMMONCRYPTO),)
CFLAGS += -DUSE_COMMONCRYPTO
endif
ifneq ($(USE_DEFAULT_ENTRY_POINT),)
CFLAGS += -DUSE_DEFAULT_ENTRY_POINT
endif
ifneq ($(DEBUG),)
CFLAGS += --coverage
endif
all: $(LIB)
clean:
$(RM) -r $(DIST_DIR)
$(RM) *.gcda *.gcno *.gcov
print-%:
@echo '$*=$($*)'
test: $(LIB)
tox -- --extension=$(LIB)
$(LIB): $(SOURCES)
mkdir -p $(DIST_DIR)
$(CC) $< $(CFLAGS) $(LDFLAGS) -o $@