Update UAVCAN Makefile to download source

This commit is contained in:
Paul A. Patience 2015-09-25 01:43:00 -04:00
parent 93876b5af3
commit 343c93f8e8
3 changed files with 152 additions and 7 deletions

View File

@ -1,3 +1,6 @@
/.built
/dsdlc_generated
/libuavcan
/libuavcan-*
/dsdl-*
/pyuavcan-*

View File

@ -16,6 +16,42 @@ config CANUTILS_UAVCAN
if CANUTILS_UAVCAN
config UAVCAN_LIBUAVCAN_URL
string "UAVCAN URL"
default "https://github.com/UAVCAN/libuavcan/archive"
---help---
UAVCAN URL.
config UAVCAN_LIBUAVCAN_VERSION
string "UAVCAN Version"
default "531433a3261ff1568e824c240d0f1c6ecef73be1"
---help---
UAVCAN version.
config UAVCAN_DSDL_URL
string "DSDL URL"
default "https://github.com/UAVCAN/dsdl/archive"
---help---
DSDL URL.
config UAVCAN_DSDL_VERSION
string "DSDL Version"
default "9804a3e6972825586be252ce08dd899f44994b14"
---help---
DSDL version.
config UAVCAN_PYUAVCAN_URL
string "Python UAVCAN URL"
default "https://github.com/UAVCAN/pyuavcan/archive"
---help---
Python UAVCAN URL.
config UAVCAN_PYUAVCAN_VERSION
string "Python UAVCAN Version"
default "4e2798ec3da8e8493b769da514f3b96eea5773e2"
---help---
Python UAVCAN version.
config UAVCAN_STM32_TIMER_NUMBER
int "Timer Number"
default 2

View File

