about summary refs log tree commit diff
path: root/Makefile.lib
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile.lib')
-rw-r--r--Makefile.lib12
1 files changed, 10 insertions, 2 deletions
diff --git a/Makefile.lib b/Makefile.lib
index d197fa6c1c63..1c4ada9c2ee8 100644
--- a/Makefile.lib
+++ b/Makefile.lib
@@ -92,11 +92,19 @@ define PROGRAMS_template =
   _srcs := $$(foreach src, $$($(1)_SOURCES), $$(_d)/$$(src))
   $(1)_OBJS := $$(addsuffix .o, $$(basename $$(_srcs)))
   _libs := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_NAME))
-  _prog := $$(_d)/$(1)
+  $(1)_PATH := $$(_d)/$(1)
 
-  $$(_prog): $$($(1)_OBJS) $$(_libs)
+  $$($(1)_PATH): $$($(1)_OBJS) $$(_libs)
 	$(QUIET) $(CXX) -o $$@ -Wl,--no-copy-dt-needed-entries $$($(1)_OBJS) $$($(1)_LDFLAGS) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE))
 
+  $(1)_INSTALL_PATH := $$(bindir)/$(1)
+
+  $$($(1)_INSTALL_PATH): $$($(1)_PATH)
+	mkdir -p $$(dir $$@)
+	cp $$< $$@
+
+  install:: $$($(1)_INSTALL_PATH)
+
   # Propagate CXXFLAGS to the individual object files.
   $$(foreach obj, $$($(1)_OBJS), $$(eval $$(obj)_CXXFLAGS=$$($(1)_CXXFLAGS)))