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