Files
T
mguinhosandClaude Opus 5.5 bf6c59f80e Libraries compiladas com -O2
Os Makefiles das libraries não passavam -O: tudo menos o core
(editor, operators, number, variables, vector, graphics...) saía em
-O0, inclusive no AppImage. Agora todas usam -O2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 17:08:05 -03:00

44 lines
1.3 KiB
Makefile

# Makefile da library jpg (categoria "JPG"); depende de libjpeg.
# Como os headers de desenvolvimento podem nao estar instalados, o build e'
# condicional: sem <jpeglib.h> a library e' apenas ignorada.
CC := gcc
BUILD := build
JPEG_CFLAGS := $(shell pkg-config --cflags libjpeg 2>/dev/null)
JPEG_LIBS := $(shell pkg-config --libs libjpeg 2>/dev/null)
JPEG_HAVE := $(shell printf '\#include <jpeglib.h>\nint main(void){return 0;}\n' | \
$(CC) -xc - -o /dev/null $(JPEG_CFLAGS) $(JPEG_LIBS) -ljpeg >/dev/null 2>&1 && echo yes)
CFLAGS := -std=c11 -O2 -Wall -Wextra -pedantic -fvisibility=hidden \
-D_POSIX_C_SOURCE=200809L -I../../include -Iinclude $(JPEG_CFLAGS)
OBJ := $(BUILD)/tb_jpg.o
LIB_A := $(BUILD)/libtinyblocks-jpg.a
LIB_SO := $(BUILD)/libtinyblocks-jpg.so
ifeq ($(JPEG_HAVE),yes)
.PHONY: all static shared clean
all: static shared
static: $(LIB_A)
shared: $(LIB_SO)
$(OBJ): src/tb_jpg.c include/tb_jpg.h
@mkdir -p $(BUILD)
$(CC) $(CFLAGS) -fPIC -c $< -o $@
$(LIB_A): $(OBJ)
ar rcs $@ $^
$(LIB_SO): $(OBJ)
$(CC) -shared -o $@ $^ $(JPEG_LIBS) -ljpeg
clean:
$(RM) -r $(BUILD)
else
.PHONY: all static shared clean
all static shared:
@echo "tinyblocks-jpg: <jpeglib.h> ausente (instale libjpeg-dev/libjpeg-turbo8-dev) - pulando"
clean:
$(RM) -r $(BUILD)
endif