mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-23 00:36:42 -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.
76 lines
2.3 KiB
Makefile
76 lines
2.3 KiB
Makefile
# HTTP/1.1 semantics oracle for libretro-common/net/net_http.c: the
|
|
# real net_http.c against an in-process scripted server on 127.0.0.1.
|
|
#
|
|
# make clean all SANITIZER=address,undefined && ./net_http_semantics_test
|
|
# make clean all SANITIZER=thread && ./net_http_semantics_test
|
|
|
|
include ../../sample_objdir.mk
|
|
|
|
compiler := gcc
|
|
TARGET := net_http_semantics_test
|
|
|
|
CORE_DIR = ../../..
|
|
LIBRETRO_COMM_DIR = $(CORE_DIR)/libretro-common
|
|
INCDIRS := -I$(LIBRETRO_COMM_DIR)/include -I$(CORE_DIR)
|
|
|
|
CC := $(compiler)
|
|
|
|
SOURCES_C := \
|
|
net_http_semantics_test.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)/features/features_cpu.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)/rthreads/rthreads.c \
|
|
$(LIBRETRO_COMM_DIR)/rthreads/retro_eventcount.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)/encodings/encoding_utf.c \
|
|
$(LIBRETRO_COMM_DIR)/encodings/encoding_base64.c \
|
|
$(LIBRETRO_COMM_DIR)/time/rtime.c
|
|
|
|
CFLAGS += -Wall -std=gnu99 -O1 -g1 $(INCDIRS)
|
|
CFLAGS += -DHAVE_NETWORKING -DHAVE_THREADS -D_GNU_SOURCE
|
|
# A stall bound short enough to test: STALL_MS in the test.
|
|
CFLAGS += "-DNET_HTTP_STALL_TIMEOUT=((retro_time_t)600 * 1000)"
|
|
# The buffer-growth cases read the largest realloc() net_http asks for,
|
|
# the header cases count allocations.
|
|
LDFLAGS += -Wl,--wrap=realloc,--wrap=malloc,--wrap=calloc,--wrap=strdup -lpthread -lm
|
|
|
|
ifneq ($(SANITIZER),)
|
|
CFLAGS := -fsanitize=$(SANITIZER) -fno-omit-frame-pointer $(CFLAGS)
|
|
LDFLAGS := -fsanitize=$(SANITIZER) $(LDFLAGS)
|
|
endif
|
|
|
|
OBJS := $(call sample_objs,$(SOURCES_C:.c=.o))
|
|
|
|
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 $@ $^ $(LDFLAGS)
|
|
|
|
check: $(TARGET)
|
|
./$(TARGET)
|
|
|
|
clean:
|
|
rm -rf $(SAMPLE_OBJDIR)
|
|
rm -f $(TARGET) $(OBJS)
|
|
|
|
.PHONY: all check clean
|