blob: 93a07027b0a9e4b998d43c410c577ba8dc466106 [file] [log] [blame]
aliguori17759182009-01-21 18:12:52 +00001
Fam Zheng2f4e4dc2016-06-01 12:25:15 +08002COMMA := ,
3
Juan Quintela5ab28862009-10-06 21:11:14 +02004# Don't use implicit rules or variables
5# we have explicit rules for everything
6MAKEFLAGS += -rR
7
8# Files with this suffixes are final, don't try to generate them
9# using implicit rules
Paolo Bonzinia273f4c2016-11-02 20:46:13 +010010%/trace-events:
11%.hx:
12%.py:
13%.objs:
Juan Quintela5ab28862009-10-06 21:11:14 +020014%.d:
15%.h:
16%.c:
Peter Maydellc3dc9fd2014-02-05 17:27:27 +000017%.cc:
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -040018%.cpp:
Juan Quintela5ab28862009-10-06 21:11:14 +020019%.m:
20%.mak:
Michael Muellerdced7ee2016-09-05 10:52:19 +020021clean-target:
Juan Quintela5ab28862009-10-06 21:11:14 +020022
Stefan Weil7ebf54b2009-11-19 20:07:52 +010023# Flags for dependency generation
Victor Kaplansky998b7b12015-08-09 12:39:53 +030024QEMU_DGFLAGS += -MMD -MP -MT $@ -MF $(@D)/$(*F).d
malc02d54672009-10-11 17:08:57 +040025
Daniel P. Berrangeba78db42017-01-25 16:14:10 +000026# Compiler searches the source file dir first, but in vpath builds
27# we need to make it search the build dir too, before any other
28# explicit search paths. There are two search locations in the build
29# dir, one absolute and the other relative to the compiler working
30# directory. These are the same for target-independent files, but
31# different for target-dependent ones.
Michael S. Tsirkin9edc19c2018-03-21 17:22:07 +020032QEMU_LOCAL_INCLUDES = -iquote $(BUILD_DIR)/$(@D) -iquote $(@D)
Paolo Bonzini9d9199a2012-09-17 10:21:52 +020033
Fam Zhengc261d772014-09-01 18:35:10 +080034WL_U := -Wl,-u,
Stefan Weil4852ee92014-09-18 21:55:08 +020035find-symbols = $(if $1, $(sort $(shell $(NM) -P -g $1 | $2)))
Fam Zhengc261d772014-09-01 18:35:10 +080036defined-symbols = $(call find-symbols,$1,awk '$$2!="U"{print $$1}')
37undefined-symbols = $(call find-symbols,$1,awk '$$2=="U"{print $$1}')
38
39# All the .mo objects in -m variables are also added into corresponding -y
40# variable in unnest-vars, but filtered out here, when LINK is called.
41#
42# The .mo objects are supposed to be linked as a DSO, for module build. So here
43# they are only used as a placeholders to generate those "archive undefined"
44# symbol options (-Wl,-u,$symbol_name), which are the archive functions
45# referenced by the code in the DSO.
46#
47# Also the presence in -y variables will also guarantee they are built before
48# linking executables that will load them. So we can look up symbol reference
49# in LINK.
50#
51# This is necessary because the exectuable itself may not use the function, in
52# which case the function would not be linked in. Then the DSO loading will
53# fail because of the missing symbol.
54process-archive-undefs = $(filter-out %.a %.mo,$1) \
55 $(addprefix $(WL_U), \
56 $(filter $(call defined-symbols,$(filter %.a, $1)), \
57 $(call undefined-symbols,$(filter %.mo,$1)))) \
58 $(filter %.a,$1)
59
Fam Zheng5b1b6db2016-07-27 14:26:15 +080060extract-libs = $(strip $(foreach o,$(filter-out %.mo,$1),$($o-libs)))
Fam Zheng17969262014-02-10 14:48:56 +080061expand-objs = $(strip $(sort $(filter %.o,$1)) \
62 $(foreach o,$(filter %.mo,$1),$($o-objs)) \
63 $(filter-out %.o %.mo,$1))
Fam Zheng5c0d52b2014-02-10 14:48:53 +080064
Andreas Färber0e8c9212010-01-06 20:24:05 +010065%.o: %.c
Daniel P. Berrangeba78db42017-01-25 16:14:10 +000066 $(call quiet-command,$(CC) $(QEMU_LOCAL_INCLUDES) $(QEMU_INCLUDES) \
67 $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) $($@-cflags) \
68 -c -o $@ $<,"CC","$(TARGET_DIR)$@")
Paolo Bonzini6821cdc2013-04-27 00:25:31 +020069%.o: %.rc
Peter Maydell0bdb12c2016-10-04 17:27:21 +010070 $(call quiet-command,$(WINDRES) -I. -o $@ $<,"RC","$(TARGET_DIR)$@")
aliguori17759182009-01-21 18:12:52 +000071
Peter Maydell3144f782014-02-05 17:27:27 +000072# If we have a CXX we might have some C++ objects, in which case we
73# must link with the C++ compiler, not the plain C compiler.
74LINKPROG = $(or $(CXX),$(CC))
75
Fam Zheng1c33ac52014-05-27 15:54:19 +080076LINK = $(call quiet-command, $(LINKPROG) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ \
Fam Zhengc261d772014-09-01 18:35:10 +080077 $(call process-archive-undefs, $1) \
Peter Maydell0bdb12c2016-10-04 17:27:21 +010078 $(version-obj-y) $(call extract-libs,$1) $(LIBS),"LINK","$(TARGET_DIR)$@")
Alon Levy44dc0ca2011-05-15 11:51:28 +030079
Richard Henderson5f6f0e22016-06-23 10:39:18 -070080%.o: %.S
Daniel P. Berrangeba78db42017-01-25 16:14:10 +000081 $(call quiet-command,$(CCAS) $(QEMU_LOCAL_INCLUDES) $(QEMU_INCLUDES) \
82 $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) \
83 -c -o $@ $<,"CCAS","$(TARGET_DIR)$@")
aliguori17759182009-01-21 18:12:52 +000084
Peter Maydellc3dc9fd2014-02-05 17:27:27 +000085%.o: %.cc
Daniel P. Berrangeba78db42017-01-25 16:14:10 +000086 $(call quiet-command,$(CXX) $(QEMU_LOCAL_INCLUDES) $(QEMU_INCLUDES) \
87 $(QEMU_CXXFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) $($@-cflags) \
88 -c -o $@ $<,"CXX","$(TARGET_DIR)$@")
Peter Maydellc3dc9fd2014-02-05 17:27:27 +000089
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -040090%.o: %.cpp
Daniel P. Berrangeba78db42017-01-25 16:14:10 +000091 $(call quiet-command,$(CXX) $(QEMU_LOCAL_INCLUDES) $(QEMU_INCLUDES) \
92 $(QEMU_CXXFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) $($@-cflags) \
93 -c -o $@ $<,"CXX","$(TARGET_DIR)$@")
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -040094
aliguori17759182009-01-21 18:12:52 +000095%.o: %.m
Daniel P. Berrangeba78db42017-01-25 16:14:10 +000096 $(call quiet-command,$(OBJCC) $(QEMU_LOCAL_INCLUDES) $(QEMU_INCLUDES) \
97 $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) $($@-cflags) \
98 -c -o $@ $<,"OBJC","$(TARGET_DIR)$@")
aliguori17759182009-01-21 18:12:52 +000099
Paolo Bonzini2c13ec52012-12-21 09:23:18 +0100100%.o: %.dtrace
Peter Maydell0bdb12c2016-10-04 17:27:21 +0100101 $(call quiet-command,dtrace -o $@ -G -s $<,"GEN","$(TARGET_DIR)$@")
Paolo Bonzini2c13ec52012-12-21 09:23:18 +0100102
Fam Zhengd24697e2015-05-07 14:55:15 +0800103DSO_OBJ_CFLAGS := -fPIC -DBUILD_DSO
104module-common.o: CFLAGS += $(DSO_OBJ_CFLAGS)
Fam Zheng17969262014-02-10 14:48:56 +0800105%$(DSOSUF): LDFLAGS += $(LDFLAGS_SHARED)
Fam Zhengc261d772014-09-01 18:35:10 +0800106%$(DSOSUF): %.mo
Fam Zheng17969262014-02-10 14:48:56 +0800107 $(call LINK,$^)
Fam Zhenge26110c2014-02-10 14:48:57 +0800108 @# Copy to build root so modules can be loaded when program started without install
Peter Maydell0bdb12c2016-10-04 17:27:21 +0100109 $(if $(findstring /,$@),$(call quiet-command,cp $@ $(subst /,-,$@),"CP","$(subst /,-,$@)"))
Fam Zheng17969262014-02-10 14:48:56 +0800110
Fam Zhengc261d772014-09-01 18:35:10 +0800111
Paolo Bonzini7ecf44a2016-11-29 16:37:20 +0100112LD_REL := $(CC) -nostdlib $(LD_REL_FLAGS)
Fam Zhengc261d772014-09-01 18:35:10 +0800113
114%.mo:
Peter Maydell0bdb12c2016-10-04 17:27:21 +0100115 $(call quiet-command,$(LD_REL) -o $@ $^,"LD","$(TARGET_DIR)$@")
Fam Zhengc261d772014-09-01 18:35:10 +0800116
Fam Zheng17969262014-02-10 14:48:56 +0800117.PHONY: modules
118modules:
119
aliguori3aa892d2009-01-21 18:13:02 +0000120%$(EXESUF): %.o
Michael S. Tsirkincefa2bb2016-02-17 16:59:36 +0200121 $(call LINK,$(filter %.o %.a %.mo, $^))
aliguori4f188f82009-01-21 18:13:09 +0000122
aliguori93a0dba2009-01-21 18:13:16 +0000123%.a:
Peter Maydell0bdb12c2016-10-04 17:27:21 +0100124 $(call quiet-command,rm -f $@ && $(AR) rcs $@ $^,"AR","$(TARGET_DIR)$@")
aliguori93a0dba2009-01-21 18:13:16 +0000125
Peter Maydell0bdb12c2016-10-04 17:27:21 +0100126# Usage: $(call quiet-command,command and args,"NAME","args to print")
127# This will run "command and args", and either:
128# if V=1 just print the whole command and args
129# otherwise print the 'quiet' output in the format " NAME args to print"
130# NAME should be a short name of the command, 7 letters or fewer.
131# If called with only a single argument, will print nothing in quiet mode.
132quiet-command = $(if $(V),$1,$(if $(2),@printf " %-7s %s\n" $2 $3 && $1, @$1))
Juan Quintela70071e12009-07-21 14:11:18 +0200133
134# cc-option
Juan Quintela8a2e6ab2009-08-31 00:48:45 +0200135# Usage: CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)
Juan Quintela70071e12009-07-21 14:11:18 +0200136
Thomas Monjalonfc3baad2009-09-11 18:45:40 +0200137cc-option = $(if $(shell $(CC) $1 $2 -S -o /dev/null -xc /dev/null \
138 >/dev/null 2>&1 && echo OK), $2, $3)
Paolo Bonzini036999e2016-07-20 21:36:49 +0200139cc-c-option = $(if $(shell $(CC) $1 $2 -c -o /dev/null -xc /dev/null \
140 >/dev/null 2>&1 && echo OK), $2, $3)
Juan Quintela1215c6e2009-10-07 02:40:58 +0200141
Peter Maydellc3dc9fd2014-02-05 17:27:27 +0000142VPATH_SUFFIXES = %.c %.h %.S %.cc %.cpp %.m %.mak %.texi %.sh %.rc
Nathan Froyd288e7bc2010-04-26 14:52:23 -0700143set-vpath = $(if $1,$(foreach PATTERN,$(VPATH_SUFFIXES),$(eval vpath $(PATTERN) $1)))
Paolo Bonzini076d2472009-12-21 10:06:55 +0100144
Michael Tokarev0d659422014-06-22 10:55:23 +0400145# install-prog list, dir
146define install-prog
147 $(INSTALL_DIR) "$2"
148 $(INSTALL_PROG) $1 "$2"
149 $(if $(STRIP),$(STRIP) $(foreach T,$1,"$2/$(notdir $T)"),)
150endef
151
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +0200152# find-in-path
153# Usage: $(call find-in-path, prog)
154# Looks in the PATH if the argument contains no slash, else only considers one
155# specific directory. Returns an # empty string if the program doesn't exist
156# there.
Marc-André Lureau88071582016-09-23 16:35:08 +0400157find-in-path = $(if $(findstring /, $1), \
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +0200158 $(wildcard $1), \
159 $(wildcard $(patsubst %, %/$1, $(subst :, ,$(PATH)))))
160
Peter Maydell837a2e22013-09-13 18:25:51 +0100161# Logical functions (for operating on y/n values like CONFIG_FOO vars)
162# Inputs to these must be either "y" (true) or "n" or "" (both false)
163# Output is always either "y" or "n".
164# Usage: $(call land,$(CONFIG_FOO),$(CONFIG_BAR))
165# Logical NOT
166lnot = $(if $(subst n,,$1),n,y)
167# Logical AND
168land = $(if $(findstring yy,$1$2),y,n)
169# Logical OR
170lor = $(if $(findstring y,$1$2),y,n)
171# Logical XOR (note that this is the inverse of leqv)
172lxor = $(if $(filter $(call lnot,$1),$(call lnot,$2)),n,y)
173# Logical equivalence (note that leqv "","n" is true)
174leqv = $(if $(filter $(call lnot,$1),$(call lnot,$2)),y,n)
175# Logical if: like make's $(if) but with an leqv-like test
176lif = $(if $(subst n,,$1),$2,$3)
177
Peter Maydell9ef622e2013-09-13 18:25:52 +0100178# String testing functions: inputs to these can be any string;
179# the output is always either "y" or "n". Leading and trailing whitespace
180# is ignored when comparing strings.
181# String equality
182eq = $(if $(subst $2,,$1)$(subst $1,,$2),n,y)
183# String inequality
184ne = $(if $(subst $2,,$1)$(subst $1,,$2),y,n)
185# Emptiness/non-emptiness tests:
186isempty = $(if $1,n,y)
187notempty = $(if $1,y,n)
188
Lluís Vilanovac0424932012-04-18 20:15:45 +0200189# Generate files with tracetool
190TRACETOOL=$(PYTHON) $(SRC_PATH)/scripts/tracetool.py
191
Juan Quintela1215c6e2009-10-07 02:40:58 +0200192# Generate timestamp files for .h include files
193
Michael S. Tsirkin4b259662013-01-15 13:12:35 +0200194config-%.h: config-%.h-timestamp
195 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
Juan Quintela1215c6e2009-10-07 02:40:58 +0200196
Paolo Bonzini55335012016-06-07 13:25:24 +0200197config-%.h-timestamp: config-%.mak $(SRC_PATH)/scripts/create_config
Peter Maydell0bdb12c2016-10-04 17:27:21 +0100198 $(call quiet-command, sh $(SRC_PATH)/scripts/create_config < $< > $@,"GEN","$(TARGET_DIR)config-$*.h")
Michael S. Tsirkin7dbbbb02009-12-07 21:04:52 +0200199
Michael S. Tsirkin75863172013-01-15 13:27:54 +0200200.PHONY: clean-timestamp
201clean-timestamp:
202 rm -f *.timestamp
203clean: clean-timestamp
204
Michael S. Tsirkin7dbbbb02009-12-07 21:04:52 +0200205# will delete the target of a rule if commands exit with a nonzero exit status
206.DELETE_ON_ERROR:
Paolo Bonzinie05804e2012-05-22 13:41:27 +0200207
Fam Zheng1c33ac52014-05-27 15:54:19 +0800208# save-vars
209# Usage: $(call save-vars, vars)
210# Save each variable $v in $vars as save-vars-$v, save their object's
Paolo Bonzini5ffb3502016-11-02 16:10:23 +0100211# variables, then clear $v. saved-vars-$v contains the variables that
212# where saved for the objects, in order to speedup load-vars.
Fam Zheng1c33ac52014-05-27 15:54:19 +0800213define save-vars
214 $(foreach v,$1,
215 $(eval save-vars-$v := $(value $v))
Paolo Bonzini5ffb3502016-11-02 16:10:23 +0100216 $(eval saved-vars-$v := $(foreach o,$($v), \
217 $(if $($o-cflags), $o-cflags $(eval save-vars-$o-cflags := $($o-cflags))$(eval $o-cflags := )) \
218 $(if $($o-libs), $o-libs $(eval save-vars-$o-libs := $($o-libs))$(eval $o-libs := )) \
219 $(if $($o-objs), $o-objs $(eval save-vars-$o-objs := $($o-objs))$(eval $o-objs := ))))
Fam Zheng1c33ac52014-05-27 15:54:19 +0800220 $(eval $v := ))
Paolo Bonzinie05804e2012-05-22 13:41:27 +0200221endef
222
Fam Zheng1c33ac52014-05-27 15:54:19 +0800223# load-vars
224# Usage: $(call load-vars, vars, add_var)
225# Load the saved value for each variable in @vars, and the per object
226# variables.
227# Append @add_var's current value to the loaded value.
228define load-vars
229 $(eval $2-new-value := $(value $2))
230 $(foreach v,$1,
231 $(eval $v := $(value save-vars-$v))
Paolo Bonzini5ffb3502016-11-02 16:10:23 +0100232 $(foreach o,$(saved-vars-$v),
233 $(eval $o := $(save-vars-$o)) $(eval save-vars-$o := ))
234 $(eval save-vars-$v := )
235 $(eval saved-vars-$v := ))
Fam Zheng1c33ac52014-05-27 15:54:19 +0800236 $(eval $2 := $(value $2) $($2-new-value))
Paolo Bonzinie05804e2012-05-22 13:41:27 +0200237endef
238
Fam Zheng1c33ac52014-05-27 15:54:19 +0800239# fix-paths
240# Usage: $(call fix-paths, obj_path, src_path, vars)
241# Add prefix @obj_path to all objects in @vars, and add prefix @src_path to all
242# directories in @vars.
243define fix-paths
244 $(foreach v,$3,
245 $(foreach o,$($v),
246 $(if $($o-libs),
247 $(eval $1$o-libs := $($o-libs)))
248 $(if $($o-cflags),
249 $(eval $1$o-cflags := $($o-cflags)))
250 $(if $($o-objs),
251 $(eval $1$o-objs := $(addprefix $1,$($o-objs)))))
252 $(eval $v := $(addprefix $1,$(filter-out %/,$($v))) \
253 $(addprefix $2,$(filter %/,$($v)))))
Fam Zheng5c0d52b2014-02-10 14:48:53 +0800254endef
255
Fam Zheng1c33ac52014-05-27 15:54:19 +0800256# unnest-var-recursive
257# Usage: $(call unnest-var-recursive, obj_prefix, vars, var)
258#
259# Unnest @var by including subdir Makefile.objs, while protect others in @vars
260# unchanged.
261#
262# @obj_prefix is the starting point of object path prefix.
263#
264define unnest-var-recursive
265 $(eval dirs := $(sort $(filter %/,$($3))))
266 $(eval $3 := $(filter-out %/,$($3)))
267 $(foreach d,$(dirs:%/=%),
268 $(call save-vars,$2)
269 $(eval obj := $(if $1,$1/)$d)
270 $(eval -include $(SRC_PATH)/$d/Makefile.objs)
271 $(call fix-paths,$(if $1,$1/)$d/,$d/,$2)
272 $(call load-vars,$2,$3)
273 $(call unnest-var-recursive,$1,$2,$3))
Paolo Bonzinie05804e2012-05-22 13:41:27 +0200274endef
275
Fam Zheng1c33ac52014-05-27 15:54:19 +0800276# unnest-vars
277# Usage: $(call unnest-vars, obj_prefix, vars)
278#
279# @obj_prefix: object path prefix, can be empty, or '..', etc. Don't include
280# ending '/'.
281#
282# @vars: the list of variable names to unnest.
283#
284# This macro will scan subdirectories's Makefile.objs, include them, to build
285# up each variable listed in @vars.
286#
287# Per object and per module cflags and libs are saved with relative path fixed
288# as well, those variables include -libs, -cflags and -objs. Items in -objs are
289# also fixed to relative path against SRC_PATH plus the prefix @obj_prefix.
290#
291# All nested variables postfixed by -m in names are treated as DSO variables,
292# and will be built as modules, if enabled.
293#
294# A simple example of the unnest:
295#
296# obj_prefix = ..
297# vars = hot cold
298# hot = fire.o sun.o season/
299# cold = snow.o water/ season/
300#
301# Unnest through a faked source directory structure:
302#
303# SRC_PATH
304# ├── water
305# │ └── Makefile.objs──────────────────┐
306# │ │ hot += steam.o │
307# │ │ cold += ice.mo │
308# │ │ ice.mo-libs := -licemaker │
309# │ │ ice.mo-objs := ice1.o ice2.o │
310# │ └──────────────────────────────┘
311# │
312# └── season
313# └── Makefile.objs──────┐
314# │ hot += summer.o │
315# │ cold += winter.o │
316# └──────────────────┘
317#
318# In the end, the result will be:
319#
320# hot = ../fire.o ../sun.o ../season/summer.o
321# cold = ../snow.o ../water/ice.mo ../season/winter.o
322# ../water/ice.mo-libs = -licemaker
323# ../water/ice.mo-objs = ../water/ice1.o ../water/ice2.o
324#
325# Note that 'hot' didn't include 'season/' in the input, so 'summer.o' is not
326# included.
327#
Paolo Bonzinie05804e2012-05-22 13:41:27 +0200328define unnest-vars
Fam Zheng1c33ac52014-05-27 15:54:19 +0800329 # In the case of target build (i.e. $1 == ..), fix path for top level
330 # Makefile.objs objects
331 $(if $1,$(call fix-paths,$1/,,$2))
332
333 # Descend and include every subdir Makefile.objs
Fam Zhengc88f68e2015-01-12 12:43:09 +0800334 $(foreach v, $2,
335 $(call unnest-var-recursive,$1,$2,$v)
336 # Pass the .mo-cflags and .mo-libs along to its member objects
337 $(foreach o, $(filter %.mo,$($v)),
338 $(foreach p,$($o-objs),
339 $(if $($o-cflags), $(eval $p-cflags += $($o-cflags)))
340 $(if $($o-libs), $(eval $p-libs += $($o-libs))))))
341
342 # For all %.mo objects that are directly added into -y, just expand them
343 $(foreach v,$(filter %-y,$2),
344 $(eval $v := $(foreach o,$($v),$(if $($o-objs),$($o-objs),$o))))
Fam Zheng1c33ac52014-05-27 15:54:19 +0800345
346 $(foreach v,$(filter %-m,$2),
347 # All .o found in *-m variables are single object modules, create .mo
348 # for them
349 $(foreach o,$(filter %.o,$($v)),
350 $(eval $(o:%.o=%.mo)-objs := $o))
351 # Now unify .o in -m variable to .mo
352 $(eval $v := $($v:%.o=%.mo))
353 $(eval modules-m += $($v))
354
355 # For module build, build shared libraries during "make modules"
356 # For non-module build, add -m to -y
357 $(if $(CONFIG_MODULES),
Fam Zhengc261d772014-09-01 18:35:10 +0800358 $(foreach o,$($v),
Fam Zhengd24697e2015-05-07 14:55:15 +0800359 $(eval $($o-objs): CFLAGS += $(DSO_OBJ_CFLAGS))
Fam Zhengc261d772014-09-01 18:35:10 +0800360 $(eval $o: $($o-objs)))
361 $(eval $(patsubst %-m,%-y,$v) += $($v))
Fam Zheng1c33ac52014-05-27 15:54:19 +0800362 $(eval modules: $($v:%.mo=%$(DSOSUF))),
363 $(eval $(patsubst %-m,%-y,$v) += $(call expand-objs, $($v)))))
364
365 # Post-process all the unnested vars
366 $(foreach v,$2,
367 $(foreach o, $(filter %.mo,$($v)),
368 # Find all the .mo objects in variables and add dependency rules
369 # according to .mo-objs. Report error if not set
370 $(if $($o-objs),
371 $(eval $(o:%.mo=%$(DSOSUF)): module-common.o $($o-objs)),
Fam Zhengc88f68e2015-01-12 12:43:09 +0800372 $(error $o added in $v but $o-objs is not set)))
Fam Zheng1c33ac52014-05-27 15:54:19 +0800373 $(shell mkdir -p ./ $(sort $(dir $($v))))
374 # Include all the .d files
Victor Kaplansky27fa7472015-08-09 12:39:59 +0300375 $(eval -include $(patsubst %.o,%.d,$(patsubst %.mo,%.d,$($v))))
Fam Zheng1c33ac52014-05-27 15:54:19 +0800376 $(eval $v := $(filter-out %/,$($v))))
Paolo Bonzinie05804e2012-05-22 13:41:27 +0200377endef
Marc-André Lureau76480422017-01-13 15:41:33 +0100378
379TEXI2MAN = $(call quiet-command, \
Paolo Bonzinid59157e2017-06-06 16:55:19 +0200380 perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $(TEXI2PODFLAGS) $< $@.pod && \
Marc-André Lureau76480422017-01-13 15:41:33 +0100381 $(POD2MAN) --section=$(subst .,,$(suffix $@)) --center=" " --release=" " $@.pod > $@, \
382 "GEN","$@")
383
384%.1:
385 $(call TEXI2MAN)
Marc-André Lureau56e8bdd2017-01-13 15:41:35 +0100386%.7:
387 $(call TEXI2MAN)
Marc-André Lureau76480422017-01-13 15:41:33 +0100388%.8:
389 $(call TEXI2MAN)