Skip to content
Permalink
Browse files

Start debugging elixir_make errors

  • Loading branch information...
ConnorRigby committed Mar 11, 2019
1 parent db50666 commit 28e40940a7d0f4518bb02311fc73574781d857a3
Showing with 25 additions and 56 deletions.
  1. +22 −24 Makefile
  2. +0 −28 c_src/build_calendar/Makefile
  3. +1 −2 lib/farmbot/asset/farm_event.ex
  4. +2 −2 mix.exs
@@ -3,42 +3,40 @@ CLEAN :=

PREFIX = $(MIX_COMPILE_PATH)/../priv
BUILD = $(MIX_COMPILE_PATH)/../obj
# Set Erlang-specific compile and linker flags
ERL_CFLAGS ?= -I$(ERL_EI_INCLUDE_DIR)
ERL_LDFLAGS ?= -L$(ERL_EI_LIBDIR)

ifeq ($(ERL_EI_INCLUDE_DIR),)

$(warning ERL_EI_INCLUDE_DIR not set. Invoke via mix)

else

ALL += fbos_build_calendar_nif
CLEAN += fbos_clean_build_calendar_nif
endif

ifeq ($(ARDUINO_BUILD),)
NIF_LDFLAGS += -fPIC -shared
NIF_CFLAGS ?= -fPIC -O2 -Wall

$(warning ARDUINO_BUILD is not set. No arduino assets will be built.)

else

ALL += fbos_arduino_firmware
CLEAN += fbos_clean_arduino_firmware
NIF=

ifeq ($(ERL_EI_INCLUDE_DIR),)
$(warning ERL_EI_INCLUDE_DIR not set. Invoke via mix)
endif

.PHONY: $(ALL) $(CLEAN) all clean
.PHONY: fbos_arduino_firmware fbos_clean_arduino_firmware all clean

all: $(ALL)
all: $(PREFIX) $(BUILD) $(PREFIX)/build_calendar.so

clean: $(CLEAN)
clean:
$(RM) $(PREFIX)/*.so

fbos_arduino_firmware:
cd c_src/farmbot-arduino-firmware && make all BUILD_DIR=$(PWD)/_build FBARDUINO_FIRMWARE_SRC_DIR=$(PWD)/c_src/farmbot-arduino-firmware/src BIN_DIR=$(PWD)/priv

fbos_clean_arduino_firmware:
cd c_src/farmbot-arduino-firmware && make clean BUILD_DIR=$(PWD)/_build FBARDUINO_FIRMWARE_SRC_DIR=$(PWD)/c_src/farmbot-arduino-firmware/src BIN_DIR=$(PWD)/priv

fbos_build_calendar_nif:
make -f c_src/build_calendar/Makefile all ERL_EI_INCLUDE_DIR=$(ERL_EI_INCLUDE_DIR) ERL_EI_LIBDIR=$(ERL_EI_LIBDIR) BUILD=$(BUILD) PREFIX=$(PREFIX)
$(PREFIX)/build_calendar.so: $(BUILD)/build_calendar.o
$(CC) $(ERL_LDFLAGS) $(NIF_LDFLAGS) -o $@ $<

$(BUILD)/build_calendar.o: c_src/build_calendar/build_calendar.c
$(CC) -c $(ERL_CFLAGS) $(NIF_CFLAGS) -o $@ $<

$(PREFIX):
mkdir -p $(PREFIX)

fbos_clean_build_calendar_nif:
make -f c_src/build_calendar/Makefile clean ERL_EI_INCLUDE_DIR=$(ERL_EI_INCLUDE_DIR) ERL_EI_LIBDIR=$(ERL_EI_LIBDIR) BUILD=$(BUILD) PREFIX=$(PREFIX)
$(BUILD):
mkdir -p $(BUILD)

This file was deleted.

Oops, something went wrong.
@@ -9,13 +9,12 @@ defmodule Farmbot.Asset.FarmEvent do

@on_load :load_nif
def load_nif do
require Logger
nif_file = '#{:code.priv_dir(:farmbot)}/build_calendar'

case :erlang.load_nif(nif_file, 0) do
:ok -> :ok
{:error, {:reload, _}} -> :ok
{:error, reason} -> Logger.warn("Failed to load nif: #{inspect(reason)}")
{:error, reason} -> IO.warn("Failed to load nif: #{inspect(reason)}", [])
end
end

@@ -27,14 +27,14 @@ defmodule Farmbot.Mixfile do
elixir: "~> 1.8",
package: package(),
make_clean: ["clean"],
compilers: [:elixir_make] ++ Mix.compilers(),
compilers: [:elixir_make | Mix.compilers()],
test_coverage: [tool: ExCoveralls],
version: @version,
commit: commit(),
branch: branch(),
arduino_commit: arduino_commit(),
archives: [nerves_bootstrap: "~> 1.2"],
build_embedded: Mix.target() != :host,
build_embedded: true,
start_permanent: Mix.env() == :prod,
config_path: "config/config.exs",
elixirc_paths: elixirc_paths(Mix.env(), Mix.target()),

0 comments on commit 28e4094

Please sign in to comment.
You can’t perform that action at this time.