Commit 87e90729eafeec1ee8f0f6abfffb839f6e464fc2

Authored by Masahiro Yamada
Committed by Tom Rini
1 parent 48aa812d8c

kbuild: bug fixes and cleanups of Makefile.host

This commit imports updates of scripts/Makefile.host
from Linux 3.18-rc1.

Imported commits are:

[1] commit d8d9efe22709 by Masahiro Yamada
  kbuild: fix a typo in scripts/Makefile.host

[2] commit edb950c17de0 by Masahiro Yamada
  kbuild: fix a bug of C++ host program handling

[3] commit 62e2210798ed by Masahiro Yamada
  kbuild: drop shared library support from Makefile.host

[4] commit 663935593915 by Masahiro Yamada
  kbuild: clean up scripts/Makefile.host

[5] commit 1791ff7179f6 by Masahiro Yamada
  kbuild: clean-up and bug fix of scripts/Makefile.host

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

Showing 1 changed file with 9 additions and 52 deletions Side-by-side Diff

scripts/Makefile.host
... ... @@ -20,21 +20,12 @@
20 20 # Will compile qconf as a C++ program, and menu as a C program.
21 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 23 __hostprogs := $(sort $(hostprogs-y) $(hostprogs-m))
34 24  
35 25 # C code
36 26 # Executables compiled from a single .c file
37   -host-csingle := $(foreach m,$(__hostprogs),$(if $($(m)-objs),,$(m)))
  27 +host-csingle := $(foreach m,$(__hostprogs), \
  28 + $(if $($(m)-objs)$($(m)-cxxobjs),,$(m)))
38 29  
39 30 # C executables linked based on several .o files
40 31 host-cmulti := $(foreach m,$(__hostprogs),\
41 32  
42 33  
... ... @@ -44,33 +35,17 @@
44 35 host-cobjs := $(sort $(foreach m,$(__hostprogs),$($(m)-objs)))
45 36  
46 37 # C++ code
47   -# C++ executables compiled from at least on .cc file
  38 +# C++ executables compiled from at least one .cc file
48 39 # and zero or more .c files
49 40 host-cxxmulti := $(foreach m,$(__hostprogs),$(if $($(m)-cxxobjs),$(m)))
50 41  
51 42 # C++ Object (.o) files compiled from .cc files
52 43 host-cxxobjs := $(sort $(foreach m,$(host-cxxmulti),$($(m)-cxxobjs)))
53 44  
54   -# Shared libaries (only .c supported)
55   -# Shared libraries (.so) - all .so files referenced in "xxx-objs"
56   -host-cshlib := $(sort $(filter %.so, $(host-cobjs)))
57   -# Remove .so files from "xxx-objs"
58   -host-cobjs := $(filter-out %.so,$(host-cobjs))
59   -
60   -#Object (.o) files used by the shared libaries
61   -host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs))))
62   -
63 45 # output directory for programs/.o files
64   -# hostprogs-y := tools/build may have been specified. Retrieve directory
65   -host-objdirs := $(foreach f,$(__hostprogs), $(if $(dir $(f)),$(dir $(f))))
66   -# directory of .o files from prog-objs notation
67   -host-objdirs += $(foreach f,$(host-cmulti), \
68   - $(foreach m,$($(f)-objs), \
69   - $(if $(dir $(m)),$(dir $(m)))))
70   -# directory of .o files from prog-cxxobjs notation
71   -host-objdirs += $(foreach f,$(host-cxxmulti), \
72   - $(foreach m,$($(f)-cxxobjs), \
73   - $(if $(dir $(m)),$(dir $(m)))))
  46 +# hostprogs-y := tools/build may have been specified.
  47 +# Retrieve also directory of .o files from prog-objs or prog-cxxobjs notation
  48 +host-objdirs := $(dir $(__hostprogs) $(host-cobjs) $(host-cxxobjs))
74 49  
75 50 host-objdirs := $(strip $(sort $(filter-out ./,$(host-objdirs))))
76 51  
... ... @@ -81,8 +56,6 @@
81 56 host-cobjs := $(addprefix $(obj)/,$(host-cobjs))
82 57 host-cxxmulti := $(addprefix $(obj)/,$(host-cxxmulti))
83 58 host-cxxobjs := $(addprefix $(obj)/,$(host-cxxobjs))
84   -host-cshlib := $(addprefix $(obj)/,$(host-cshlib))
85   -host-cshobjs := $(addprefix $(obj)/,$(host-cshobjs))
86 59 host-objdirs := $(addprefix $(obj)/,$(host-objdirs))
87 60  
88 61 obj-dirs += $(host-objdirs)
... ... @@ -123,7 +96,7 @@
123 96 cmd_host-cmulti = $(HOSTCC) $(HOSTLDFLAGS) -o $@ \
124 97 $(addprefix $(obj)/,$($(@F)-objs)) \
125 98 $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
126   -$(host-cmulti): $(obj)/%: $(host-cobjs) $(host-cshlib) FORCE
  99 +$(host-cmulti): $(obj)/%: $(host-cobjs) FORCE
127 100 $(call if_changed,host-cmulti)
128 101  
129 102 # Create .o file from a single .c file
... ... @@ -140,7 +113,7 @@
140 113 $(foreach o,objs cxxobjs,\
141 114 $(addprefix $(obj)/,$($(@F)-$(o)))) \
142 115 $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
143   -$(host-cxxmulti): $(obj)/%: $(host-cobjs) $(host-cxxobjs) $(host-cshlib) FORCE
  116 +$(host-cxxmulti): $(obj)/%: $(host-cobjs) $(host-cxxobjs) FORCE
144 117 $(call if_changed,host-cxxmulti)
145 118  
146 119 # Create .o file from a single .cc (C++) file
147 120  
... ... @@ -149,22 +122,6 @@
149 122 $(host-cxxobjs): $(obj)/%.o: $(src)/%.cc FORCE
150 123 $(call if_changed_dep,host-cxxobjs)
151 124  
152   -# Compile .c file, create position independent .o file
153   -# host-cshobjs -> .o
154   -quiet_cmd_host-cshobjs = HOSTCC -fPIC $@
155   - cmd_host-cshobjs = $(HOSTCC) $(hostc_flags) -fPIC -c -o $@ $<
156   -$(host-cshobjs): $(obj)/%.o: $(src)/%.c FORCE
157   - $(call if_changed_dep,host-cshobjs)
158   -
159   -# Link a shared library, based on position independent .o files
160   -# *.o -> .so shared library (host-cshlib)
161   -quiet_cmd_host-cshlib = HOSTLLD -shared $@
162   - cmd_host-cshlib = $(HOSTCC) $(HOSTLDFLAGS) -shared -o $@ \
163   - $(addprefix $(obj)/,$($(@F:.so=-objs))) \
164   - $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
165   -$(host-cshlib): $(obj)/%: $(host-cshobjs) FORCE
166   - $(call if_changed,host-cshlib)
167   -
168 125 targets += $(host-csingle) $(host-cmulti) $(host-cobjs)\
169   - $(host-cxxmulti) $(host-cxxobjs) $(host-cshlib) $(host-cshobjs)
  126 + $(host-cxxmulti) $(host-cxxobjs)