From b5cee337fa9a5a2a897624aefe7baeae66c4df07 Mon Sep 17 00:00:00 2001 From: Nicolas Dechesne Date: Fri, 3 Jun 2016 19:37:37 +0200 Subject: [PATCH] makefile: add support to install header file New macro to be used to deploy header files when 'installing'. Use it as: $(call add-inc-target,lib,foo.h) to install file lib/foo.h Signed-off-by: Nicolas Dechesne --- Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Makefile b/Makefile index e619c39..7f8cad6 100644 --- a/Makefile +++ b/Makefile @@ -57,6 +57,14 @@ endif @$(CC) -MM -MF $(call src_to_dep,$<) -MP -MT "$@ $(call src_to_dep,$<)" $(CFLAGS) $(_CFLAGS) $< @$(CC) -o $@ -c $< $(CFLAGS) $(_CFLAGS) +define add-inc-target +$(PREFIX)/include/$2: $1/$2 + @echo "INSTALL $$<" + @install -D -m 755 $$< $$@ + +all-install += $(PREFIX)/include/$2 +endef + define add-target-deps all-srcs += $($1-srcs) all-objs += $(call src_to_obj,$($1-srcs))