- Add gcc and mesa to shell.nix for C compilation - Fix warning icon overlap with ::after message by adding padding-right to proccall-header and end-header when warnings are active - Add tests/compile/ with Makefile (pkg-config based) and run.js which generates C source from block-like data structures, then compiles with gcc -Wall -Wextra -fsyntax-only - Tests cover: console template, simple error, error merge, sequential errors, value-return error style
34 lines
894 B
Makefile
34 lines
894 B
Makefile
CC ?= gcc
|
|
CFLAGS ?= -Wall -Wextra -Werror=implicit-function-declaration -Werror=incompatible-pointer-types -fsyntax-only
|
|
OUTDIR ?= /tmp/wisecode-compile
|
|
|
|
SRC := $(wildcard $(OUTDIR)/*.c)
|
|
|
|
SDL3_CFLAGS := $(shell pkg-config --cflags sdl3 2>/dev/null || echo)
|
|
GL_CFLAGS := $(shell pkg-config --cflags gl 2>/dev/null || echo)
|
|
|
|
SDL3_SRC := $(filter %_sdl3.c, $(SRC))
|
|
PLAIN_SRC := $(filter-out %_sdl3.c, $(SRC))
|
|
|
|
.PHONY: all sdl3 clean
|
|
|
|
all: $(PLAIN_SRC)
|
|
@for f in $(PLAIN_SRC); do \
|
|
printf " CC %s\n" "$$(basename $$f)"; \
|
|
$(CC) $(CFLAGS) "$$f" 2>&1 || exit 1; \
|
|
done
|
|
|
|
sdl3: $(SDL3_SRC)
|
|
@if [ -z "$(SDL3_SRC)" ]; then \
|
|
echo " (no SDL3 tests)"; \
|
|
exit 0; \
|
|
fi
|
|
@echo " (with SDL3 flags)" ; \
|
|
for f in $(SDL3_SRC); do \
|
|
printf " CC %s\n" "$$(basename $$f)"; \
|
|
$(CC) $(CFLAGS) $(SDL3_CFLAGS) $(GL_CFLAGS) "$$f" 2>&1 || exit 1; \
|
|
done
|
|
|
|
clean:
|
|
rm -f $(OUTDIR)/*.c
|