mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-23 09:49:34 -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.
73 lines
2.0 KiB
Makefile
73 lines
2.0 KiB
Makefile
include ../../sample_objdir.mk
|
|
|
|
compiler := gcc
|
|
TARGET := alsa_clock_test
|
|
|
|
CORE_DIR = ../../..
|
|
LIBRETRO_COMM_DIR = $(CORE_DIR)/libretro-common
|
|
INCDIRS := -I$(LIBRETRO_COMM_DIR)/include -I$(CORE_DIR)
|
|
|
|
CC := $(compiler)
|
|
flags += -std=gnu99
|
|
|
|
# The shipping driver, its shared PCM setup, and the libretro-common
|
|
# pieces they lean on. The device clock is measured from what
|
|
# snd_pcm_status() reports, so those calls are scripted via --wrap and
|
|
# everything else reaches the real library - the PCM underneath is a
|
|
# real one, opened on the null device.
|
|
SOURCES_C := \
|
|
alsa_clock_test.c \
|
|
../../../audio/audio_upmix.c \
|
|
../../../audio/audio_binaural.c \
|
|
stubs_retroarch.c \
|
|
$(CORE_DIR)/audio/drivers/alsa.c \
|
|
$(CORE_DIR)/audio/common/alsa.c \
|
|
$(LIBRETRO_COMM_DIR)/lists/string_list.c \
|
|
$(LIBRETRO_COMM_DIR)/queues/fifo_queue.c \
|
|
$(LIBRETRO_COMM_DIR)/rthreads/rthreads.c \
|
|
$(LIBRETRO_COMM_DIR)/compat/compat_strl.c \
|
|
$(LIBRETRO_COMM_DIR)/compat/compat_strldup.c \
|
|
$(LIBRETRO_COMM_DIR)/string/stdstring.c \
|
|
$(LIBRETRO_COMM_DIR)/encodings/encoding_utf.c
|
|
|
|
CFLAGS += -Wall $(INCDIRS)
|
|
CFLAGS += -DHAVE_ALSA -DHAVE_THREADS -D_GNU_SOURCE
|
|
LDFLAGS += -lasound -lm -lpthread
|
|
LDFLAGS += -Wl,--wrap=snd_pcm_status \
|
|
-Wl,--wrap=snd_pcm_status_get_htstamp \
|
|
-Wl,--wrap=snd_pcm_status_get_audio_htstamp \
|
|
-Wl,--wrap=snd_pcm_status_get_delay \
|
|
-Wl,--wrap=snd_pcm_writei
|
|
|
|
ifneq ($(SAN),)
|
|
SANITIZER := $(SAN)
|
|
endif
|
|
ifneq ($(SANITIZER),)
|
|
CFLAGS := -fsanitize=$(SANITIZER) -fno-omit-frame-pointer -g1 $(CFLAGS)
|
|
LDFLAGS := -fsanitize=$(SANITIZER) $(LDFLAGS)
|
|
endif
|
|
|
|
OBJS := $(call sample_objs,$(SOURCES_C:.c=.o))
|
|
|
|
all: $(TARGET)
|
|
|
|
%.o: %.c
|
|
$(CC) $(INCDIRS) $(CFLAGS) $(flags) -c -o$@ $<
|
|
|
|
$(SAMPLE_OBJDIR)/%.o: $$(call sample_src,$$*).c
|
|
@mkdir -p $(@D)
|
|
$(CC) $(INCDIRS) $(CFLAGS) $(flags) -c -o$@ $<
|
|
|
|
$(TARGET): $(OBJS)
|
|
$(CC) -o$@ $(OBJS) $(LDFLAGS)
|
|
|
|
check: $(TARGET)
|
|
./$(TARGET)
|
|
|
|
clean:
|
|
rm -rf $(SAMPLE_OBJDIR)
|
|
rm -f $(OBJS)
|
|
rm -f $(TARGET)
|
|
|
|
.PHONY: clean all check
|