1##############
2# Works on hosts Linux
3# apt-get install mingw-w64
4
5#########################
6# Check the host platform
7
8HOST_PLATFORM = linux
9ifeq ($(shell uname -a),)
10  HOST_PLATFORM = windows
11else ifneq ($(findstring MINGW,$(shell uname -a)),)
12  HOST_PLATFORM = windows
13else ifneq ($(findstring Darwin,$(shell uname -a)),)
14  HOST_PLATFORM = darwin
15else ifneq ($(findstring win,$(shell uname -a)),)
16  HOST_PLATFORM = windows
17endif
18
19#########################
20# Set the target platform
21
22TARGET_PLATFORM = windows_x86
23
24#################
25# Toolchain setup
26
27CC  = i686-w64-mingw32-gcc
28CXX = i686-w64-mingw32-g++
29AS  = i686-w64-mingw32-as
30AR  = i686-w64-mingw32-ar
31
32############
33# Extensions
34
35OBJEXT = .windows_x86.o
36SOEXT  = .windows_x86.dll
37LIBEXT = .windows_x86.a
38
39################
40# Platform setup
41
42STATIC_LINKING = 0
43platform       = win
44PLATDEFS       =
45PLATCFLAGS     = -fstrict-aliasing
46PLATCXXFLAGS   = -fstrict-aliasing
47PLATLDFLAGS    = -shared -lm
48PLATLDXFLAGS   = -shared -lm
49
50################
51# libretro setup
52
53RETRODEFS     = -D__LIBRETRO__
54RETROCFLAGS   =
55RETROCXXFLAGS =
56RETROLDFLAGS  =
57RETROLDXFLAGS =
58
59#################
60# Final variables
61
62DEFINES  = $(PLATDEFS) $(RETRODEFS)
63CFLAGS   = $(PLATCFLAGS) $(RETROCFLAGS) $(DEFINES) $(INCLUDES)
64CXXFLAGS = $(PLATCXXFLAGS) $(RETROCXXFLAGS) $(DEFINES) $(INCLUDES)
65LDFLAGS  = $(PLATLDFLAGS) $(RETROLDFLAGS)
66LDXFLAGS = $(PLATLDXFLAGS) $(RETROLDXFLAGS)
67
68########
69# Tuning
70
71ifneq ($(DEBUG),)
72  CFLAGS   += -O0 -g
73  CXXFLAGS += -O0 -g
74else
75  CFLAGS   += -O3 -DNDEBUG
76  CXXFLAGS += -O3 -DNDEBUG
77endif
78
79ifneq ($(LOG_PERFORMANCE),)
80  CFLAGS   += -DLOG_PERFORMANCE
81  CXXFLAGS += -DLOG_PERFORMANCE
82endif
83
84####################################
85# Variable setup for Makefile.common
86
87CORE_DIR  ?= ..
88BUILD_DIR ?= .
89INCLUDES   =
90
91include $(BUILD_DIR)/Makefile.common
92
93###############
94# Include rules
95
96include $(BUILD_DIR)/Makefile.rules
97