From 374aaacea5378687bd9dbb83111206554aa63567 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=20K=C3=A9vin?= Date: Thu, 10 Dec 2020 23:51:03 +0100 Subject: [PATCH] Rakefile: automatically get libopencm3 --- Rakefile | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Rakefile b/Rakefile index 9754420..ba9ff3d 100644 --- a/Rakefile +++ b/Rakefile @@ -28,6 +28,11 @@ end LIBOPENCM3_DIR = "libopencm3" LIBOPENCM3_INC = LIBOPENCM3_DIR+"/include" LIBOPENCM3_LIBS = LIBOPENCM3_DIR+"/lib" +# get libopencm3 +unless File.file?("./#{LIBOPENCM3_DIR}/scripts/genlink.py") then + sh "git submodule init" + sh "git submodule update" +end LIBOPENCM3_LIB = "opencm3_" + `./#{LIBOPENCM3_DIR}/scripts/genlink.py #{LIBOPENCM3_DIR}/ld/devices.data #{DEVICE} FAMILY` # source code used by the firmware @@ -137,14 +142,8 @@ def dependencies(source, done=[]) return done end -desc "get libopencm3" -file LIBOPENCM3_DIR+"/Makefile" do - sh "git submodule init" - sh "git submodule update" -end - desc "compile libopencm3" -file "#{LIBOPENCM3_LIBS}/lib#{LIBOPENCM3_LIB}.a" => LIBOPENCM3_DIR+"/Makefile" do +file "#{LIBOPENCM3_LIBS}/lib#{LIBOPENCM3_LIB}.a" do sh "make --directory #{LIBOPENCM3_DIR}" end