#/* LICENSE:
#  =========================================================================
#    CMPack'04 Source Code Release for OPEN-R SDK 1.1.5-r2 for ERS7
#    Copyright (C) 2004 Multirobot Lab [Project Head: Manuela Veloso]
#    School of Computer Science, Carnegie Mellon University
#    All rights reserved.
#  ======================================================================== */

C++ := g++
CC  := gcc

IFLAGS := 

LIBS :=

LFLAGS := 

# -Wshadow  -Woverloaded-virtual
CXXFLAGS :=
CXXFLAGS += -Wall
CXXFLAGS += -O2 -march=pentium -ffast-math
CXXFLAGS += -g
#CXXFLAGS += -pg
CXXFLAGS += -DPLATFORM_LINUX -DVIS_NO_LIBS -Wall -Wstrict-prototypes $(IFLAGS)

SRCS := \
	PupPilot.cc \
	Joystick.cc \

OBJS := $(SRCS:.cc=.o) 

DEPENDS := $(SRCS:%.cc=%.d) 

TARGET := pup_pilot

GEN_HS :=
DEP_PROCESS:=dep_process

all: $(TARGET)
	(cd ../bin;\rm -rf $(TARGET);ln -s ../PupPilot/$(TARGET))

$(TARGET): $(OBJS)
	$(C++) -o $@ $(CXXFLAGS) $^ $(LFLAGS)

clean:
	rm -f $(OBJS)
	rm -f $(TARGET)
	rm -f $(DEPENDS)
	rm -f ../bin/$(TARGET)

dep: depend

depend:
	rm -f $(DEPENDS)

include $(DEPENDS)

%.o: %.cc
	$(C++) $(CXXFLAGS) -c -o $@ $<

%.o: %.c
	$(CC) $(CXXFLAGS) -c -o $@ $<

%.d: %.cc $(GEN_HS)
	$(C++) -M $(CXXFLAGS) $< >$@.tmp
	$(DEP_PROCESS) $@.tmp $(basename $@).o $(GEN_HS) >$@
	rm $@.tmp