@ -33,19 +33,38 @@
#
############################################################################
CXXEXT = .cpp
-include $(TOPDIR)/.config
-include $(TOPDIR)/Make.defs
include $(APPDIR)/Make.defs
include libuavcan/libuavcan/include.mk
include libuavcan/libuavcan_drivers/stm32/driver/include.mk
WGET = wget
UNPACK = unzip
PACKEXT = .zip
$(info $(shell $(LIBUAVCAN_DSDLC) $(UAVCAN_DSDL_DIR)))
LIBUAVCAN_URL = $(patsubst "%",%,$(strip $(CONFIG_UAVCAN_LIBUAVCAN_URL)))
LIBUAVCAN_VERSION = $(patsubst "%",%,$(strip $(CONFIG_UAVCAN_LIBUAVCAN_VERSION)))
LIBUAVCAN_UNPACKNAME = libuavcan-$(LIBUAVCAN_VERSION)
LIBUAVCAN_PACKNAME = $(LIBUAVCAN_UNPACKNAME)$(PACKEXT)
LIBUAVCAN_DSDL_PATH = libuavcan$(DELIM)dsdl
LIBUAVCAN_PYUAVCAN_PATH = libuavcan$(DELIM)libuavcan$(DELIM)dsdl_compiler$(DELIM)pyuavcan
CXXSRCS += $(LIBUAVCAN_SRC) $(LIBUAVCAN_STM32_SRC)
DSDL_URL = $(patsubst "%",%,$(strip $(CONFIG_UAVCAN_DSDL_URL)))
DSDL_VERSION = $(patsubst "%",%,$(strip $(CONFIG_UAVCAN_DSDL_VERSION)))
DSDL_UNPACKNAME = dsdl-$(DSDL_VERSION)
DSDL_PACKNAME = $(DSDL_UNPACKNAME)$(PACKEXT)
include $(APPDIR)/Application.mk
PYUAVCAN_URL = $(patsubst "%",%,$(strip $(CONFIG_UAVCAN_PYUAVCAN_URL)))
PYUAVCAN_VERSION = $(patsubst "%",%,$(strip $(CONFIG_UAVCAN_PYUAVCAN_VERSION)))
PYUAVCAN_UNPACKNAME = pyuavcan-$(PYUAVCAN_VERSION)
PYUAVCAN_PACKNAME = $(PYUAVCAN_UNPACKNAME)$(PACKEXT)
-include libuavcan/libuavcan/include.mk
-include libuavcan/libuavcan_drivers/stm32/driver/include.mk
CXXSRCS = $(LIBUAVCAN_SRC) $(LIBUAVCAN_STM32_SRC)
CXXFLAGS += -I$(LIBUAVCAN_INC) -I$(LIBUAVCAN_STM32_INC) -Idsdlc_generated
CXXFLAGS += -I$(TOPDIR)/arch/arm/src/stm32
CXXFLAGS += -I$(TOPDIR)/arch/arm/src/common -I$(TOPDIR)/arch/arm/src/stm32
CXXFLAGS += -DUAVCAN_STM32_NUTTX=1
CXXFLAGS += -DUAVCAN_STM32_TIMER_NUMBER=$(CONFIG_UAVCAN_STM32_TIMER_NUMBER)
@ -91,3 +110,90 @@ endif
ifneq ($(CONFIG_UAVCAN_MEM_POOL_BLOCK_SIZE),0)
CXXFLAGS += -DUAVCAN_MEM_POOL_BLOCK_SIZE=$(CONFIG_UAVCAN_MEM_POOL_BLOCK_SIZE)
endif
CXXEXT = .cpp
CXXOBJS = $(CXXSRCS:$(CXXEXT)=$(OBJEXT))
ifeq ($(WINTOOL),y)
BIN = "${shell cygpath -w $(APPDIR)$(DELIM)libapps$(LIBEXT)}"
else
BIN = $(APPDIR)$(DELIM)libapps$(LIBEXT)
endif
ROOTDEPPATH = --dep-path .
VPATH =
all: .built
.PHONY: clean depend distclean
$(LIBUAVCAN_PACKNAME):
@echo "Downloading: $(LIBUAVCAN_PACKNAME)"
$(Q) $(WGET) -O $(LIBUAVCAN_PACKNAME) $(LIBUAVCAN_URL)/$(LIBUAVCAN_VERSION)$(PACKEXT)
$(LIBUAVCAN_UNPACKNAME): $(LIBUAVCAN_PACKNAME)
@echo "Unpacking: $(LIBUAVCAN_PACKNAME) -> $(LIBUAVCAN_UNPACKNAME)"
$(Q) $(UNPACK) $(LIBUAVCAN_PACKNAME)
$(Q) touch $(LIBUAVCAN_UNPACKNAME)
$(DSDL_PACKNAME):
@echo "Downloading: $(DSDL_PACKNAME)"
$(Q) $(WGET) -O $(DSDL_PACKNAME) $(DSDL_URL)/$(DSDL_VERSION)$(PACKEXT)
$(DSDL_UNPACKNAME): $(DSDL_PACKNAME)
@echo "Unpacking: $(DSDL_PACKNAME) -> $(DSDL_UNPACKNAME)"
$(Q) $(UNPACK) $(DSDL_PACKNAME)
$(Q) touch $(DSDL_UNPACKNAME)
$(PYUAVCAN_PACKNAME):
@echo "Downloading: $(PYUAVCAN_PACKNAME)"
$(Q) $(WGET) -O $(PYUAVCAN_PACKNAME) $(PYUAVCAN_URL)/$(PYUAVCAN_VERSION)$(PACKEXT)
$(PYUAVCAN_UNPACKNAME): $(PYUAVCAN_PACKNAME)
@echo "Unpacking: $(PYUAVCAN_PACKNAME) -> $(PYUAVCAN_UNPACKNAME)"
$(Q) $(UNPACK) $(PYUAVCAN_PACKNAME)
$(Q) touch $(PYUAVCAN_UNPACKNAME)
libuavcan: $(LIBUAVCAN_UNPACKNAME) $(DSDL_UNPACKNAME) $(PYUAVCAN_UNPACKNAME)
$(Q) cp -R $(LIBUAVCAN_UNPACKNAME) libuavcan
$(call DELDIR, $(LIBUAVCAN_DSDL_PATH))
$(Q) cp -R $(DSDL_UNPACKNAME) $(LIBUAVCAN_DSDL_PATH)
$(call DELDIR, $(LIBUAVCAN_PYUAVCAN_PATH))
$(Q) cp -R $(PYUAVCAN_UNPACKNAME) $(LIBUAVCAN_PYUAVCAN_PATH)
dsdlc_generated: libuavcan
$(info $(shell $(LIBUAVCAN_DSDLC) $(UAVCAN_DSDL_DIR)))
$(CXXOBJS): %$(OBJEXT): %$(CXXEXT)
$(call COMPILEXX, $<, $@)
.built: $(CXXOBJS)
$(call ARCHIVE, $(BIN), $(CXXOBJS))
$(Q) touch .built
install:
context:
.depend: Makefile $(CXXSRCS) dsdlc_generated
$(Q) $(MKDEP) $(ROOTDEPPATH) "$(CXX)" -- $(CXXFLAGS) -- $(CXXSRCS) >Make.dep
$(Q) touch $@
depend: .depend
clean:
$(call DELFILE, .built)
$(call DELDIR, libuavcan)
$(call DELDIR, dsdlc_generated)
distclean: clean
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
$(call DELDIR, $(LIBUAVCAN_UNPACKNAME))
$(call DELFILE, $(LIBUAVCAN_PACKNAME))
$(call DELDIR, $(DSDL_UNPACKNAME))
$(call DELFILE, $(DSDL_PACKNAME))
$(call DELDIR, $(PYUAVCAN_UNPACKNAME))
$(call DELFILE, $(PYUAVCAN_PACKNAME))
-include Make.dep