Add helper to recompile nif on env changes

pull/481/head
connor rigby 2018-04-05 11:31:30 -07:00
parent 92216f2e39
commit d046105b08
6 changed files with 18 additions and 4 deletions

1
.gitignore vendored
View File

@ -48,3 +48,4 @@ RELEASE_NOTES
*.hex
# lagger can't be disabled.
/log
.make_state

View File

@ -58,6 +58,19 @@ ARDUINO_BUILD = $(ARDUINO_BUILD_COMMON) $(ARDUINO_SRC_INO)
BLINK_BUILD = $(ARDUINO_BUILD_COMMON) $(ARDUINO_SRC_BLINK_INO)
CLEAR_EEPROM_BUILD = $(ARDUINO_BUILD_COMMON) $(ARDUINO_SRC_CLEAR_EEPROM_INO)
ENV_STATE_FILE=.make_state
LAST_STATE = $(shell cat $(ENV_STATE_FILE))
ifeq ($(LAST_STATE),)
$(shell echo $(MIX_TARGET) > .make_state)
LAST_STATE=""
endif
ifneq ($(LAST_STATE), $(MIX_TARGET))
$(shell echo $(MIX_TARGET) > .make_state)
$(shell rm -f $(NIF))
endif
all: priv $(NIF) farmbot_arduino_firmware
farmbot_arduino_firmware_build_dirs: $(ARDUINO_BUILD_DIR) $(ARDUINO_CACHE_DIR)
@ -116,6 +129,7 @@ $(CLEAR_EEPROM_FW):
cp $(ARDUINO_BUILD_DIR)/eeprom_clear.ino.hex $@
clean:
$(RM) $(ENV_STATE_FILE)
$(RM) $(NIF)
rm -rf $(ARDUINO_BUILD_DIR) $(ARDUINO_CACHE_DIR)
rm -rf priv/*.hex

View File

@ -77,7 +77,8 @@ defmodule Farmbot.Mixfile do
nil ->
%{
"ERL_EI_INCLUDE_DIR" => "#{:code.root_dir()}/usr/include",
"ERL_EI_LIBDIR" => "#{:code.root_dir()}/usr/lib"
"ERL_EI_LIBDIR" => "#{:code.root_dir()}/usr/lib",
"MIX_TARGET" => @target
}
_ -> %{}
end

View File

@ -40,7 +40,7 @@
"mime": {:hex, :mime, "1.2.0", "78adaa84832b3680de06f88f0997e3ead3b451a440d183d688085be2d709b534", [:mix], [], "hexpm"},
"mimerl": {:hex, :mimerl, "1.0.2", "993f9b0e084083405ed8252b99460c4f0563e41729ab42d9074fd5e52439be88", [:rebar3], [], "hexpm"},
"mock": {:hex, :mock, "0.2.1", "bfdba786903e77f9c18772dee472d020ceb8ef000783e737725a4c8f54ad28ec", [:mix], [{:meck, "~> 0.8.2", [hex: :meck, repo: "hexpm", optional: false]}], "hexpm"},
"nerves": {:hex, :nerves, "1.0.0-rc.0", "5c6cf122611d0024d06b88593aa9af46180d30712fc6ff07fa25fb9100125f1e", [:mix], [{:distillery, "~> 1.4", [hex: :distillery, repo: "hexpm", optional: false]}], "hexpm"},
"nerves": {:hex, :nerves, "1.0.0-rc.1", "7574d0c598074311e86128bea4c4a69ae751b4762a0c5ef817c9f61371091992", [:mix], [{:distillery, "~> 1.4", [hex: :distillery, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm"},
"nerves_leds": {:hex, :nerves_leds, "0.8.0", "193692767dca1a201b09113d242648493b9be0087bab83ebee99c3b0a254f5e1", [:mix], [], "hexpm"},
"nerves_uart": {:hex, :nerves_uart, "1.1.1", "2ba6282b45513268249e78880cd84bc37c5758ee7db9c6d92f442be21fcacc35", [:mix], [{:elixir_make, "~> 0.4", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm"},
"plug": {:hex, :plug, "1.4.5", "7b13869283fff6b8b21b84b8735326cc012c5eef8607095dc6ee24bd0a273d8e", [:mix], [{:cowboy, "~> 1.0.1 or ~> 1.1", [hex: :cowboy, repo: "hexpm", optional: true]}, {:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}], "hexpm"},

View File

@ -1 +0,0 @@
../repo/migrations

View File

@ -1 +0,0 @@
../repo/migrations