[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,19 +1,23 @@
SFLAGS += -Ikandinsky/include
objs += $(addprefix kandinsky/src/,\
color.o\
context.o\
context_line.o\
context_pixel.o\
context_rect.o\
context_text.o\
font.o\
font_large.o\
font_small.o\
framebuffer.o\
framebuffer_context.o\
ion_context.o\
point.o\
rect.o\
src += $(addprefix kandinsky/src/,\
color.cpp \
context.cpp \
context_line.cpp \
context_pixel.cpp \
context_rect.cpp \
context_text.cpp \
font.cpp \
framebuffer.cpp \
framebuffer_context.cpp \
ion_context.cpp \
point.cpp \
rect.cpp \
)
src += $(addprefix kandinsky/fonts/, \
LargeSourcePixel.ttf \
SmallSourcePixel.ttf \
)
tests += $(addprefix kandinsky/test/,\
@@ -21,14 +25,6 @@ tests += $(addprefix kandinsky/test/,\
rect.cpp\
)
FREETYPE_PATH := /usr/local/Cellar/freetype/2.6.3
# LIBPNG_PATH is optional. If LIBPNG_PATH is not defined, rasterizer will be
# built w/o PNG support and simply won't output an image of the rasterization
#LIBPNG_PATH := /usr/local/Cellar/libpng/1.6.21
small_font_files = $(addprefix kandinsky/src/, font_small.cpp)
large_font_files = $(addprefix kandinsky/src/, font_large.cpp)
RASTERIZER_CFLAGS := -std=c99 `pkg-config freetype2 --cflags`
RASTERIZER_LDFLAGS := `pkg-config freetype2 --libs`
@@ -38,20 +34,25 @@ ifdef LIBPNG_PATH
RASTERIZER_CFLAGS += -I$(LIBPNG_PATH)/include -DGENERATE_PNG=1 -L$(LIBPNG_PATH)/lib -lpng
endif
# Even though raster will generate both .c and .h files, we don't declare it as
# such to make. If we did, "make -jN" with N>1 may call "raster" twice.
$(eval $(call rule_for, \
HOSTCC, \
kandinsky/fonts/rasterizer, \
kandinsky/fonts/rasterizer.c kandinsky/fonts/unicode_for_symbol.c $(addprefix ion/src/external/lz4/, lz4.c lz4hc.c), \
$$(HOSTCC) $$(RASTERIZER_CFLAGS) $$^ $$(RASTERIZER_LDFLAGS) -o $$@ \
))
kandinsky/src/font_small.cpp: kandinsky/fonts/rasterizer
@echo "RASTER $(small_font_files)"
$(Q) $< kandinsky/fonts/SmallSourcePixel.ttf 12 12 SmallFont $(small_font_files)
RASTERIZER := $(OUTPUT_DIRECTORY)/kandinsky/fonts/rasterizer
kandinsky/src/font_large.cpp: kandinsky/fonts/rasterizer
@echo "RASTER $(large_font_files)"
$(Q) $< kandinsky/fonts/LargeSourcePixel.ttf 16 16 LargeFont $(large_font_files)
kandinsky/fonts/rasterizer: kandinsky/fonts/rasterizer.c kandinsky/fonts/unicode_for_symbol.c $(addprefix ion/src/external/lz4/, lz4.c lz4hc.c)
@echo "HOSTCC $@"
$(Q) $(HOSTCC) $(RASTERIZER_CFLAGS) $^ $(RASTERIZER_LDFLAGS) -o $@
products += $(small_font_files) $(large_font_files) kandinsky/fonts/rasterizer
$(eval $(call rule_for, \
RASTER, \
kandinsky/fonts/SmallSourcePixel.cpp, \
kandinsky/fonts/SmallSourcePixel.ttf $$(RASTERIZER), \
$$(RASTERIZER) $$< 12 12 SmallFont $$@ \
))
$(eval $(call rule_for, \
RASTER, \
kandinsky/fonts/LargeSourcePixel.cpp, \
kandinsky/fonts/LargeSourcePixel.ttf $$(RASTERIZER), \
$$(RASTERIZER) $$< 16 16 LargeFont $$@ \
))