-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
58 lines (46 loc) · 1.29 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
PROG=example
TEST=debug
SHARED=libInputDataset.so
OBJECTS=Dataset.o InputDataset.o
INCLUDE= -Iinclude/ -I/usr/include/python3.6m/
CATCH_INCLUDE= $(INCLUDE) -Iinclude/test
LIB= -lpython3.6m -lboost_python3-py36 -lboost_numpy3-py36
CXXFLAGS= $(INCLUDE) -std=c++11
CXX=g++
.PHONY: $(PROG).cc
all: $(OBJECTS) $(SHARED)
example: $(PROG).bin
Dataset.o:
$(CXX) -fPIC -c -o obj/$@ src/Dataset.cc $(CXXFLAGS)
InputDataset.o:
$(CXX) -fPIC -c -o obj/$@ src/InputDataset.cc $(CXXFLAGS)
$(SHARED):
mkdir -p build/lib
$(CXX) -fPIC obj/Dataset.o obj/InputDataset.o $(LIB) $(CXXFLAGS) -shared -o build/lib/$@
install:$(SHARED)
cp build/lib/$< /usr/lib/
ldconfig -v
@echo "\n\tINSTALLATION FINISHED"
$(PROG).bin: $(PROG).cc
$(CXX) src/$< $(CXXFLAGS) $(LIB) -lInputDataset -o $@
@if [ "$(EXAMPLE)" = "0" ];\
then\
$(MAKE) -C src/module_1;\
elif [ "$(EXAMPLE)" = "1" ];\
then\
$(MAKE) -C src/module_2;\
fi
clean:
rm -rf obj/*.o
rm -rf *.bin
rm -rf *.so
rm -rf build
$(MAKE) -C src/module_1 clean
$(MAKE) -C src/module_2 clean
$(TEST):$(PROG).cc
$(CXX) -g -c -o obj/Dataset.o src/Dataset.cc $(CXXFLAGS)
$(CXX) -g -c -o obj/InputDataset.o src/InputDataset.cc $(CXXFLAGS)
$(CXX) -g -o [email protected] src/$< obj/Dataset.o obj/InputDataset.o $(LIB) $(CXXFLAGS)
gdb ./$(TEST).bin
clean_debug:
rm -rf $(TEST).bin