--- Makefile.orig 2016-04-12 01:57:55.000000000 +0300 +++ Makefile 2016-04-22 15:20:16.000000000 +0300 @@ -17,12 +17,19 @@ ## along with this library. If not, see . ## -PREFIX ?= arm-none-eabi -#PREFIX ?= arm-elf +TARGET ?= arm-none-eabi +#TARGET ?= arm-elf 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 + space:= space+= SRCLIBDIR:= $(subst $(space),\$(space),$(realpath lib)) @@ -64,6 +71,18 @@ $(LIB_DIRS): $(IRQ_DEFN_FILES:=.genhdr) lib: $(LIB_DIRS) $(Q)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 @@ -106,4 +125,4 @@ genlinktests: $(LDTESTS:.data=.ldtest) fi; -.PHONY: build lib $(LIB_DIRS) doc clean generatedheaders cleanheaders stylecheck genlinktests +.PHONY: build lib $(LIB_DIRS) install doc clean generatedheaders cleanheaders stylecheck genlinktests