1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 06:23:53 +01:00

sys/arduino: work around llvm-ar bug.

llvm-ar behaves weidly when creating thin archive. This only manifests
itself when using arduino sketches as these are built from the "bin"
directory.

Specifically, given a directory "m" and an object in "m/obj.o " an
invocation with CWD==m:

```
llvm-ar rcTs ../m.a obj.o
```

Will create a maformed archive. Binutils does not have any issue with this.

The following command, executed with CWD==m/.. works:

```
llvm-ar rcTs m.a m/obj.o
```

The trick used in this commit is to put the source files in a different
directory than the object files and compile from there.
This commit is contained in:
Juan Carrano 2019-09-10 17:42:39 +02:00
parent d9132eec90
commit 72f934f13d
2 changed files with 3 additions and 2 deletions

View File

@ -2,7 +2,7 @@
# Define application sketches module, it will be generated into $(BINDIR)
SKETCH_MODULE ?= arduino_sketches
SKETCH_MODULE_DIR ?= $(BINDIR)/$(SKETCH_MODULE)
SKETCH_MODULE_DIR ?= $(BINDIR)/$(SKETCH_MODULE)_src
SKETCHES = $(wildcard $(APPDIR)/*.sketch)
include $(RIOTBASE)/sys/arduino/sketches.inc.mk

View File

@ -19,7 +19,8 @@ SKETCH_GENERATED_FILES = $(SKETCH_MODULE_DIR)/Makefile $(SKETCH_MODULE_DIR)/$(SK
# Building the module files
# Do not use $^ in receipes as Makefile is also a prerequisite
$(SKETCH_MODULE_DIR)/Makefile: $(SKETCH_MODULE_DIR)/$(SKETCH_CPP)
$(Q)echo 'SRCXX = $(SKETCH_CPP)' > $@
$(Q)echo 'MODULE = $(SKETCH_MODULE)' > $@
$(Q)echo 'SRCXX = $(SKETCH_CPP)' >> $@
$(Q)echo 'include $$(RIOTBASE)/Makefile.base' >> $@
$(SKETCH_MODULE_DIR)/$(SKETCH_CPP): $(SKETCHES_ALL)
@mkdir -p $(@D)