minor QoL improvements to bdfconv build

This commit is contained in:
Dan Egnor
2025-10-09 10:46:29 -07:00
parent e496b9971b
commit e048fe1f87
4 changed files with 21 additions and 6 deletions

3
.gitignore vendored
View File

@@ -1,2 +1,3 @@
*.o
*.~
*.s
*.~

1
tools/font/bdfconv/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
bdfconv

View File

@@ -1,9 +1,17 @@
# works within ubuntu and min-gw (win7) environment
# win7 exe uploaded on google drive
# requires gcc, eg. on Ubuntu "sudo apt install build-essential"
CC = gcc
CFLAGS = -g -Wall
#CFLAGS = -O4 -Wall
CFLAGS = -O4 -Wall -Werror
# for debugging ("make clean" after switching)
#CFLAGS = -g -Wall -Werror
# more portable statically linked linux binary ("make clean" after switching)
# requires musl-gcc, eg. on Ubuntu "sudo apt install musl-dev"
#CC = x86_64-linux-musl-gcc
#LDFLAGS = -static
SRC = main.c bdf_font.c bdf_glyph.c bdf_parser.c bdf_map.c bdf_rle.c bdf_tga.c fd.c bdf_8x8.c bdf_kern.c
@@ -13,11 +21,13 @@ ASM = $(SRC:.c=.s)
.c.s:
$(CC) $(CFLAGS) -S -o $@ $<
bdfconv: $(OBJ) $(ASM)
bdfconv: $(OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJ) -o bdfconv
asm: $(ASM)
clean:
-rm $(OBJ) $(ASM) bdfconv
$(RM) *.o *.s bdfconv
test: bdfconv
./bdfconv

View File

@@ -313,7 +313,10 @@ int bf_MapFile(bf_t *bf, const char *map_file_name)
s = malloc(buf.st_size+1);
if ( s == NULL )
return 0;
fread(s, buf.st_size, 1, fp);
if ( fread(s, buf.st_size, 1, fp) != 1 ) {
free(s);
return 0;
}
s[buf.st_size] = '\0';
fclose(fp);
bf_Map(bf, s);