mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-23 00:36:42 -10:00
The test never linked under MinGW: net_http.c and its sockets need ws2_32, which the Makefile left out, as the other network samples do not. It also wrote its scratch files under /tmp, which a native Windows build resolves to \tmp on the current drive, usually missing. They go in the current directory now, and clean removes the .exe too.
87 lines
2.6 KiB
Makefile
87 lines
2.6 KiB
Makefile
include ../../sample_objdir.mk
|
|
|
|
compiler := gcc
|
|
TARGET := s3_backup_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 test includes network/cloud_sync/s3.c so it can drive the driver
|
|
# as shipped; everything below is what that translation unit needs to
|
|
# link (the signer's HMAC is libretro-common's crypto/kdf.c, which
|
|
# brings crypto.c and md5.c). The HTTP task layer is stubbed in stubs_retroarch.c; net_http.c
|
|
# is linked for the response header helpers the driver reads with.
|
|
SOURCES_C := \
|
|
s3_backup_test.c \
|
|
stubs_retroarch.c \
|
|
$(LIBRETRO_COMM_DIR)/net/net_http.c \
|
|
$(LIBRETRO_COMM_DIR)/net/net_compat.c \
|
|
$(LIBRETRO_COMM_DIR)/net/net_socket.c \
|
|
$(LIBRETRO_COMM_DIR)/lists/string_list.c \
|
|
$(LIBRETRO_COMM_DIR)/file/file_path.c \
|
|
$(LIBRETRO_COMM_DIR)/file/file_path_io.c \
|
|
$(LIBRETRO_COMM_DIR)/streams/file_stream.c \
|
|
$(LIBRETRO_COMM_DIR)/vfs/vfs_implementation.c \
|
|
$(LIBRETRO_COMM_DIR)/encodings/encoding_base64.c \
|
|
$(LIBRETRO_COMM_DIR)/encodings/encoding_utf.c \
|
|
$(LIBRETRO_COMM_DIR)/hash/lrc_hash.c \
|
|
$(LIBRETRO_COMM_DIR)/crypto/kdf.c \
|
|
$(LIBRETRO_COMM_DIR)/crypto/crypto.c \
|
|
$(LIBRETRO_COMM_DIR)/utils/md5.c \
|
|
$(LIBRETRO_COMM_DIR)/features/features_cpu.c \
|
|
$(LIBRETRO_COMM_DIR)/formats/json/rjson.c \
|
|
$(LIBRETRO_COMM_DIR)/string/stdstring.c \
|
|
$(LIBRETRO_COMM_DIR)/string/rstrtod.c \
|
|
$(LIBRETRO_COMM_DIR)/compat/compat_strl.c \
|
|
$(LIBRETRO_COMM_DIR)/compat/compat_strldup.c \
|
|
$(LIBRETRO_COMM_DIR)/compat/compat_posix_string.c \
|
|
$(LIBRETRO_COMM_DIR)/compat/fopen_utf8.c \
|
|
$(LIBRETRO_COMM_DIR)/time/rtime.c
|
|
|
|
CFLAGS += -Wall $(INCDIRS)
|
|
CFLAGS += -DHAVE_NETWORKING -DHAVE_CLOUDSYNC -DHAVE_S3 -D_GNU_SOURCE
|
|
LDFLAGS += -lm
|
|
# net_http and its sockets need Winsock on Windows
|
|
ifneq (,$(findstring mingw,$(CC))$(findstring MINGW,$(MSYSTEM))$(findstring Windows,$(OS)))
|
|
LDFLAGS += -lws2_32
|
|
endif
|
|
|
|
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)
|
|
|
|
# The test includes the driver, so it rebuilds when the driver changes
|
|
s3_backup_test.o: $(CORE_DIR)/network/cloud_sync/s3.c
|
|
|
|
%.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) $(TARGET).exe
|
|
|
|
.PHONY: clean all check
|