# Makefile da library syntax (categoria "Sintaxe")
CC     := gcc
BUILD  := build

CFLAGS := -std=c11 -O2 -Wall -Wextra -pedantic -fvisibility=hidden \
          -D_POSIX_C_SOURCE=200809L -I../../include -Iinclude

OBJ    := $(BUILD)/tb_syntax.o
LIB_A  := $(BUILD)/libtinyblocks-syntax.a
LIB_SO := $(BUILD)/libtinyblocks-syntax.so

.PHONY: all static shared clean
all: static shared
static: $(LIB_A)
shared: $(LIB_SO)

$(OBJ): src/tb_syntax.c include/tb_syntax.h
	@mkdir -p $(BUILD)
	$(CC) $(CFLAGS) -fPIC -c $< -o $@

$(LIB_A): $(OBJ)
	ar rcs $@ $^

$(LIB_SO): $(OBJ)
	$(CC) -shared -o $@ $^

clean:
	$(RM) -r $(BUILD)
