-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
81 lines (59 loc) · 1.48 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
71
72
73
74
75
76
77
78
79
80
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
DEBUG = 1
CC = gcc
ifeq ($(DEBUG), 1)
CFLAGS = -O0 -Wall -fPIC -c
else
CFLAGS = -O3 -Wall -fPIC -c -DNDEBUG
endif
AR = ar
RANLIB = ranlib
INCLUDES = \
-Iinclude
LIBS = \
-lm
SRCS = \
src/chain2d_create.c \
src/chain3d_create.c \
src/fkine2d.c \
src/fkine3d.c \
src/link2d_join.c \
src/link3d_join.c \
src/math/mat3_multiply.c \
src/math/mat3_transform.c \
src/math/mat4_get_rotation.c \
src/math/mat4_multiply.c \
src/math/mat4_transform.c \
src/math/mat_print.c \
src/math/vec2_normalize.c \
src/math/vec3_cross.c \
src/math/vec3_dot.c \
src/math/vec3_normalize.c
OBJS = $(patsubst src/%.c, build/%.o, $(SRCS))
all: robotkinematics
robotkinematics: mkdir $(OBJS)
ifeq ($(DEBUG), 1)
@ $(CC) -shared -Wl,-soname,[email protected] -o lib/devel/[email protected] $(OBJS) $(LIBS)
@ ln -sf $(ROOT_DIR)/lib/devel/[email protected] $(ROOT_DIR)/lib/devel/[email protected]
@ ln -sf $(ROOT_DIR)/lib/devel/[email protected] $(ROOT_DIR)/lib/devel/[email protected]
@ $(AR) -rc lib/devel/static/[email protected] $(OBJS)
@ $(RANLIB) lib/devel/static/[email protected]
endif
@ echo Compiled robot kinematics
$(OBJS): build/%.o: src/%.c
@ $(CC) $(CFLAGS) $(INCLUDES) -o $@ $< $(LIBS)
docs: mkdir
@ cd include; doxygen doxyfile
-@ rm -r docs/api/*
@ mv -f docs/html/* docs/api
@ rm -r docs/html
mkdir:
@ mkdir -p build
@ mkdir -p build/math
@ mkdir -p lib
@ mkdir -p lib/devel
@ mkdir -p lib/devel/static
@ mkdir -p lib/static
clean:
-@ rm -r build
-@ rm -r lib