Makefile 1.29 KB
Newer Older
jkvis's avatar
jkvis committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
## *******************************************************************
## Extractor (library)
## *******************************************************************
## FILE INFORMATION:
##   File:     Makefile
##   Author:   Jonathan K. Vis
## *******************************************************************
## DESCRIPTION:
##  Build the Extractor library for python.
## *******************************************************************

SOURCES=extractor.cc
TARGET=_extractor.so
DEBUG=debug.cc

CXX=g++
J.K. Vis's avatar
J.K. Vis committed
17
CFLAGS=-c -fpic -Wall -Wextra -O3 #-D__debug__
18
LDFLAGS=-Wall -O3 -shared
jkvis's avatar
jkvis committed
19
20
21
22
23
24
25
26

SWIG=swig
SWIGFLAGS=-c++ -python
INCLUDES=-I/usr/include/python2.7

WRAPPER=$(SOURCES:.cc=.py) $(SOURCES:.cc=)_wrap.cxx
OBJECTS=$(SOURCES:.cc=.o) $(WRAPPER:.cxx=.o)

J.K. Vis's avatar
J.K. Vis committed
27
.PHONY: all clean debug rebuild
jkvis's avatar
jkvis committed
28
29
30
31
32
33
34
35
36
37

all: $(TARGET)

$(TARGET): $(OBJECTS) $(WRAPPER)
	$(CXX) $(LDFLAGS) $(filter-out $(SOURCES:.cc=.py),$(OBJECTS)) -o $@
	chmod -x $(TARGET)

debug: $(SOURCES:.cc=.o) $(DEBUG)
	$(CXX) $(LDFLAGS:-shared=) $(SOURCES:.cc=.o) $(DEBUG) -o $@

Laros's avatar
Laros committed
38
%_wrap.cxx: %.i
jkvis's avatar
jkvis committed
39
40
	$(SWIG) $(SWIGFLAGS) $(SOURCES:.cc=.i)

Laros's avatar
Laros committed
41
42
43
%.py: %_wrap.cxx
	@

jkvis's avatar
jkvis committed
44
45
46
47
48
49
50
%.o: %.cc
	$(CXX) $(CFLAGS) -o $@ $<

%.o: %.cxx
	$(CXX) $(CFLAGS:-Wextra=) $(INCLUDES) -o $@ $<

clean:
J.K. Vis's avatar
J.K. Vis committed
51
	rm -f $(DEBUG:.cc=.o) $(filter-out $(SOURCES:.cc=.py),$(OBJECTS)) $(WRAPPER) $(TARGET) debug
jkvis's avatar
jkvis committed
52
53
54

rebuild: clean all