move all the build tools to utils

move the source and make rules of the convert image and font tools
 to the utils directory. This puts all the rules for build tools together.
This commit is contained in:
Vincent Sanders 2020-06-22 10:06:35 +01:00
parent a27f5d32cd
commit 54e06e7d58
4 changed files with 40 additions and 32 deletions

View File

@ -122,27 +122,10 @@ FB_IMAGE_throbber6 := throbber/throbber6.png
FB_IMAGE_throbber7 := throbber/throbber7.png
FB_IMAGE_throbber8 := throbber/throbber8.png
# local compiler flags
ifeq ($(HOST),OpenBSD)
BUILD_CFLAGS += $(shell $(PKG_CONFIG) --cflags libpng)
BUILD_LDFLAGS += $(shell $(PKG_CONFIG) --libs libpng)
else
ifeq ($(HOST),FreeBSD)
BUILD_CFLAGS += $(shell $(PKG_CONFIG) --cflags libpng)
BUILD_LDFLAGS += $(shell $(PKG_CONFIG) --libs libpng)
else
BUILD_CFLAGS +=
BUILD_LDFLAGS += -lpng
endif
endif
# Host tool to convert image bitmaps to source code.
#
# convert_image dependd on fb_bitmap.h so that if we change that
# make convert_image depend on fbtk.h so that if we change that
# header, we get new images built.
$(TOOLROOT)/convert_image: $(TOOLROOT)/created $(FRONTEND_SOURCE_DIR)/convert_image.c $(FRONTEND_SOURCE_DIR)/fbtk.h
$(VQ)echo "BUILD CC: $@"
$(Q)$(BUILD_CC) $(BUILD_CFLAGS) -o $@ $(FRONTEND_SOURCE_DIR)/convert_image.c $(BUILD_LDFLAGS)
$(TOOLROOT)/convert_image: $(FRONTEND_SOURCE_DIR)/fbtk.h
# 1: input file
# 2: output file
@ -164,11 +147,6 @@ $(eval $(foreach V,$(filter FB_IMAGE_%,$(.VARIABLES)),$(call convert_image,$(FRO
# Internal fonts to generate
FB_FONT_internal_ns-sans := fonts/glyph_data
# Internal font conversion
$(TOOLROOT)/convert_font: $(TOOLROOT)/created $(FRONTEND_SOURCE_DIR)/convert_font.c
$(VQ)echo "BUILD CC: $@"
$(Q)$(BUILD_CC) -o $@ $(FRONTEND_SOURCE_DIR)/convert_font.c
# 1: input file
# 2: output source code file
# 3: output header file

View File

@ -25,14 +25,44 @@ S_UTILS := \
S_UTILS := $(addprefix utils/,$(S_UTILS))
# Host tool to convert file to comiled data
# lib png build compiler flags
ifeq ($(HOST),OpenBSD)
BUILD_LIBPNG_CFLAGS += $(shell $(PKG_CONFIG) --cflags libpng)
BUILD_LIBPNG_LDFLAGS += $(shell $(PKG_CONFIG) --libs libpng)
else
ifeq ($(HOST),FreeBSD)
BUILD_LIBPNG_CFLAGS += $(shell $(PKG_CONFIG) --cflags libpng)
BUILD_LIBPNG_LDFLAGS += $(shell $(PKG_CONFIG) --libs libpng)
else
BUILD_LIBPNG_CFLAGS +=
BUILD_LIBPNG_LDFLAGS += -lpng
endif
endif
# Build tool to convert file to comiled data
#
$(TOOLROOT)/xxd: utils/xxd.c $(TOOLROOT)/created
$(VQ)echo "BUILD CC: $@"
$(Q)$(BUILD_CC) $(BUILD_CFLAGS) -o $@ $< $(BUILD_LDFLAGS)
# Host tool to convert file to comiled data
# Build tool to filter messages
#
$(TOOLROOT)/split-messages: utils/split-messages.c $(TOOLROOT)/created
$(VQ)echo "BUILD CC: $@"
$(Q)$(BUILD_CC) $(BUILD_CFLAGS) -o $@ $< $(BUILD_LDFLAGS) -lz
# Build tool to convert image bitmaps to source code.
#
$(TOOLROOT)/convert_image: utils/convert_image.c $(TOOLROOT)/created
$(VQ)echo "BUILD CC: $@"
$(Q)$(BUILD_CC) $(BUILD_CFLAGS) $(BUILD_LIBPNG_CFLAGS) -o $@ $< $(BUILD_LDFLAGS) $(BUILD_LIBPNG_LDFLAGS)
# Build too to perform font conversion
$(TOOLROOT)/convert_font: utils/convert_font.c $(TOOLROOT)/created
$(VQ)echo "BUILD CC: $@"
$(Q)$(BUILD_CC) $(BUILD_CFLAGS) -o $@ $<

View File

@ -271,7 +271,7 @@ struct font_data {
int glyphs;
};
bool generate_font_header(const char *path, struct font_data *data)
static bool generate_font_header(const char *path, struct font_data *data)
{
FILE *fp;
int s;
@ -307,7 +307,7 @@ bool generate_font_header(const char *path, struct font_data *data)
}
bool generate_font_source(const char *path, struct font_data *data)
static bool generate_font_source(const char *path, struct font_data *data)
{
int s, i, y;
int limit;
@ -624,7 +624,7 @@ uint8_t frag[16][5] = {
THREE_S__ }
};
void build_codepoint(int id, bool italic, uint8_t *code_point)
static void build_codepoint(int id, bool italic, uint8_t *code_point)
{
int shift = 0;
int l;
@ -1002,7 +1002,7 @@ static bool parse_chunk(struct parse_context *ctx, const char *buf, size_t len,
}
bool load_font(const char *path, struct font_data **data)
static bool load_font(const char *path, struct font_data **data)
{
struct parse_context ctx;
struct font_data *d;
@ -1033,7 +1033,7 @@ bool load_font(const char *path, struct font_data **data)
/* Find filesize */
fseek(fp, 0L, SEEK_END);
file_len = ftell(fp);
if (file_len == -1) {
if ((long)file_len == -1) {
LOG(LOG_ERROR, "Could not size input file\n");
free(d);
fclose(fp);