-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
50 lines (38 loc) · 1.1 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
######################################
# target
######################################
CPP_INCLUDES = \
-Isrc
ifeq ($(MOTOR), AK60)
CPP_DEFS = -DAK60
else ifeq ($(MOTOR), AK70)
CPP_DEFS = -DAK70
else
CPP_DEFS = -DAK70
endif
CPPFLAGS += $(CPP_DEFS) $(CPP_INCLUDES) -Wall
#######################################
# paths
#######################################
# Build path
BUILD_DIR = build
all: $(BUILD_DIR)/ak_pose $(BUILD_DIR)/ak_vel $(BUILD_DIR)/ak_torq $(BUILD_DIR)/ak_kp $(BUILD_DIR)/ak_kd
$(BUILD_DIR)/ak_pose: src/ak_pose.cpp $(BUILD_DIR)/ak.o
g++ $^ $(CPPFLAGS) -o $@
$(BUILD_DIR)/ak_vel: src/ak_vel.cpp $(BUILD_DIR)/ak.o
g++ $^ $(CPPFLAGS) -o $@
$(BUILD_DIR)/ak_torq: src/ak_torq.cpp $(BUILD_DIR)/ak.o
g++ $^ $(CPPFLAGS) -o $@
$(BUILD_DIR)/ak_kp: src/ak_kp.cpp $(BUILD_DIR)/ak.o
g++ $^ $(CPPFLAGS) -o $@
$(BUILD_DIR)/ak_kd: src/ak_kd.cpp $(BUILD_DIR)/ak.o
g++ $^ $(CPPFLAGS) -o $@
$(BUILD_DIR)/ak.o: src/ak.cpp | $(BUILD_DIR)
g++ -c -o $@ $^ $(CPPFLAGS)
$(BUILD_DIR):
mkdir $@
#######################################
# clean up
#######################################
clean:
-rm -fR $(BUILD_DIR)