export ROS_DISTRO_DIR_FINAL=/opt/ros/${ROS_DISTRO_NAME}
export ROS_DISTRO_DIR=${ROS_DESTDIR}${ROS_DISTRO_DIR_FINAL}
export ROS_STACK_DIR=${ROS_DISTRO_DIR}/stacks
export ROS_STACK_DIR_FINAL=${ROS_DISTRO_DIR_FINAL}/stacks

${ROS_DISTRO_DIR}/ros: ros-${ROS_STACK_VERSION}.md5 ../ros-${ROS_STACK_VERSION}.tar.bz2
	md5sum -c ros-${ROS_STACK_VERSION}.md5 && (mkdir -p ${ROS_DISTRO_DIR} && cd ${ROS_DISTRO_DIR} && tar -xjf $(CURDIR)/../ros-${ROS_STACK_VERSION}.tar.bz2 && mv ros-${ROS_STACK_VERSION} ros)

install: ${ROS_DISTRO_DIR}/ros
	./update_version.py debian/changelog.tmp > debian/changelog
	bash -c ". setup_deb.sh && cd ${ROS_DISTRO_DIR}/ros && make"
        # Build the tests for now.  Eventually we will split this into a different deb target
	bash -c ". setup_deb.sh && rosmake ros -i"
	rm -rf ${ROS_DISTRO_DIR}/ros/*/build/CMakeFiles
ifneq (${ROS_DISTRO_NAME}, cturtle)
	bash -c ". setup_deb.sh && ./purge_build.py ${ROS_DISTRO_DIR}"
endif
	cp setup.sh setup.bash setup.zsh .rosinstall ${ROS_DISTRO_DIR}/
	mkdir -p ${ROS_DISTRO_DIR}/stacks
	-python -mcompileall ${ROS_DISTRO_DIR}/ros
	./fixrpath.py ${ROS_DISTRO_DIR}/ros ${ROS_DISTRO_DIR} ${ROS_DISTRO_DIR_FINAL}
	./fixpc.py ${ROS_DISTRO_DIR}/ros ${ROS_DISTRO_DIR} ${ROS_DISTRO_DIR_FINAL}

clean:

