[OpenWrt-Devel] [PATCH v4] build: refactor JSON info files to `profiles.json`

Paul Spooren mail at aparcar.org
Sun Mar 8 03:55:24 EDT 2020


On Sat Mar 7, 2020 at 1:34 AM PST, Petr Štetiar wrote:
> Paul Spooren <mail at aparcar.org> [2020-03-05 12:26:03]:
>
> Hi,
>
> > +json_overview_image_info: FORCE
> > +	WORK_DIR=$(BUILD_DIR)/json_info_files \
> > +		TARGET_DIR=$(BIN_DIR) \
> > +		$(SCRIPT_DIR)/json_overview_image_info.py
>
> it was suggested on IRC to not confuse Make by populating the
> rule/target in
> Python, something like this was suggested, it applies here as well.

I tried something like the following but it looks odd, can you give me
an advise on this please?

+$(BIN_DIR)/profiles.json: FORCE
+       WORK_DIR=$(BUILD_DIR)/json_info_files \
+               $(SCRIPT_DIR)/json_overview_image_info.py $@
+


>
> $(SCRIPT_DIR)/json_overview_image_info.py $$@
>
> IIRC `foo.py > $$@` wasn't recommended due to the need of 0 byte length
> file
> handling.
>
> >    $(BIN_DIR)/$(call IMAGE_NAME,$(1),$(2)): $(KDIR)/tmp/$(call IMAGE_NAME,$(1),$(2))
> > -	cp $$^ $$@
> > -	$(if $(CONFIG_JSON_ADD_IMAGE_INFO), \
> > +	[ -f $$^ ] && cp $$^ $$@ || true
>
> This was explained in the previous review step.

I added the following at it works as excepted. However it appears badly
implemented that the JSON subtarget is called and only then the
conditional if checked.

-  $$(_TARGET): $(BIN_DIR)/$(call IMAGE_NAME,$(1),$(2))$$(GZ_SUFFIX)
+  $$(_TARGET): $(BIN_DIR)/$(call IMAGE_NAME,$(1),$(2))$$(GZ_SUFFIX) \
+       $(BUILD_DIR)/json_info_files/$(call IMAGE_NAME,$(1),$(2)).json

+  $(BUILD_DIR)/json_info_files/$(call IMAGE_NAME,$(1),$(2)).json: $(KDIR)/tmp/$(call IMAGE_NAME,$(1),$(2))
+       $(if $(CONFIG_JSON_OVERVIEW_IMAGE_INFO), \

> > +	$(if $(CONFIG_JSON_OVERVIEW_IMAGE_INFO), \
>
> You got already same hint from me via email and from Jo on IRC, this
> should be
> turned into separate Make rule.

Thanks for your patience!

Best,
Paul


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list