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.
72 lines
1.9 KiB
Makefile
72 lines
1.9 KiB
Makefile
include ../../sample_objdir.mk
|
|
|
|
compiler := gcc
|
|
TARGET := alsa_wait_writable_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 harness scripts the five libasound calls
|
|
# alsa_wait_writable() makes via --wrap; everything else reaches the
|
|
# real library.
|
|
SOURCES_C := \
|
|
alsa_wait_writable_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_avail \
|
|
-Wl,--wrap=snd_pcm_state \
|
|
-Wl,--wrap=snd_pcm_start \
|
|
-Wl,--wrap=snd_pcm_wait \
|
|
-Wl,--wrap=snd_pcm_recover
|
|
|
|
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
|