-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
70 lines (56 loc) · 1.51 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
RDFLAGS = -g -Werror
PYFLAGS = -D USE_PYTHON_INTERFACE
export RDFLAGS
export PYFLAGS
CC = g++
CFLAGS = -fPIC
CFLAGS += -I"$(COAST_DIR)/include"
CFLAGS += $(shell python3-config --cflags)
CFLAGS += $(RDFLAGS)
CFLAGS += $(PYFLAGS)
CFLAGS += -x c++ -std=c++17 -Wall -Wextra \
-D EXPERIMENTAL_FILESYSTEM
LDFLAGS = --shared -lstdc++fs
LDFLAGS += $(shell python3-config --ldflags)
LDFLAGS += $(shell python3-config --libs)
DEPFILE = .dep
SOURCES = coast_user_lib.cpp
HEADERS := ${wildcard *.h}
OBJECTS := ${SOURCES:.cpp=.o}
SUBDIRS = python
SUBOBJS := $(addsuffix /static.a, $(SUBDIRS))
SUBCLEAN := $(addsuffix .clean, $(SUBDIRS))
BINARY = libCOAST.so
TARFILE = archive.tar.gz
RELEASEF = README.md override_example.py python/packages
RELEASEFP := $(addprefix "../$${PWD\#\#*/}/", $(RELEASEF) $(BINARY))
.PHONY: all
all: $(BINARY)
.PHONY: release
release: RDFLAGS = -O3
release: $(BINARY) $(TARFILE)
$(BINARY): $(OBJECTS) $(SUBDIRS)
$(CC) -o $@ $(OBJECTS) $(SUBOBJS) $(LDFLAGS)
%.o: %.cpp
$(CC) $(CFLAGS) -c $<
$(DEPFILE): $(SOURCES) $(HEADERS)
$(CC) -MM $(SOURCES) > $@
-include $(DEPFILE)
.PHONY: $(TARFILE)
$(TARFILE): $(BINARY)
@rm -rf python/packages/interface/__pycache__
@tar cfz $(TARFILE) $(RELEASEFP)
.PHONY: docs
docs:
doxygen
.PHONY: clean $(SUBCLEAN)
clean: $(SUBCLEAN)
rm -vf $(BINARY) $(OBJECTS) $(DEPFILE) $(TARFILE)
@rm -rf python/packages/interface/__pycache__
@rm -rf ./html
@rm -rf ./latex
$(SUBCLEAN): %.clean:
$(MAKE) -C $* clean
.PHONY: $(SUBDIRS)
$(SUBDIRS):
$(MAKE) -C $@ -e