diff options
author | Masahiro Yamada <yamada.m@jp.panasonic.com> | 2014-07-16 03:12:21 -0400 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2014-07-16 11:15:26 -0400 |
commit | 62e2210798ed38928ab24841e8b4878a2c170af8 (patch) | |
tree | 23356ee708bad36cc7a6a9775f9b25986e33b640 | |
parent | edb950c17de09ed04be1ed2c451ba207e3b0a29b (diff) |
kbuild: drop shared library support from Makefile.host
The shared library feature in Makefile.host is no longer used.
Rip it off to keep the build infrastucture simple.
Update Documentation/kbuild/makefiles.txt too.
The section "4.3 Definition shared libraries" should be removed
and the following sections should be re-numbered.
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Suggested-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
-rw-r--r-- | Documentation/kbuild/makefiles.txt | 39 | ||||
-rw-r--r-- | scripts/Makefile.host | 43 |
2 files changed, 11 insertions, 71 deletions
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index d567a7cc552b..3ceadbd99f79 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt | |||
@@ -23,11 +23,10 @@ This document describes the Linux kernel Makefiles. | |||
23 | === 4 Host Program support | 23 | === 4 Host Program support |
24 | --- 4.1 Simple Host Program | 24 | --- 4.1 Simple Host Program |
25 | --- 4.2 Composite Host Programs | 25 | --- 4.2 Composite Host Programs |
26 | --- 4.3 Defining shared libraries | 26 | --- 4.3 Using C++ for host programs |
27 | --- 4.4 Using C++ for host programs | 27 | --- 4.4 Controlling compiler options for host programs |
28 | --- 4.5 Controlling compiler options for host programs | 28 | --- 4.5 When host programs are actually built |
29 | --- 4.6 When host programs are actually built | 29 | --- 4.6 Using hostprogs-$(CONFIG_FOO) |
30 | --- 4.7 Using hostprogs-$(CONFIG_FOO) | ||
31 | 30 | ||
32 | === 5 Kbuild clean infrastructure | 31 | === 5 Kbuild clean infrastructure |
33 | 32 | ||
@@ -643,29 +642,7 @@ Both possibilities are described in the following. | |||
643 | Finally, the two .o files are linked to the executable, lxdialog. | 642 | Finally, the two .o files are linked to the executable, lxdialog. |
644 | Note: The syntax <executable>-y is not permitted for host-programs. | 643 | Note: The syntax <executable>-y is not permitted for host-programs. |
645 | 644 | ||
646 | --- 4.3 Defining shared libraries | 645 | --- 4.3 Using C++ for host programs |
647 | |||
648 | Objects with extension .so are considered shared libraries, and | ||
649 | will be compiled as position independent objects. | ||
650 | Kbuild provides support for shared libraries, but the usage | ||
651 | shall be restricted. | ||
652 | In the following example the libkconfig.so shared library is used | ||
653 | to link the executable conf. | ||
654 | |||
655 | Example: | ||
656 | #scripts/kconfig/Makefile | ||
657 | hostprogs-y := conf | ||
658 | conf-objs := conf.o libkconfig.so | ||
659 | libkconfig-objs := expr.o type.o | ||
660 | |||
661 | Shared libraries always require a corresponding -objs line, and | ||
662 | in the example above the shared library libkconfig is composed by | ||
663 | the two objects expr.o and type.o. | ||
664 | expr.o and type.o will be built as position independent code and | ||
665 | linked as a shared library libkconfig.so. C++ is not supported for | ||
666 | shared libraries. | ||
667 | |||
668 | --- 4.4 Using C++ for host programs | ||
669 | 646 | ||
670 | kbuild offers support for host programs written in C++. This was | 647 | kbuild offers support for host programs written in C++. This was |
671 | introduced solely to support kconfig, and is not recommended | 648 | introduced solely to support kconfig, and is not recommended |
@@ -688,7 +665,7 @@ Both possibilities are described in the following. | |||
688 | qconf-cxxobjs := qconf.o | 665 | qconf-cxxobjs := qconf.o |
689 | qconf-objs := check.o | 666 | qconf-objs := check.o |
690 | 667 | ||
691 | --- 4.5 Controlling compiler options for host programs | 668 | --- 4.4 Controlling compiler options for host programs |
692 | 669 | ||
693 | When compiling host programs, it is possible to set specific flags. | 670 | When compiling host programs, it is possible to set specific flags. |
694 | The programs will always be compiled utilising $(HOSTCC) passed | 671 | The programs will always be compiled utilising $(HOSTCC) passed |
@@ -716,7 +693,7 @@ Both possibilities are described in the following. | |||
716 | When linking qconf, it will be passed the extra option | 693 | When linking qconf, it will be passed the extra option |
717 | "-L$(QTDIR)/lib". | 694 | "-L$(QTDIR)/lib". |
718 | 695 | ||
719 | --- 4.6 When host programs are actually built | 696 | --- 4.5 When host programs are actually built |
720 | 697 | ||
721 | Kbuild will only build host-programs when they are referenced | 698 | Kbuild will only build host-programs when they are referenced |
722 | as a prerequisite. | 699 | as a prerequisite. |
@@ -747,7 +724,7 @@ Both possibilities are described in the following. | |||
747 | This will tell kbuild to build lxdialog even if not referenced in | 724 | This will tell kbuild to build lxdialog even if not referenced in |
748 | any rule. | 725 | any rule. |
749 | 726 | ||
750 | --- 4.7 Using hostprogs-$(CONFIG_FOO) | 727 | --- 4.6 Using hostprogs-$(CONFIG_FOO) |
751 | 728 | ||
752 | A typical pattern in a Kbuild file looks like this: | 729 | A typical pattern in a Kbuild file looks like this: |
753 | 730 | ||
diff --git a/scripts/Makefile.host b/scripts/Makefile.host index bf44e7988bf4..1c2e57000f5a 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host | |||
@@ -20,16 +20,6 @@ | |||
20 | # Will compile qconf as a C++ program, and menu as a C program. | 20 | # Will compile qconf as a C++ program, and menu as a C program. |
21 | # They are linked as C++ code to the executable qconf | 21 | # They are linked as C++ code to the executable qconf |
22 | 22 | ||
23 | # hostprogs-y := conf | ||
24 | # conf-objs := conf.o libkconfig.so | ||
25 | # libkconfig-objs := expr.o type.o | ||
26 | # Will create a shared library named libkconfig.so that consists of | ||
27 | # expr.o and type.o (they are both compiled as C code and the object files | ||
28 | # are made as position independent code). | ||
29 | # conf.c is compiled as a C program, and conf.o is linked together with | ||
30 | # libkconfig.so as the executable conf. | ||
31 | # Note: Shared libraries consisting of C++ files are not supported | ||
32 | |||
33 | __hostprogs := $(sort $(hostprogs-y) $(hostprogs-m)) | 23 | __hostprogs := $(sort $(hostprogs-y) $(hostprogs-m)) |
34 | 24 | ||
35 | # C code | 25 | # C code |
@@ -52,15 +42,6 @@ host-cxxmulti := $(foreach m,$(__hostprogs),$(if $($(m)-cxxobjs),$(m))) | |||
52 | # C++ Object (.o) files compiled from .cc files | 42 | # C++ Object (.o) files compiled from .cc files |
53 | host-cxxobjs := $(sort $(foreach m,$(host-cxxmulti),$($(m)-cxxobjs))) | 43 | host-cxxobjs := $(sort $(foreach m,$(host-cxxmulti),$($(m)-cxxobjs))) |
54 | 44 | ||
55 | # Shared libaries (only .c supported) | ||
56 | # Shared libraries (.so) - all .so files referenced in "xxx-objs" | ||
57 | host-cshlib := $(sort $(filter %.so, $(host-cobjs))) | ||
58 | # Remove .so files from "xxx-objs" | ||
59 | host-cobjs := $(filter-out %.so,$(host-cobjs)) | ||
60 | |||
61 | #Object (.o) files used by the shared libaries | ||
62 | host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs)))) | ||
63 | |||
64 | # output directory for programs/.o files | 45 | # output directory for programs/.o files |
65 | # hostprogs-y := tools/build may have been specified. Retrieve directory | 46 | # hostprogs-y := tools/build may have been specified. Retrieve directory |
66 | host-objdirs := $(foreach f,$(__hostprogs), $(if $(dir $(f)),$(dir $(f)))) | 47 | host-objdirs := $(foreach f,$(__hostprogs), $(if $(dir $(f)),$(dir $(f)))) |
@@ -82,8 +63,6 @@ host-cmulti := $(addprefix $(obj)/,$(host-cmulti)) | |||
82 | host-cobjs := $(addprefix $(obj)/,$(host-cobjs)) | 63 | host-cobjs := $(addprefix $(obj)/,$(host-cobjs)) |
83 | host-cxxmulti := $(addprefix $(obj)/,$(host-cxxmulti)) | 64 | host-cxxmulti := $(addprefix $(obj)/,$(host-cxxmulti)) |
84 | host-cxxobjs := $(addprefix $(obj)/,$(host-cxxobjs)) | 65 | host-cxxobjs := $(addprefix $(obj)/,$(host-cxxobjs)) |
85 | host-cshlib := $(addprefix $(obj)/,$(host-cshlib)) | ||
86 | host-cshobjs := $(addprefix $(obj)/,$(host-cshobjs)) | ||
87 | host-objdirs := $(addprefix $(obj)/,$(host-objdirs)) | 66 | host-objdirs := $(addprefix $(obj)/,$(host-objdirs)) |
88 | 67 | ||
89 | obj-dirs += $(host-objdirs) | 68 | obj-dirs += $(host-objdirs) |
@@ -124,7 +103,7 @@ quiet_cmd_host-cmulti = HOSTLD $@ | |||
124 | cmd_host-cmulti = $(HOSTCC) $(HOSTLDFLAGS) -o $@ \ | 103 | cmd_host-cmulti = $(HOSTCC) $(HOSTLDFLAGS) -o $@ \ |
125 | $(addprefix $(obj)/,$($(@F)-objs)) \ | 104 | $(addprefix $(obj)/,$($(@F)-objs)) \ |
126 | $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) | 105 | $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) |
127 | $(host-cmulti): $(obj)/%: $(host-cobjs) $(host-cshlib) FORCE | 106 | $(host-cmulti): $(obj)/%: $(host-cobjs) FORCE |
128 | $(call if_changed,host-cmulti) | 107 | $(call if_changed,host-cmulti) |
129 | 108 | ||
130 | # Create .o file from a single .c file | 109 | # Create .o file from a single .c file |
@@ -141,7 +120,7 @@ quiet_cmd_host-cxxmulti = HOSTLD $@ | |||
141 | $(foreach o,objs cxxobjs,\ | 120 | $(foreach o,objs cxxobjs,\ |
142 | $(addprefix $(obj)/,$($(@F)-$(o)))) \ | 121 | $(addprefix $(obj)/,$($(@F)-$(o)))) \ |
143 | $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) | 122 | $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) |
144 | $(host-cxxmulti): $(obj)/%: $(host-cobjs) $(host-cxxobjs) $(host-cshlib) FORCE | 123 | $(host-cxxmulti): $(obj)/%: $(host-cobjs) $(host-cxxobjs) FORCE |
145 | $(call if_changed,host-cxxmulti) | 124 | $(call if_changed,host-cxxmulti) |
146 | 125 | ||
147 | # Create .o file from a single .cc (C++) file | 126 | # Create .o file from a single .cc (C++) file |
@@ -150,21 +129,5 @@ quiet_cmd_host-cxxobjs = HOSTCXX $@ | |||
150 | $(host-cxxobjs): $(obj)/%.o: $(src)/%.cc FORCE | 129 | $(host-cxxobjs): $(obj)/%.o: $(src)/%.cc FORCE |
151 | $(call if_changed_dep,host-cxxobjs) | 130 | $(call if_changed_dep,host-cxxobjs) |
152 | 131 | ||
153 | # Compile .c file, create position independent .o file | ||
154 | # host-cshobjs -> .o | ||
155 | quiet_cmd_host-cshobjs = HOSTCC -fPIC $@ | ||
156 | cmd_host-cshobjs = $(HOSTCC) $(hostc_flags) -fPIC -c -o $@ $< | ||
157 | $(host-cshobjs): $(obj)/%.o: $(src)/%.c FORCE | ||
158 | $(call if_changed_dep,host-cshobjs) | ||
159 | |||
160 | # Link a shared library, based on position independent .o files | ||
161 | # *.o -> .so shared library (host-cshlib) | ||
162 | quiet_cmd_host-cshlib = HOSTLLD -shared $@ | ||
163 | cmd_host-cshlib = $(HOSTCC) $(HOSTLDFLAGS) -shared -o $@ \ | ||
164 | $(addprefix $(obj)/,$($(@F:.so=-objs))) \ | ||
165 | $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) | ||
166 | $(host-cshlib): $(obj)/%: $(host-cshobjs) FORCE | ||
167 | $(call if_changed,host-cshlib) | ||
168 | |||
169 | targets += $(host-csingle) $(host-cmulti) $(host-cobjs)\ | 132 | targets += $(host-csingle) $(host-cmulti) $(host-cobjs)\ |
170 | $(host-cxxmulti) $(host-cxxobjs) $(host-cshlib) $(host-cshobjs) | 133 | $(host-cxxmulti) $(host-cxxobjs) |