-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
55 lines (42 loc) · 1.33 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
############################################################################
# Copyright (c) 2014 Robotnik Automation, SLL #
# #
############################################################################
EXE = _pcan_module.so
BUILD = ./build/
LIBDIR = ./lib/
SRC = ./src/
PYTHONDIR = ./pcan_python/
LIBS = -lpcan
INC = -I/usr/include/python2.7 -I/usr/include
INSTALLDIR = /usr/lib
SWIG = swig
SWIGFLAGS = -python
CPP = gcc
CCFLAGS = -c -fpic
MAKE = make
LD = ld
LDFLAGS = -share
MKDIR_P = mkdir -p
OBJECTS = \
$(BUILD)pcan_module.o \
$(BUILD)pcan_module_wrap.o
default: $(LIBDIR)$(EXE)
$(BUILD)pcan_module.o : $(SRC)pcan_module.c
${MKDIR_P} $(BUILD)
$(CPP) $(CCFLAGS) $(INC) -o $(BUILD)pcan_module.o $(SRC)pcan_module.c
$(BUILD)pcan_module_wrap.o : $(SRC)pcan_module.i
${MKDIR_P} $(BUILD)
$(SWIG) $(SWIGFLAGS) $(INC) -o $(SRC)pcan_module_wrap.c -outdir $(PYTHONDIR) $(SRC)pcan_module.i
$(CPP) $(CCFLAGS) $(INC) -o $(BUILD)pcan_module_wrap.o $(SRC)pcan_module_wrap.c
$(LIBDIR)$(EXE) : $(OBJECTS)
${MKDIR_P} $(LIBDIR)
ld $(LDFLAGS) $(LIBS) $(OBJECTS) -o $(LIBDIR)$(EXE)
clean:
rm -fv $(BUILD)*.o
rm -fv $(LIBDIR)$(EXE)
rm $(PYTHONDIR)pcan_module.py $(SRC)pcan_module_wrap.c
install:
$(MAKE);
cp $(LIBDIR)$(EXE) $(INSTALLDIR);
python setup.py install