Proper ordering of Makefiles

Change-Id: I44faa72d5fb77d93898283add52ef1debc2f6823
This commit is contained in:
Romain Goyet
2016-11-11 18:19:03 +01:00
parent 5d9a3c2c92
commit 6248a63b29
6 changed files with 20 additions and 15 deletions

View File

@@ -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)

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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)