Newer
Older
##################################################
# 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
Leon Ryuwoon Jung
committed
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 = -m32
#---------------------------------------------------------------------
# Core components (all of these are likely going to be needed)
#---------------------------------------------------------------------
Leon Ryuwoon Jung
committed
INCLUDES += -I$(DIR_DXL)/include/dynamixel_sdk
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
LIBRARIES += -ldxl_x86_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
#---------------------------------------------------------------------