diff --git a/Makefile b/Makefile index 13c884d3a..a7c3faf8a 100644 --- a/Makefile +++ b/Makefile @@ -66,8 +66,9 @@ endif include ion/Makefile include kandinsky/Makefile include poincare/Makefile +include escher/Makefile + include apps/Makefile -include escher/Makefile # Escher should be included after apps as it needs to know which images to inline include quiz/Makefile # Quiz should be included at the end dependencies = $(objs:.o=.d) @@ -108,4 +109,4 @@ dependencies = $(objs:.o=.d) .PHONY: clean clean: @echo "CLEAN" - @rm -f $(objs) $(test_objs) $(products) $(dependencies) + @rm -f $(objs) $(products) $(dependencies) diff --git a/apps/Makefile b/apps/Makefile index 391198b36..4e5077837 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -18,8 +18,15 @@ app_objs += $(addprefix apps/,\ variable_box_node.o\ ) -$(app_objs): $(inline_images:.png=.o) +# Tracking which source file uses which image is painful. But we need to ensure +# that a .png file has been inlined before building any source file that uses +# said image (because it will expect the ".h" file to be there). +# As a shortcut, we simply say that every app file depends on every image. In +# practice, this forces all the images to be before the app. -products += $(app_objs) app.elf app.hex app.bin +app_image_objs := $(app_images:.png=.o) +$(app_objs): $(app_image_objs) -app.$(EXE): $(app_objs) +products += $(app_objs) $(call INLINER_PRODUCTS,$(app_images)) app.elf app.hex app.bin + +app.$(EXE): $(app_objs) $(app_image_objs) diff --git a/apps/calculation/Makefile b/apps/calculation/Makefile index ea594bce1..9c5fab80f 100644 --- a/apps/calculation/Makefile +++ b/apps/calculation/Makefile @@ -11,5 +11,5 @@ app_objs += $(addprefix apps/calculation/,\ text_field.o\ ) -inline_images += apps/calculation/calculation_icon.png +app_images += apps/calculation/calculation_icon.png diff --git a/apps/graph/Makefile b/apps/graph/Makefile index c1f2d8210..048c657f9 100644 --- a/apps/graph/Makefile +++ b/apps/graph/Makefile @@ -21,4 +21,4 @@ app_objs += $(addprefix apps/graph/,\ values/values_parameter_controller.o\ ) -inline_images += apps/graph/graph_icon.png +app_images += apps/graph/graph_icon.png diff --git a/apps/probability/Makefile b/apps/probability/Makefile index 23c8b5b93..b6f20f439 100644 --- a/apps/probability/Makefile +++ b/apps/probability/Makefile @@ -4,4 +4,4 @@ app_objs += $(addprefix apps/probability/,\ parameters/parameters_controller.o\ ) -inline_images += apps/probability/probability_icon.png +app_images += apps/probability/probability_icon.png diff --git a/escher/Makefile b/escher/Makefile index 8338fde67..6ba63d174 100644 --- a/escher/Makefile +++ b/escher/Makefile @@ -52,13 +52,10 @@ $(INLINER): escher/image/inliner.c @echo "HOSTCC $@" @$(HOSTCC) -std=c99 `libpng-config --cflags` `libpng-config --ldflags` $< -o $@ -inline_image_headers := $(inline_images:.png=.h) -inline_image_sources := $(inline_images:.png=.cpp) -inline_image_objs := $(inline_images:.png=.o) - -$(inline_image_sources) : %.cpp : %.png $(INLINER) +%.h %.cpp : %.png $(INLINER) @echo "INLINER $@" @$(INLINER) $< -objs += $(inline_image_objs) -products += $(INLINER) $(inline_image_headers) $(inline_image_sources) +INLINER_PRODUCTS = $(1:.png=.h) $(1:.png=.cpp) $(1:.png=.o) + +products += $(INLINER)