4
# File is logically seperated in two pieces.
5
# First piece is used when during a recursive descend of the klibc tree
6
# and second piece is used to do the final steps in the install
7
# If KLIBC_INSTALL is defined it tells us we are descending and we
8
# use first piece of the file.
10
# This indicates the location of the final version of the shared library.
11
# THIS MUST BE AN ABSOLUTE PATH WITH NO FINAL SLASH.
12
# Leave this empty to make it the root.
17
.PHONY: __install install-rule
21
install-data := install -m 644
22
install-lib := install -m 755
23
install-bin := install -m 755
26
quiet_cmd_install = INSTALL $(install-y)
27
cmd_install = $(install-bin) $(install-y) \
28
$(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)bin
30
ifeq ($(KLIBC_INSTALL),1)
31
# First part - we are descending..
33
# Reset variables (to get right type of assingment)
37
include $(srctree)/scripts/Kbuild.include
38
include $(srctree)/$(obj)/Kbuild
40
# Directories to visit
41
# First find directories specified in lib-?, static-y and shared-y
42
find-dir = $(patsubst %/,%,$(filter %/, $(1)))
44
__subdir := $(call find-dir, $(lib-))
45
__subdir += $(call find-dir, $(lib-y))
47
__subdir += $(foreach e, $(static-y), $(call find-dir, $(e)))
48
__subdir += $(foreach e, $(shared-y), $(call find-dir, $(e)))
50
# Use subdir- in Kbuild file to tell kbuild to visit a specific dir
51
subdir- += $(__subdir)
53
# Remove duplicates and add prefix
54
subdir- := $(addprefix $(obj)/,$(sort $(subdir-)))
57
install-y := $(strip $(addprefix $(obj)/, $(install-y)))
59
__install: $(subdir-) install-rule
69
$(Q)$(MAKE) KLIBC_INSTALL=1 \
70
-f $(srctree)/scripts/Kbuild.install obj=$@
72
# If quiet is set, only print short version of command
73
cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1))
77
##########################################################################
78
# This is the first time this file is invoked, so kick off the
80
# First we descend all sub-directories to let them do their install.
81
# Second we do the final install steps.
83
# Do actual install as a three steps approach
84
# 1) Create directories, install headers and man pages
85
# 2) Tell that we now install binaries
86
# 3) Install binaries by descending
87
.PHONY: header footer descend
89
$(Q)echo " INSTALL headers + man pages to $(INSTALLROOT)$(INSTALLDIR)"
90
$(Q)mkdir -p $(INSTALLROOT)$(bindir)
91
$(Q)mkdir -p $(INSTALLROOT)$(mandir)/man1
92
$(Q)mkdir -p $(INSTALLROOT)$(SHLIBDIR)
93
$(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)
94
$(Q)-rm -rf $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include
95
$(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include
96
$(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)lib
97
$(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)bin
98
$(Q)set -e ; for d in linux scsi asm-$(ARCH) asm-generic $(ASMARCH); do \
99
mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)include/$$d ; \
100
for r in $(KLIBCKERNELSRC)/include $(KLIBCKERNELOBJ)/include \
101
$(KLIBCKERNELOBJ)/include2 ; do \
102
[ ! -d $$r/$$d ] || \
104
$(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/$$d/. ; \
107
$(Q)cd $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include && ln -sf asm-$(ARCH) asm
108
$(Q)cp -rf include/. $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/.
109
$(Q)$(install-data) $(srctree)/klcc/klcc.1 $(INSTALLROOT)$(mandir)/man1/$(KCROSS)klcc.1
110
$(Q)$(install-bin) $(objtree)/klcc/$(KCROSS)klcc $(INSTALLROOT)$(bindir)
113
$(Q)echo " INSTALL binaries to $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)bin"
116
$(Q)$(MAKE) KLIBC_INSTALL=1 \
117
-f $(srctree)/scripts/Kbuild.install obj=$(obj)