Newer
Older
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
##################################################
# PROJECT: DXL Protocol 1.0 Ping Example Makefile
# AUTHOR : ROBOTIS Ltd.
##################################################
#---------------------------------------------------------------------
# Makefile template for projects using DXL SDK
#
# Please make sure to follow these instructions when setting up your
# own copy of this file:
#
# 1- Enter the name of the target (the TARGET variable)
# 2- Add additional source files to the SOURCES variable
# 3- Add additional static library objects to the OBJECTS variable
# if necessary
# 4- Ensure that compiler flags, INCLUDES, and LIBRARIES are
# appropriate to your needs
#
#
# This makefile will link against several libraries, not all of which
# are necessarily needed for your project. Please feel free to
# remove libaries you do not need.
#---------------------------------------------------------------------
# *** ENTER THE TARGET NAME HERE ***
TARGET = ping
# important directories used by assorted rules and other variables
DIR_DXL = ../../..
DIR_OBJS = .objects
# compiler options
CC = gcc
CX = g++
CCFLAGS = -O2 -O3 -DLINUX -D_GNU_SOURCE -Wall $(INCLUDES) $(FORMAT) -g
CXFLAGS = -O2 -O3 -DLINUX -D_GNU_SOURCE -Wall $(INCLUDES) $(FORMAT) -g
LNKCC = $(CX)
LNKFLAGS = $(CXFLAGS) #-Wl,-rpath,$(DIR_THOR)/lib
FORMAT = -m64
#---------------------------------------------------------------------
# Core components (all of these are likely going to be needed)
#---------------------------------------------------------------------
INCLUDES += -I$(DIR_DXL)/include
LIBRARIES += -ldxl_x64_c
LIBRARIES += -lrt
#---------------------------------------------------------------------
# Files
#---------------------------------------------------------------------
SOURCES = ping.c \
# *** OTHER SOURCES GO HERE ***
OBJECTS = $(addsuffix .o,$(addprefix $(DIR_OBJS)/,$(basename $(notdir $(SOURCES)))))
#OBJETCS += *** ADDITIONAL STATIC LIBRARIES GO HERE ***
#---------------------------------------------------------------------
# Compiling Rules
#---------------------------------------------------------------------
$(TARGET): make_directory $(OBJECTS)
$(LNKCC) $(LNKFLAGS) $(OBJECTS) -o $(TARGET) $(LIBRARIES)
all: $(TARGET)
clean:
rm -rf $(TARGET) $(DIR_OBJS) core *~ *.a *.so *.lo
make_directory:
mkdir -p $(DIR_OBJS)/
$(DIR_OBJS)/%.o: ../%.c
$(CC) $(CCFLAGS) -c $? -o $@
$(DIR_OBJS)/%.o: ../%.cpp
$(CX) $(CXFLAGS) -c $? -o $@
#---------------------------------------------------------------------
# End of Makefile
#---------------------------------------------------------------------