| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- SRCS=$(shell find ./src -name '*.c' -type f)
- DEPS=$(patsubst %.c, %.d, ${SRCS})
- HDRS=$(shell find ./src -name '*.h' -type f)
- CFLAGS+=-ansi -m64 -Og -ggdb \
- -pedantic -Wall -Wextra -Wshadow \
- -Wcast-align -Wunused -Wconversion -Wmisleading-indentation \
- -Wdouble-promotion -Wformat=2 -Wbad-function-cast \
- -Wmissing-declarations \
- -Wmissing-prototypes -Wnested-externs -Werror
- LDFLAGS+= -fsanitize=address
- ifneq ($(findstring -static, ${LDFLAGS}), )
- LDFLAGS:=$(filter-out -fsanitize=address, ${LDFLAGS})
- _PKGT_STATIC:=--static
- endif
- BIN := $(subst src/,,$(patsubst %.c, %, ${SRCS}))
- _CFLAGS_sdl3:=$(shell pkg-config ${_PKG_STATIC} --cflags sdl3)
- _LDFLAGS_sdl3:=$(shell pkg-config ${_PKG_STATIC} --libs sdl3)
- _CFLAGS_raylib:=$(shell pkg-config ${_PKG_STATIC} --cflags raylib)
- _LDFLAGS_raylib:=$(shell pkg-config ${_PKG_STATIC} --libs raylib)
- ${BIN}: %: src/%.o
- gcc ${LDFLAGS} ${_LDFLAGS_$@} $^ -o $@
- %.o: %.c
- gcc ${CFLAGS} ${_CFLAGS_${@:src/%.o=%}} $^ -c -o $@
- %.d: %.c
- gcc ${CFLAGS} -MM $^ > $@
- include ${DEPS}
- tags: ${SRCS} ${HDRS}
- ctags --kinds-all=* --totals=yes $^
|