blob: 967a08d4f825ddf47f172d087f9a3fa2e9c05470 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# Common build variables and functions for GlaMaC
# This file contains shared configuration used by all build modules
# Linux-only build configuration
PLATFORM := linux
EXE_EXT :=
MKDIR := mkdir -p
RM := rm -f
RMDIR := rm -rf
CC := gcc
SDL3_LIBS := $(shell pkg-config --libs sdl3 SDL3_ttf 2>/dev/null || echo -lSDL3 -lSDL3_ttf) -lm
# Directories (relative to project root)
SRCDIR := ../src
BINDIR := ../bin
INCDIR := ../include
# Base flags
CFLAGS_BASE := -I$(INCDIR) -O2 -flto
# Security and warning flags
SECURITY_FLAGS := -fstack-protector-strong -D_FORTIFY_SOURCE=2 -fPIE
WARNING_FLAGS := -Wall -Wextra -Wformat=2 -Wformat-security -Wnull-dereference -Wstack-protector -Wvla
# Compiler flags
CFLAGS := $(CFLAGS_BASE) $(SECURITY_FLAGS) $(WARNING_FLAGS) -march=native
# Source files
GLAMAC_SRCS := $(wildcard $(SRCDIR)/glamac/*.c)
GLAUTILS_SRCS := $(wildcard $(SRCDIR)/glautils/*.c)
GLAUTILS_BINS := $(patsubst $(SRCDIR)/glautils/%.c, $(BINDIR)/%, $(GLAUTILS_SRCS))
# Glass data dependencies for fgla
GLASS_DATA_SRCS := $(SRCDIR)/glamac/glass_data.c $(SRCDIR)/glamac/glamac_errors.c
# Common directory creation rules
$(BINDIR):
$(MKDIR) $(BINDIR)
|