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 <nicolas.dechesne@linaro.org>
This commit is contained in:
Nicolas Dechesne
2016-06-03 19:37:37 +02:00
parent dcf148e15e
commit b5cee337fa

View File

@@ -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))