-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
73 lines (53 loc) · 1.8 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#Copyright (c) 2020, Zolisa Bleki
#SPDX-License-Identifier: BSD-3-Clause */
.PHONY: clean pkg test wheels cythonize lib install
NAME := htnorm
CC := gcc
CFLAGS := -std=c11 -fwrapv -O3 -fPIC -funroll-loops -pedantic -g -pthread \
-DNDEBUG -ffast-math -Wall -Wextra -Werror -Wsign-compare -Wunused \
-Wno-unused-result -Wpointer-arith -Wcast-qual -Wmissing-prototypes \
-Wno-missing-braces -Wstrict-aliasing -fstrict-aliasing -Winline
INCLUDE_DIR := -I./include
LDIR := ./lib
LIBS_DIR ?= /usr/lib
override LIBS_DIR := -L$(LIBS_DIR)
LIBS := -lm -lblas -llapack
SRCFILES = src/htnorm_distributions.c src/htnorm.c src/htnorm_rng.c
OBJ = src/htnorm_distributions.o src/htnorm.o src/htnorm_rng.o
%.o: %.c
$(CC) $(CFLAGS) $(INCLUDE_DIR) -o $@ -c $^
lib: $(LDIR)/lib$(NAME).so
ldconfig -v -n $(LDIR)
# dont forget to append LDIR to LD_LIBRARY_PATH
$(LDIR)/lib$(NAME).so: $(OBJ)
mkdir -p $(LDIR)
$(CC) -pthread -shared -Wl,-soname=lib$(NAME) -o $@ $(LIBS_DIR) $(LIBS) $^
rm $(OBJ)
clean:
rm -Rf $(LDIR)/* build/* dist/* pyhtnorm/*.c pyhtnorm/*.so \
pyhtnorm/*.html pyhtnorm.egg-info src/*.o **/*__pycache__ \
**/*_snaps ..Rcheck src/*.so src/*.rds __pycache__
# python dev targets
# ==================
DOCKER_IMAGES=quay.io/pypa/manylinux1_x86_64 \
quay.io/pypa/manylinux2010_x86_64 \
quay.io/pypa/manylinux2014_x86_64
define make_wheels
docker pull $(1)
docker container run -t --rm -e PLAT=$(strip $(subst quay.io/pypa/,,$(1))) \
-v $(shell pwd):/io $(1) /io/build-wheels.sh
endef
test:
pytest -v
cythonize:
cythonize pyhtnorm/*.pyx
install: clean cythonize
poetry install
sdist: cythonize
poetry build -f sdist
wheels: clean cythonize
$(foreach img, $(DOCKER_IMAGES), $(call make_wheels, $(img));)
# R dev targets
# ============
check:
R CMD check --no-manual --no-vignettes --timings .