-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (51 loc) · 1.32 KB
/
Makefile
File metadata and controls
63 lines (51 loc) · 1.32 KB
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
60
61
62
63
.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
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)
ifeq ($(RELEASE),1)
LDFLAGS += -undefined dynamic_lookup
else
SQLITE_PREFIX ?= $(shell brew --prefix sqlite)
CFLAGS += -I$(SQLITE_PREFIX)/include
LDFLAGS += -L$(SQLITE_PREFIX)/lib -lsqlite3
endif
else
SO_EXT = so
USE_OPENSSL = implicit
LDFLAGS += -luuid -lcrypto
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
LDFLAGS += --coverage
endif
all: $(LIB)
clean:
$(RM) -r $(DIST_DIR)
$(RM) *.gcov
print-%:
@echo '$*=$($*)'
test: $(LIB)
uv run --group test pytest --verbose --extension=$(LIB)
$(LIB): $(DIST_DIR)/uuid.o
$(CC) $< $(LDFLAGS) -o $@
$(DIST_DIR)/uuid.o: $(SOURCES)
mkdir -p $(DIST_DIR)
$(CC) -c $(CFLAGS) $< -o $@