Debian Codegraph @

GNUmakefile

raw symbols ◀ ▶ SCIP
2 Debian patches touch this file
1 LIBNAME = scalene
2 PYTHON = python3
3 PYTHON_SOURCES = scalene/[a-z]*.py
4 JS_SOURCES = scalene/scalene-gui/*.js
5 C_SOURCES = src/source/*.cpp src/include/*.h*
6
7 .PHONY: black clang-format prettier format upload vendor-deps
8
9 # CXXFLAGS = -std=c++14 -g -O0 # FIXME
•10 SCALENECXXFLAGS = -std=c++14 -Wall -g -O3 -DNDEBUG -D_REENTRANT=1 -DHL_USE_XXREALLOC=1 -pipe -fno-builtin-malloc -fvisibility=hidden -Wno-unused-result
11 # CXX = g++
12
13 INCLUDES = -Isrc -Isrc/include
14 INCLUDES := $(INCLUDES) -Ivendor/Heap-Layers -Ivendor/Heap-Layers/wrappers -Ivendor/Heap-Layers/utility
15 INCLUDES := $(INCLUDES) -Ivendor/printf
16 # python3-config may not be available in venv and such
17 INCLUDES := $(INCLUDES) -I$(shell python3 -c "import sysconfig; print(sysconfig.get_path('include'))")
18
19 ifeq ($(shell uname -s),Darwin)
20 LIBFILE := lib$(LIBNAME).dylib
21 WRAPPER := vendor/Heap-Layers/wrappers/macwrapper.cpp
22 ifneq (,$(filter $(shell uname -p),arm arm64)) # this means "if arm or arm64"
23 ARCH := -arch arm64 -arch arm64e
24 else
25 ARCH := -arch x86_64
26 endif
•27 SCALENECXXFLAGS := -std=c++14 -Wall -g -O3 -DNDEBUG -D_REENTRANT=1 -DHL_USE_XXREALLOC=1 -pipe -fno-builtin-malloc -fvisibility=hidden -flto -ftls-model=initial-exec -ftemplate-depth=1024 $(ARCH) -compatibility_version 1 -current_version 1 -dynamiclib
28 SED_INPLACE = -i ''
29
30 else # non-Darwin
31 LIBFILE := lib$(LIBNAME).so
32 WRAPPER := vendor/Heap-Layers/wrappers/gnuwrapper.cpp
33 INCLUDES := $(INCLUDES) -I/usr/include/nptl
•34 SCALENECXXFLAGS := $(SCALENECXXFLAGS) -fPIC -shared -Bsymbolic
35 RPATH_FLAGS :=
36 SED_INPLACE = -i
37
38 endif
39
40 SRC := src/source/lib$(LIBNAME).cpp $(WRAPPER) vendor/printf/printf.cpp
41
42 OUTDIR=scalene
43
44 all: $(OUTDIR)/$(LIBFILE)
45
•46 $(OUTDIR)/$(LIBFILE): $(SRC) $(C_SOURCES) GNUmakefile
•47 $(CXX) $(SCALENECXXFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(INCLUDES) $(SRC) -o $(OUTDIR)/$(LIBFILE) -ldl -lpthread
48
49 clean:
50 rm -f $(OUTDIR)/$(LIBFILE) scalene/*.so scalene/*.dylib
51 rm -rf $(OUTDIR)/$(LIBFILE).dSYM
52 rm -rf scalene.egg-info
53 rm -rf build dist *egg-info
54
55 $(WRAPPER) : vendor/Heap-Layers
56
57 vendor/Heap-Layers:
58 cd vendor && git clone https://github.com/emeryberger/Heap-Layers
59
60 TMP := $(shell mktemp -d || echo /tmp)
61
62 vendor/printf/printf.cpp:
63 cd vendor && git clone https://github.com/mpaland/printf
64 cd vendor/printf && ln -s printf.c printf.cpp
65 sed -e 's/^#define printf printf_/\/\/&/' vendor/printf/printf.h > $(TMP)/printf.h.$$ && mv $(TMP)/printf.h.$$ vendor/printf/printf.h
66 sed -e 's/^#define vsnprintf vsnprintf_/\/\/&/' vendor/printf/printf.h > $(TMP)/printf.h.$$ && mv $(TMP)/printf.h.$$ vendor/printf/printf.h
67
68 vendor-deps: vendor/Heap-Layers vendor/printf/printf.cpp
69
70 mypy:
71 -mypy --no-warn-unused-ignores $(PYTHON_SOURCES)
72
73 format: black clang-format prettier
74
75 clang-format:
76 -clang-format -i $(C_SOURCES) --style=google
77
78 black:
79 -black -l 79 $(PYTHON_SOURCES)
80
81 prettier:
82 -npx prettier -w $(JS_SOURCES)
83
•84 bdist:
85 $(PYTHON) -m build --wheel
86 ifeq ($(shell uname -s),Linux)
87 auditwheel repair dist/*.whl
88 rm -f dist/*.whl
89 mv wheelhouse/*.whl dist/
90 endif
91
•92 sdist:
93 $(PYTHON) -m build --sdist
94
95 upload: sdist bdist # to pypi
96 $(PYTHON) -m twine upload dist/*