mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-22 10:50:15 -10:00
The sample and test builds used full debug info. -g1 keeps what sanitizer reports and backtraces need - function names, files and line numbers - and drops the variable and type information nobody reads in CI. Objects get about 30% smaller (rh265.o under ASan+UBSan: 5.1MB to 3.7MB), so the ccache caches hold more of each job's build and are quicker to restore and save.
49 lines
1002 B
Makefile
49 lines
1002 B
Makefile
compiler := gcc
|
|
TARGET := pacing_test
|
|
|
|
CORE_DIR = ../../..
|
|
LIBRETRO_COMM_DIR = $(CORE_DIR)/libretro-common
|
|
INCDIRS := -I$(LIBRETRO_COMM_DIR)/include -I$(CORE_DIR) \
|
|
-I$(CORE_DIR)/deps -I$(CORE_DIR)/deps/stb
|
|
|
|
CC := $(compiler)
|
|
flags += -std=gnu99
|
|
|
|
# runloop.h and nothing else: the three decisions under test are inline
|
|
# functions of their arguments, with no state and no clock, so the test
|
|
# needs no stubs and links against nothing.
|
|
SOURCES_C := \
|
|
pacing_test.c
|
|
|
|
CFLAGS += -Wall -Wextra -Wno-unused-parameter
|
|
|
|
ifneq ($(DEBUG),)
|
|
CFLAGS += -O0 -g1
|
|
else
|
|
CFLAGS += -O2
|
|
endif
|
|
|
|
ifneq ($(SANITIZER),)
|
|
CFLAGS := -fsanitize=$(SANITIZER) -fno-omit-frame-pointer -g1 $(CFLAGS)
|
|
LDFLAGS := -fsanitize=$(SANITIZER) $(LDFLAGS)
|
|
endif
|
|
|
|
OBJS := $(SOURCES_C:.c=.o)
|
|
|
|
all: $(TARGET)
|
|
|
|
%.o: %.c
|
|
$(CC) $(INCDIRS) $(CFLAGS) $(flags) -c -o$@ $<
|
|
|
|
$(TARGET): $(OBJS)
|
|
$(CC) -o$@ $(OBJS) $(LDFLAGS)
|
|
|
|
check: $(TARGET)
|
|
./$(TARGET)
|
|
|
|
clean:
|
|
rm -f $(OBJS)
|
|
rm -f $(TARGET)
|
|
|
|
.PHONY: clean all check
|