Files
RetroArch/samples/input/libusb_hid/Makefile
LibretroAdmin 8f1ac4ad61 samples: compat_strl.c beside features_cpu.c
features_cpu.c copies the CPU's model name with strlcpy() on the
architectures that read it from /proc/cpuinfo, so every sample that
links it links compat_strl.c too; fast_cores_test includes it beside
features_cpu.c. They link on PowerPC and ARM as well as x86.
2026-10-28 05:43:35 +01:00

53 lines
1.3 KiB
Makefile

include ../../sample_objdir.mk
TARGET := libusb_hid_test
RARCH_DIR := ../../..
LIBRETRO_COMM_DIR := $(RARCH_DIR)/libretro-common
# The driver against a fake libusb (fake_libusb.c), built on the real
# <libusb.h> for its types: needs libusb-1.0 headers, not the library.
SOURCES := \
libusb_hid_test.c \
fake_libusb.c \
$(RARCH_DIR)/input/drivers_hid/libusb_hid.c \
$(LIBRETRO_COMM_DIR)/rthreads/rthreads.c \
$(LIBRETRO_COMM_DIR)/compat/compat_strl.c \
$(LIBRETRO_COMM_DIR)/features/features_cpu.c
OBJS := $(call sample_objs,$(SOURCES:.c=.o))
CFLAGS += -Wall -std=gnu99 -g1 -O1 -D_GNU_SOURCE -DHAVE_THREADS -DHAVE_HID \
-DHAVE_LIBUSB -I$(RARCH_DIR) -I$(LIBRETRO_COMM_DIR)/include -I.
LDFLAGS += -lpthread -lm
ifneq ($(SANITIZER),)
CFLAGS := -fsanitize=$(SANITIZER) -fno-omit-frame-pointer $(CFLAGS)
LDFLAGS := -fsanitize=$(SANITIZER) $(LDFLAGS)
endif
ifneq ($(SAN),)
CFLAGS := -fsanitize=$(SAN) -fno-omit-frame-pointer $(CFLAGS)
LDFLAGS := -fsanitize=$(SAN) $(LDFLAGS)
endif
all: $(TARGET)
%.o: %.c
$(CC) -c -o $@ $< $(CFLAGS)
$(SAMPLE_OBJDIR)/%.o: $$(call sample_src,$$*).c
@mkdir -p $(@D)
$(CC) -c -o $@ $< $(CFLAGS)
$(TARGET): $(OBJS)
$(CC) -o $@ $(OBJS) $(LDFLAGS)
check: all
./$(TARGET)
clean:
rm -rf $(SAMPLE_OBJDIR)
rm -f $(TARGET) $(OBJS)
.PHONY: all check clean