Magellan Linux

Annotation of /trunk/mkinitrd-magellan/klibc/scripts/Kbuild.install

Parent Directory Parent Directory | Revision Log Revision Log


Revision 815 - (hide annotations) (download)
Fri Apr 24 18:32:46 2009 UTC (15 years, 1 month ago) by niro
File size: 3944 byte(s)
-updated to klibc-1.5.15
1 niro 532 #
2     # Install klibc
3     #
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.
9    
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.
13     #
14     SHLIBDIR = /lib
15    
16     # First rule
17     .PHONY: __install install-rule
18     __install:
19    
20     # Install commands
21     install-data := install -m 644
22     install-lib := install -m 755
23     install-bin := install -m 755
24    
25     # Install command
26     quiet_cmd_install = INSTALL $(install-y)
27     cmd_install = $(install-bin) $(install-y) \
28     $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)bin
29    
30     ifeq ($(KLIBC_INSTALL),1)
31     # First part - we are descending..
32    
33     # Reset variables (to get right type of assingment)
34     subdir- :=
35    
36     # Include Kbuild file
37     include $(srctree)/scripts/Kbuild.include
38     include $(srctree)/$(obj)/Kbuild
39    
40     # Directories to visit
41     # First find directories specified in lib-?, static-y and shared-y
42     find-dir = $(patsubst %/,%,$(filter %/, $(1)))
43    
44     __subdir := $(call find-dir, $(lib-))
45     __subdir += $(call find-dir, $(lib-y))
46    
47     __subdir += $(foreach e, $(static-y), $(call find-dir, $(e)))
48     __subdir += $(foreach e, $(shared-y), $(call find-dir, $(e)))
49    
50     # Use subdir- in Kbuild file to tell kbuild to visit a specific dir
51     subdir- += $(__subdir)
52    
53     # Remove duplicates and add prefix
54     subdir- := $(addprefix $(obj)/,$(sort $(subdir-)))
55    
56     # Files to install
57     install-y := $(strip $(addprefix $(obj)/, $(install-y)))
58    
59     __install: $(subdir-) install-rule
60     ifneq ($(install-y),)
61     $(call cmd,install)
62     else
63     @:
64     endif
65    
66     # Descending
67     .PHONY: $(subdir-)
68     $(subdir-):
69     $(Q)$(MAKE) KLIBC_INSTALL=1 \
70     -f $(srctree)/scripts/Kbuild.install obj=$@
71    
72     # If quiet is set, only print short version of command
73     cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1))
74    
75    
76     else
77     ##########################################################################
78     # This is the first time this file is invoked, so kick off the
79     # install process.
80     # First we descend all sub-directories to let them do their install.
81     # Second we do the final install steps.
82    
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
88     header:
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 niro 815 $(Q)set -e ; for d in linux asm asm-$(KLIBCARCH) asm-generic $(ASMKLIBCARCH); do \
99 niro 532 for r in $(KLIBCKERNELSRC)/include $(KLIBCKERNELOBJ)/include \
100     $(KLIBCKERNELOBJ)/include2 ; do \
101 niro 815 [ ! -d $$r/$$d ] && continue; \
102     mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)include/$$d ; \
103     cp -rfL $$r/$$d/. \
104 niro 532 $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/$$d/. ; \
105     done ; \
106     done
107     $(Q)cd $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include && ln -sf asm-$(KLIBCARCH) asm
108     $(Q)cp -rf usr/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)
111    
112     footer: header
113     $(Q)echo " INSTALL binaries to $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)bin"
114    
115     descend: footer
116     $(Q)$(MAKE) KLIBC_INSTALL=1 \
117     -f $(srctree)/scripts/Kbuild.install obj=$(obj)
118    
119     __install: descend
120     @:
121     endif