--- Makefile.orig 2020-03-10 13:16:26.000000000 +0300 +++ Makefile 2020-03-17 21:51:02.930996000 +0300 @@ -17,11 +17,19 @@ ## along with this library. If not, see . ## -PREFIX ?= arm-none-eabi- +TARGET ?= arm-none-eabi STYLECHECK := scripts/checkpatch.pl STYLECHECKFLAGS := --no-tree -f --terse --mailback + +DESTDIR ?= /usr/local + +INCDIR := $(DESTDIR)/$(TARGET)/include +LIBDIR := $(DESTDIR)/$(TARGET)/lib +SHAREDIR := $(DESTDIR)/$(TARGET)/share/libopencm3/scripts +INSTALL := install + TARGETS ?= stm32/f0 stm32/f1 stm32/f2 stm32/f3 stm32/f4 stm32/f7 \ stm32/l0 stm32/l1 stm32/l4 \ stm32/g0 \ @@ -66,7 +74,7 @@ $(LIB_DIRS): $(IRQ_DEFN_FILES:=.genhdr) $(Q)$(RM) .stamp_failure_$(subst /,_,$@) @printf " BUILD $@\n"; - $(Q)$(MAKE) --directory=$@ PREFIX="$(PREFIX)" || \ + $(Q)$(MAKE) --directory=$@ PREFIX="$(TARGET)-" || \ echo "Failure building: $@: code: $$?" > .stamp_failure_$(subst /,_,$@) lib: $(LIB_DIRS) @@ -76,6 +84,18 @@ done; $(Q)[ -f .stamp_failure_tld ] && cat .stamp_failure_tld && exit 1 || true; +install: lib + @printf " INSTALL headers\n" + $(Q)$(INSTALL) -d $(INCDIR)/libopencm3 + $(Q)$(INSTALL) -d $(INCDIR)/libopencmsis + $(Q)$(INSTALL) -d $(LIBDIR) + $(Q)cp -r include/libopencm3/* $(INCDIR)/libopencm3 + $(Q)cp -r include/libopencmsis/* $(INCDIR)/libopencmsis + @printf " INSTALL libs\n" + $(Q)$(INSTALL) -m 0644 lib/*.a $(LIBDIR) + @printf " INSTALL ldscripts\n" + $(Q)$(INSTALL) -m 0644 lib/*.ld $(LIBDIR) + html doc: $(Q)$(MAKE) -C doc html TARGETS="$(TARGETS)" @@ -121,4 +141,4 @@ fi; -.PHONY: build lib $(LIB_DIRS) doc clean generatedheaders cleanheaders stylecheck genlinktests genlinktests.clean +.PHONY: build lib $(LIB_DIRS) install doc clean generatedheaders cleanheaders stylecheck genlinktests