[build] Use an out-of-tree build

This commit is contained in:
Romain Goyet
2019-03-05 17:13:47 +01:00
committed by LeaNumworks
parent a540bfa753
commit 4f1d74f44b
31 changed files with 1071 additions and 1047 deletions

View File

@@ -1,102 +1,118 @@
SFLAGS += -Iescher/include
objs += $(addprefix escher/src/,\
alternate_empty_view_controller.o\
app.o\
bank_view_controller.o\
buffer_text_view.o\
button.o\
button_row_controller.o\
chevron_view.o\
clipboard.o\
container.o\
editable_text_cell.o\
ellipsis_view.o\
expression_field.o\
even_odd_cell.o\
even_odd_cell_with_ellipsis.o\
even_odd_buffer_text_cell.o\
even_odd_editable_text_cell.o\
even_odd_expression_cell.o\
even_odd_message_text_cell.o\
expression_table_cell.o\
expression_table_cell_with_pointer.o\
expression_table_cell_with_expression.o\
expression_view.o\
highlight_cell.o\
gauge_view.o\
image_view.o\
input_event_handler.o\
invocation.o\
input_view_controller.o\
key_view.o\
layout_field.o\
list_view_data_source.o\
message_table_cell.o\
message_table_cell_with_buffer.o\
message_table_cell_with_chevron.o\
message_table_cell_with_chevron_and_message.o\
message_table_cell_with_chevron_and_expression.o\
message_table_cell_with_editable_text.o\
message_table_cell_with_expression.o\
message_table_cell_with_gauge.o\
message_table_cell_with_message.o\
message_table_cell_with_switch.o\
message_text_view.o\
message_tree.o\
modal_view_controller.o\
nested_menu_controller.o\
palette.o\
pointer_text_view.o\
responder.o\
run_loop.o\
scroll_view.o\
scroll_view_data_source.o\
scroll_view_indicator.o\
scrollable_view.o\
selectable_table_view.o\
selectable_table_view_data_source.o\
selectable_table_view_delegate.o\
simple_list_view_data_source.o\
simple_table_view_data_source.o\
solid_color_view.o\
solid_text_area.o\
stack_view.o\
stack_view_controller.o\
switch_view.o\
tab_view.o\
tab_view_cell.o\
tab_view_controller.o\
tab_view_data_source.o\
table_cell.o\
table_view.o\
table_view_data_source.o\
text_cursor_view.o\
text_area.o\
text_field.o\
text_input.o\
text_input_helpers.o\
text_view.o\
tiled_view.o\
timer.o\
toolbox.o\
transparent_view.o\
view.o\
view_controller.o\
warning_controller.o\
window.o\
src += $(addprefix escher/src/,\
alternate_empty_view_controller.cpp \
app.cpp \
bank_view_controller.cpp \
buffer_text_view.cpp \
button.cpp \
button_row_controller.cpp \
chevron_view.cpp \
clipboard.cpp \
container.cpp \
editable_text_cell.cpp \
ellipsis_view.cpp \
expression_field.cpp \
even_odd_cell.cpp \
even_odd_cell_with_ellipsis.cpp \
even_odd_buffer_text_cell.cpp \
even_odd_editable_text_cell.cpp \
even_odd_expression_cell.cpp \
even_odd_message_text_cell.cpp \
expression_table_cell.cpp \
expression_table_cell_with_pointer.cpp \
expression_table_cell_with_expression.cpp \
expression_view.cpp \
highlight_cell.cpp \
gauge_view.cpp \
image_view.cpp \
input_event_handler.cpp \
invocation.cpp \
input_view_controller.cpp \
key_view.cpp \
layout_field.cpp \
list_view_data_source.cpp \
message_table_cell.cpp \
message_table_cell_with_buffer.cpp \
message_table_cell_with_chevron.cpp \
message_table_cell_with_chevron_and_message.cpp \
message_table_cell_with_chevron_and_expression.cpp \
message_table_cell_with_editable_text.cpp \
message_table_cell_with_expression.cpp \
message_table_cell_with_gauge.cpp \
message_table_cell_with_message.cpp \
message_table_cell_with_switch.cpp \
message_text_view.cpp \
message_tree.cpp \
modal_view_controller.cpp \
nested_menu_controller.cpp \
palette.cpp \
pointer_text_view.cpp \
responder.cpp \
run_loop.cpp \
scroll_view.cpp \
scroll_view_data_source.cpp \
scroll_view_indicator.cpp \
scrollable_view.cpp \
selectable_table_view.cpp \
selectable_table_view_data_source.cpp \
selectable_table_view_delegate.cpp \
simple_list_view_data_source.cpp \
simple_table_view_data_source.cpp \
solid_color_view.cpp \
solid_text_area.cpp \
stack_view.cpp \
stack_view_controller.cpp \
switch_view.cpp \
tab_view.cpp \
tab_view_cell.cpp \
tab_view_controller.cpp \
tab_view_data_source.cpp \
table_cell.cpp \
table_view.cpp \
table_view_data_source.cpp \
text_cursor_view.cpp \
text_area.cpp \
text_field.cpp \
text_input.cpp \
text_input_helpers.cpp \
text_view.cpp \
tiled_view.cpp \
timer.cpp \
toolbox.cpp \
transparent_view.cpp \
view.cpp \
view_controller.cpp \
warning_controller.cpp \
window.cpp \
)
INLINER := escher/image/inliner
$(INLINER): escher/image/inliner.c $(addprefix ion/src/external/lz4/, lz4.c lz4hc.c)
@echo "HOSTCC $@"
$(Q) $(HOSTCC) -std=c99 `libpng-config --cflags` $^ `libpng-config --ldflags` -o $@
$(eval $(call rule_for, \
HOSTCC, \
escher/image/inliner, \
escher/image/inliner.c $(addprefix ion/src/external/lz4/, lz4.c lz4hc.c), \
$$(HOSTCC) -std=c99 `libpng-config --cflags` $$^ `libpng-config --ldflags` -o $$@ \
))
%.h %.cpp : %.png $(INLINER)
@echo "INLINER $@"
$(Q) $(INLINER) $<
INLINER := $(OUTPUT_DIRECTORY)/escher/image/inliner
INLINER_PRODUCTS = $(1:.png=.h) $(1:.png=.cpp) $(1:.png=.o)
.PRECIOUS: $(OUTPUT_DIRECTORY)/%.h $(OUTPUT_DIRECTORY)/%.cpp
$(eval $(call rule_for, \
INLINER, \
%.h %.cpp, \
%.png $$(INLINER), \
$$(INLINER) $$< $$(basename $$@).h $$(basename $$@).cpp \
))
products += $(INLINER)
# Mark a .cpp file as depending on a .png one
# This is called with $1 = code.cpp and $2 = image.png
# First, we mark code.o as requiring image.o. Rules will take care of inlining
# the PNG and building the inlined cpp file. Second, we add the directory
# corresponding to the one of code.cpp in the output dir as a header search
# path. Since $1 can be a list, we have to map with foreach.
define depends_on_image
$(call object_for,$(1)): $(call object_for,$(2))
$(call object_for,$(1)): SFLAGS += $(foreach d,$(sort $(dir $(call object_for,$(1)))),-I$(d))
src += $(2)
endef