2022-08-01 15:44:33 +02:00
|
|
|
############################################################################
|
2023-01-31 16:35:23 +01:00
|
|
|
# apps/canutils/libopencyphal/Makefile
|
2022-08-01 15:44:33 +02:00
|
|
|
#
|
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
# contributor license agreements. See the NOTICE file distributed with
|
|
|
|
# this work for additional information regarding copyright ownership. The
|
|
|
|
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
# "License"); you may not use this file except in compliance with the
|
|
|
|
# License. You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
# License for the specific language governing permissions and limitations
|
|
|
|
# under the License.
|
|
|
|
#
|
|
|
|
############################################################################
|
|
|
|
|
|
|
|
include $(APPDIR)/Make.defs
|
|
|
|
|
2023-01-31 16:35:23 +01:00
|
|
|
WD := ${shell echo $(CURDIR) | sed -e 's/ /\\ /g'}
|
|
|
|
|
2022-08-01 15:44:33 +02:00
|
|
|
UNPACK = unzip
|
|
|
|
PACKEXT = .zip
|
|
|
|
|
2023-01-31 16:35:23 +01:00
|
|
|
LIBOPENCYPHAL_URL = $(patsubst "%",%,$(strip $(CONFIG_LIBOPENCYPHAL_URL)))
|
|
|
|
LIBOPENCYPHAL_VERSION = $(patsubst "%",%,$(strip $(CONFIG_LIBOPENCYPHAL_VERSION)))
|
|
|
|
|
|
|
|
LIBOPENCYPHAL_PACKNAME = $(LIBOPENCYPHAL_UNPACKNAME)$(PACKEXT)
|
|
|
|
LIBOPENCYPHAL_UNPACKNAME = libcanard-$(LIBOPENCYPHAL_VERSION)
|
|
|
|
LIBOPENCYPHAL_SRCNAME = libcanard
|
|
|
|
|
|
|
|
LIBOPENCYPHAL_SRCDIR = $(WD)/$(LIBOPENCYPHAL_SRCNAME)
|
|
|
|
LIBOPENCYPHAL_DRVDIR = $(LIBOPENCYPHAL_SRCDIR)$(DELIM)libcanard
|
2022-08-01 15:44:33 +02:00
|
|
|
|
|
|
|
O1HEAP_URL = $(patsubst "%",%,$(strip $(CONFIG_O1HEAP_URL)))
|
|
|
|
O1HEAP_VERSION = $(patsubst "%",%,$(strip $(CONFIG_O1HEAP_VERSION)))
|
2023-01-31 16:35:23 +01:00
|
|
|
|
2022-08-01 15:44:33 +02:00
|
|
|
O1HEAP_PACKNAME = $(O1HEAP_UNPACKNAME)$(PACKEXT)
|
2023-01-31 16:35:23 +01:00
|
|
|
O1HEAP_UNPACKNAME = o1heap-$(O1HEAP_VERSION)
|
|
|
|
O1HEAP_SRCNAME = o1heap
|
2022-08-01 15:44:33 +02:00
|
|
|
|
2023-01-31 16:35:23 +01:00
|
|
|
O1HEAP_SRCDIR = $(WD)/$(O1HEAP_SRCNAME)
|
|
|
|
O1HEAP_DRVDIR = $(O1HEAP_SRCDIR)$(DELIM)o1heap
|
2022-08-01 15:44:33 +02:00
|
|
|
|
|
|
|
CFLAGS += -std=c11 -DCANARD_ASSERT=DEBUGASSERT -DCANARD_DSDL_CONFIG_LITTLE_ENDIAN=1
|
|
|
|
|
2023-01-31 16:35:23 +01:00
|
|
|
CSRCS = $(LIBOPENCYPHAL_DRVDIR)$(DELIM)canard.c $(LIBOPENCYPHAL_DRVDIR)$(DELIM)canard_dsdl.c
|
2022-08-01 15:44:33 +02:00
|
|
|
CSRCS += $(O1HEAP_DRVDIR)$(DELIM)o1heap.c
|
|
|
|
|
2023-01-31 16:35:23 +01:00
|
|
|
ifeq ($(wildcard $(LIBOPENCYPHAL_SRCNAME)/.git),)
|
|
|
|
$(LIBOPENCYPHAL_PACKNAME):
|
2022-08-01 15:44:33 +02:00
|
|
|
@echo "Downloading: $@"
|
2023-01-31 16:35:23 +01:00
|
|
|
$(Q) curl -o $@ -L $(LIBOPENCYPHAL_URL)$(DELIM)$(LIBOPENCYPHAL_VERSION)$(PACKEXT)
|
2022-08-01 15:44:33 +02:00
|
|
|
|
2023-01-31 16:35:23 +01:00
|
|
|
$(LIBOPENCYPHAL_SRCNAME): $(LIBOPENCYPHAL_PACKNAME)
|
2022-08-01 15:44:33 +02:00
|
|
|
@echo "Unpacking: $< -> $@"
|
|
|
|
$(call DELDIR, $@)
|
|
|
|
$(Q) $(UNPACK) $<
|
2023-01-31 16:35:23 +01:00
|
|
|
$(Q) mv $(LIBOPENCYPHAL_UNPACKNAME) $(LIBOPENCYPHAL_SRCNAME)
|
2022-08-01 15:44:33 +02:00
|
|
|
$(Q) touch $@
|
2023-01-31 16:35:23 +01:00
|
|
|
|
|
|
|
$(LIBOPENCYPHAL_DRVDIR)$(DELIM)canard.c: $(LIBOPENCYPHAL_SRCNAME)
|
|
|
|
endif
|
2023-02-25 19:12:10 +01:00
|
|
|
|
2023-01-31 16:35:23 +01:00
|
|
|
ifeq ($(wildcard $(O1HEAP_SRCNAME)/.git),)
|
2022-08-01 15:44:33 +02:00
|
|
|
$(O1HEAP_PACKNAME):
|
|
|
|
@echo "Downloading: $@"
|
|
|
|
$(Q) curl -o $@ -L $(O1HEAP_URL)$(DELIM)$(O1HEAP_VERSION)$(PACKEXT)
|
|
|
|
|
2023-01-31 16:35:23 +01:00
|
|
|
$(O1HEAP_SRCNAME): $(O1HEAP_PACKNAME)
|
2022-08-01 15:44:33 +02:00
|
|
|
@echo "Unpacking: $< -> $@"
|
|
|
|
$(call DELDIR, $@)
|
|
|
|
$(Q) $(UNPACK) $<
|
2023-01-31 16:35:23 +01:00
|
|
|
$(Q) mv $(O1HEAP_UNPACKNAME) $(O1HEAP_SRCNAME)
|
2022-08-01 15:44:33 +02:00
|
|
|
$(Q) touch $@
|
|
|
|
|
2023-01-31 16:35:23 +01:00
|
|
|
$(O1HEAP_DRVDIR)$(DELIM)o1heap.c: $(O1HEAP_SRCNAME)
|
|
|
|
endif
|
2022-08-01 15:44:33 +02:00
|
|
|
|
2023-01-31 16:35:23 +01:00
|
|
|
context:: $(LIBOPENCYPHAL_SRCNAME) $(O1HEAP_SRCNAME)
|
2022-08-01 15:44:33 +02:00
|
|
|
|
|
|
|
distclean::
|
2023-01-31 16:35:23 +01:00
|
|
|
$(call DELDIR, $(LIBOPENCYPHAL_SRCNAME))
|
|
|
|
$(call DELFILE, $(LIBOPENCYPHAL_PACKNAME))
|
|
|
|
$(call DELDIR, $(O1HEAP_SRCNAME))
|
2022-08-01 15:44:33 +02:00
|
|
|
$(call DELFILE, $(O1HEAP_PACKNAME))
|
|
|
|
|
|
|
|
include $(APPDIR)/Application.mk
|