text: ##################################################
  # PROJECT: DXL Protocol 1.0 MultiPort 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      = multi_port
  
  # 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      = -m32
  
  #---------------------------------------------------------------------
  # Core components (all of these are likely going to be needed)
  #---------------------------------------------------------------------
  INCLUDES   += -I$(DIR_DXL)/include/dynamixel_sdk
  LIBRARIES  += -ldxl_x86_c
  LIBRARIES  += -lrt
  
  #---------------------------------------------------------------------
  # Files
  #---------------------------------------------------------------------
  SOURCES = multi_port.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
  #---------------------------------------------------------------------
  