3 LIBRETRO_COMM_DIR := ../../..
4 LIBRETRO_DEPS_DIR := ../../../../deps
6 # Attempt to detect target platform
7 ifeq '$(findstring ;,$(PATH))' ';'
10 UNAME := $(shell uname 2>/dev/null || echo Unknown)
11 UNAME := $(patsubst CYGWIN%,Cygwin,$(UNAME))
12 UNAME := $(patsubst MSYS%,MSYS,$(UNAME))
13 UNAME := $(patsubst MINGW%,MSYS,$(UNAME))
16 # Add '.exe' extension on Windows platforms
17 ifeq ($(UNAME), Windows)
26 $(LIBRETRO_COMM_DIR)/compat/fopen_utf8.c \
27 $(LIBRETRO_COMM_DIR)/compat/compat_strl.c \
28 $(LIBRETRO_COMM_DIR)/compat/compat_strcasestr.c \
29 $(LIBRETRO_COMM_DIR)/compat/compat_posix_string.c \
30 $(LIBRETRO_COMM_DIR)/encodings/encoding_utf.c \
31 $(LIBRETRO_COMM_DIR)/encodings/encoding_crc32.c \
32 $(LIBRETRO_COMM_DIR)/file/file_path.c \
33 $(LIBRETRO_COMM_DIR)/file/file_path_io.c \
34 $(LIBRETRO_COMM_DIR)/string/stdstring.c \
35 $(LIBRETRO_COMM_DIR)/streams/file_stream.c \
36 $(LIBRETRO_COMM_DIR)/streams/file_stream_transforms.c \
37 $(LIBRETRO_COMM_DIR)/streams/interface_stream.c \
38 $(LIBRETRO_COMM_DIR)/streams/memory_stream.c \
39 $(LIBRETRO_COMM_DIR)/streams/rzip_stream.c \
40 $(LIBRETRO_COMM_DIR)/streams/stdin_stream.c \
41 $(LIBRETRO_COMM_DIR)/streams/trans_stream.c \
42 $(LIBRETRO_COMM_DIR)/streams/trans_stream_pipe.c \
43 $(LIBRETRO_COMM_DIR)/streams/trans_stream_zlib.c \
44 $(LIBRETRO_COMM_DIR)/vfs/vfs_implementation.c \
45 $(LIBRETRO_COMM_DIR)/time/rtime.c
47 ifneq ($(wildcard $(LIBRETRO_DEPS_DIR)/*),)
48 # If we are building from inside the RetroArch
49 # directory (i.e. if an 'external' deps directory
50 # is avaiable), bake in zlib support
52 $(LIBRETRO_DEPS_DIR)/libz/adler32.c \
53 $(LIBRETRO_DEPS_DIR)/libz/libz-crc32.c \
54 $(LIBRETRO_DEPS_DIR)/libz/deflate.c \
55 $(LIBRETRO_DEPS_DIR)/libz/gzclose.c \
56 $(LIBRETRO_DEPS_DIR)/libz/gzlib.c \
57 $(LIBRETRO_DEPS_DIR)/libz/gzread.c \
58 $(LIBRETRO_DEPS_DIR)/libz/gzwrite.c \
59 $(LIBRETRO_DEPS_DIR)/libz/inffast.c \
60 $(LIBRETRO_DEPS_DIR)/libz/inflate.c \
61 $(LIBRETRO_DEPS_DIR)/libz/inftrees.c \
62 $(LIBRETRO_DEPS_DIR)/libz/trees.c \
63 $(LIBRETRO_DEPS_DIR)/libz/zutil.c
64 INCLUDE_DIRS := -I$(LIBRETRO_COMM_DIR)/include/compat/zlib
66 # If this is a stand-alone libretro-common directory,
67 # rely on system zlib library (note: only likely to
68 # work on Unix-based platforms...)
72 OBJS := $(SOURCES:.c=.o)
73 INCLUDE_DIRS += -I$(LIBRETRO_COMM_DIR)/include
74 CFLAGS += -DHAVE_ZLIB -Wall -pedantic -std=gnu99 $(INCLUDE_DIRS)
76 # Silence "ISO C does not support the 'I64' ms_printf length modifier"
77 # warnings when using MinGW
78 ifeq ($(UNAME), Windows)
86 CFLAGS += -O0 -g -DDEBUG -D_DEBUG
88 CFLAGS += -O2 -DNDEBUG
94 $(CC) -c -o $@ $< $(CFLAGS)
97 $(CC) -o $@ $^ $(LDFLAGS)
100 rm -f $(TARGET) $(OBJS)