Annotation of /trunk/mkinitrd-magellan/klibc/scripts/Kbuild.install
Parent Directory | Revision Log
Revision 1122 -
(hide annotations)
(download)
Wed Aug 18 21:11:40 2010 UTC (13 years, 9 months ago) by niro
File size: 3567 byte(s)
Wed Aug 18 21:11:40 2010 UTC (13 years, 9 months ago) by niro
File size: 3567 byte(s)
-updated to klibc-1.5.19
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 | 1122 | $(Q)make -C $(KLIBCKERNELSRC) ARCH=$(KLIBCARCH) INSTALL_HDR_PATH=$(INSTALLROOT)$(INSTALLDIR)/$(KCROSS) headers_install |
99 | niro | 532 | $(Q)cp -rf usr/include/. $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/. |
100 | $(Q)$(install-data) $(srctree)/klcc/klcc.1 $(INSTALLROOT)$(mandir)/man1/$(KCROSS)klcc.1 | ||
101 | $(Q)$(install-bin) $(objtree)/klcc/$(KCROSS)klcc $(INSTALLROOT)$(bindir) | ||
102 | |||
103 | footer: header | ||
104 | $(Q)echo " INSTALL binaries to $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)bin" | ||
105 | |||
106 | descend: footer | ||
107 | $(Q)$(MAKE) KLIBC_INSTALL=1 \ | ||
108 | -f $(srctree)/scripts/Kbuild.install obj=$(obj) | ||
109 | |||
110 | __install: descend | ||
111 | @: | ||
112 | endif |