Changed local build target for library and linker files.

- The library files are now being built into the lib subdirectory of the
  source.
- The linker files for each library are being copied into the lib source
  subdirectory.

Motivation: The relative locations of files in the source directory after make
are now the same as after make install now. This makes it easier to
reuse examples with their makefiles outside of the libopencm3
sourcecode directory.
This commit is contained in:
Piotr Esden-Tempski
2012-08-13 14:37:07 -07:00
parent a2c5b6391d
commit 3441bba1c4
14 changed files with 70 additions and 182 deletions

View File

@@ -25,6 +25,7 @@ LIBDIR = $(DESTDIR)/$(PREFIX)/lib
SHAREDIR = $(DESTDIR)/$(PREFIX)/share/libopencm3/scripts
INSTALL = install
SRCLIBDIR = $(shell pwd)/lib
TARGETS = stm32/f1 stm32/f2 stm32/f4 lpc13xx lpc17xx lpc43xx lm3s
# Be silent per default, but 'make V=1' will show all compiler calls.
@@ -42,7 +43,7 @@ lib:
$(Q)for i in $(addprefix $@/,$(TARGETS)); do \
if [ -d $$i ]; then \
printf " BUILD $$i\n"; \
$(MAKE) -C $$i || exit $?; \
$(MAKE) -C $$i SRCLIBDIR=$(SRCLIBDIR) || exit $?; \
fi; \
done
@@ -61,11 +62,9 @@ install: lib
$(Q)$(INSTALL) -d $(SHAREDIR)
$(Q)cp -r include/libopencm3/* $(INCDIR)/libopencm3
@printf " INSTALL libs\n"
$(Q)$(INSTALL) -m 0644 lib/*/*/*.a $(LIBDIR)
$(Q)$(INSTALL) -m 0644 lib/*/*.a $(LIBDIR)
$(Q)$(INSTALL) -m 0644 lib/*.a $(LIBDIR)
@printf " INSTALL ldscripts\n"
$(Q)$(INSTALL) -m 0644 lib/*/*/*.ld $(LIBDIR)
$(Q)$(INSTALL) -m 0644 lib/*/*.ld $(LIBDIR)
$(Q)$(INSTALL) -m 0644 lib/*.ld $(LIBDIR)
@printf " INSTALL scripts\n"
$(Q)$(INSTALL) -m 0644 scripts/* $(SHAREDIR)
@@ -77,7 +76,7 @@ clean:
$(addsuffix /*/*,$(addprefix examples/,$(TARGETS))); do \
if [ -d $$i ]; then \
printf " CLEAN $$i\n"; \
$(MAKE) -C $$i clean || exit $?; \
$(MAKE) -C $$i clean SRCLIBDIR=$(SRCLIBDIR) || exit $?; \
fi; \
done
@printf " CLEAN doxygen\n"