qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PULL 6/8] rules.mak: Rewrite unnest-vars


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PULL 6/8] rules.mak: Rewrite unnest-vars
Date: Tue, 10 Jun 2014 12:40:11 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

Il 10/06/2014 07:56, Paolo Bonzini ha scritto:
> +    $(foreach v,$(filter %-m,$2),
> +        # All .o found in *-m variables are single object modules, create .mo
> +        # for them
> +        $(foreach o,$(filter %.o,$($v)),
> +            $(eval $(o:%.o=%.mo)-objs := $o))
> +        # Now unify .o in -m variable to .mo
> +        $(eval $v := $($v:%.o=%.mo))
> +
> +        $(eval modules: $($v:%.mo=%$(DSOSUF)))
> +        $(eval modules-m += $($v))
> +
> +        # For non-module build, add -m to -y
> +        $(if $(CONFIG_MODULES),,$(eval $(patsubst %-m,%-y,$v) += $($v))))

Peter spotted a few problems here.  This needs to be

+        $(if $(CONFIG_MODULES),
+             $(eval modules: $($v:%.mo=%$(DSOSUF)))
+             $(eval $(patsubst %-m,%-y,$v) += $(call expand-objs, $($v)))))

There are two changes:

1) You must not build modules if they are disabled

2) Because the .mo file has no dependencies, you need expand-objs.  (In
fact we should just stop using .mo files except as an artificial construct
in Makefile.objs).

> +
> +    # Post-process all the unnested vars
> +    $(foreach v,$2,
> +        $(foreach o, $(filter %.mo,$($v)),
> +            # Find all the .mo objects in variables and add dependency rules
> +            # according to .mo-objs. Report error if not set
> +            $(if $($o-objs),
> +                $(eval $(o:%.mo=%$(DSOSUF)): $($o-objs)),
> +                $(error $o added in $v but $o-objs is not set))
> +            # Pass the .mo-cflags along to member objects
> +            $(if $($o-cflags),
> +                $(foreach p,$($o-objs),
> +                    $(eval $p-cflags := $($o-cflags)))))

Finally, this should be a +=.

I'll send an updated pull request.

Paolo

> +        $(shell mkdir -p ./ $(sort $(dir $($v))))
> +        # Include all the .d files
> +        $(eval -include $(addsuffix *.d, $(sort $(dir $($v)))))
> +        $(eval $v := $(filter-out %/,$($v))))
>  endef
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]