forked from idaholab/moose
/
Makefile
37 lines (26 loc) · 837 Bytes
/
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
CXX ?= g++
UNAME := $(shell uname)
pyconfig := python3-config
ifeq (, $(shell which $(pyconfig) 2>/dev/null))
pyconfig := python-config
endif
ifeq ($(UNAME), Darwin)
DYNAMIC_LOOKUP := -undefined dynamic_lookup
else
DYNAMIC_LOOKUP :=
endif
$(info Building hit for python with $(pyconfig))
PYTHONPREFIX ?= `$(pyconfig) --prefix`
PYTHONCFLAGS ?= `$(pyconfig) --cflags`
HITCPP := hit.cpp
hit: main.cc parse.cc lex.cc braceexpr.cc braceexpr.h lex.h parse.h
$(CXX) -std=c++11 -g $(CXXFLAGS) $< parse.cc lex.cc braceexpr.cc -o $@
bindings: hit.so
hit.so: parse.cc lex.cc braceexpr.cc
$(CXX) -std=c++11 -w -fPIC -lstdc++ -shared -L$(PYTHONPREFIX)/lib $(PYTHONCFLAGS) $(DYNAMIC_LOOKUP) $^ $(HITCPP) -o $@
$(HITCPP): hit.pyx chit.pxd
cython -3 -o $@ --cplus $<
.PRECIOUS: $(HITCPP)
.PHONY: clean bindings
clean:
rm -f hit hit.so