Files
RetroArch/samples/frontend/led_driver/Makefile
Derek Eskens ccc9b77f7b samples: test the LED driver's store and flush
led_driver.c stores a core's LED calls and writes them to the driver
once the core has run. Nothing tested that wiring: the index range,
the 0/1 normalisation, the drop on init, the flush before free and
the null-driver fallback.

The test builds led_driver.c from the tree with HAVE_OVERLAY and
stands in for the overlay driver with a recorder, including two
threads setting LEDs while the main thread flushes. It also pins that
led_driver_free() leaves the driver chosen.

Builds with mingw-w64; Linux-samples-unclaimed runs it.

Closes #19854
2026-10-17 01:06:09 +02:00

49 lines
1.2 KiB
Makefile

include ../../sample_objdir.mk
TARGET := led_driver_test
CORE_DIR := ../../..
LIBRETRO_COMM_DIR := $(CORE_DIR)/libretro-common
SOURCES := \
led_driver_test.c \
$(CORE_DIR)/led/led_driver.c \
$(LIBRETRO_COMM_DIR)/rthreads/rthreads.c
OBJS := $(call sample_objs,$(SOURCES:.c=.o))
# The harness is the overlay driver: HAVE_OVERLAY makes "overlay"
# choose it.
CFLAGS += -Wall -std=gnu89 -g1 -O1 -DHAVE_THREADS -DHAVE_OVERLAY \
-I$(LIBRETRO_COMM_DIR)/include -I$(CORE_DIR)
LDFLAGS += -lpthread
ifneq ($(SANITIZER),)
CFLAGS := -fsanitize=$(SANITIZER) -fno-omit-frame-pointer $(CFLAGS)
LDFLAGS := -fsanitize=$(SANITIZER) $(LDFLAGS)
endif
all: $(TARGET)
$(TARGET): $(OBJS)
$(CC) -o $@ $(OBJS) $(LDFLAGS)
led_driver_test.o: $(CORE_DIR)/led/led_driver.h $(CORE_DIR)/led/led_defines.h
$(call sample_objs,$(CORE_DIR)/led/led_driver.o): \
$(CORE_DIR)/led/led_driver.h $(CORE_DIR)/led/led_defines.h \
$(CORE_DIR)/input/input_output_store.h
check: all
./$(TARGET)
clean:
rm -rf $(SAMPLE_OBJDIR)
rm -f $(OBJS) $(TARGET) $(TARGET).exe
.PHONY: all check clean
$(SAMPLE_OBJDIR)/%.o: $$(call sample_src,$$*).c
@mkdir -p $(@D)
$(COMPILE.c) $(OUTPUT_OPTION) $<