2012-05-05 11:49:41 +00:00
|
|
|
|
2013-07-27 18:17:22 +00:00
|
|
|
ifneq ($(EMSCRIPTEN),)
|
|
|
|
platform = emscripten
|
|
|
|
endif
|
|
|
|
|
2012-05-05 11:49:41 +00:00
|
|
|
ifeq ($(platform),)
|
|
|
|
platform = unix
|
|
|
|
ifeq ($(shell uname -a),)
|
|
|
|
platform = win
|
|
|
|
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
|
|
|
platform = win
|
|
|
|
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
|
|
|
platform = osx
|
|
|
|
else ifneq ($(findstring win,$(shell uname -a)),)
|
|
|
|
platform = win
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2013-05-16 11:28:43 +00:00
|
|
|
TARGET_NAME := test
|
|
|
|
|
2012-05-05 11:49:41 +00:00
|
|
|
ifeq ($(platform), unix)
|
2013-05-16 11:28:43 +00:00
|
|
|
TARGET := $(TARGET_NAME)_libretro.so
|
2012-05-05 11:49:41 +00:00
|
|
|
fpic := -fPIC
|
|
|
|
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
|
|
|
|
else ifeq ($(platform), osx)
|
2013-05-16 11:28:43 +00:00
|
|
|
TARGET := $(TARGET_NAME)_libretro.dylib
|
2012-05-05 11:49:41 +00:00
|
|
|
fpic := -fPIC
|
|
|
|
SHARED := -dynamiclib
|
2013-05-16 11:38:16 +00:00
|
|
|
else ifeq ($(platform), ios)
|
|
|
|
TARGET := $(TARGET_NAME)_libretro_ios.dylib
|
|
|
|
fpic := -fPIC
|
|
|
|
SHARED := -dynamiclib
|
|
|
|
DEFINES := -DIOS
|
|
|
|
CC = clang -arch armv7 -isysroot $(IOSSDK)
|
2013-05-16 11:28:43 +00:00
|
|
|
else ifeq ($(platform), qnx)
|
|
|
|
TARGET := $(TARGET_NAME)_libretro_qnx.so
|
|
|
|
fpic := -fPIC
|
|
|
|
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
|
2013-07-27 18:17:22 +00:00
|
|
|
else ifeq ($(platform), emscripten)
|
|
|
|
TARGET := $(TARGET_NAME)_libretro_emscripten.so
|
|
|
|
fpic := -fPIC
|
|
|
|
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
|
2012-05-05 11:49:41 +00:00
|
|
|
else
|
|
|
|
CC = gcc
|
2013-05-16 11:38:16 +00:00
|
|
|
TARGET := $(TARGET_NAME)_retro.dll
|
2012-05-05 11:49:41 +00:00
|
|
|
SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=link.T -Wl,--no-undefined
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(DEBUG), 1)
|
|
|
|
CFLAGS += -O0 -g
|
|
|
|
else
|
|
|
|
CFLAGS += -O3
|
|
|
|
endif
|
|
|
|
|
|
|
|
OBJECTS := libretro-test.o
|
2013-05-16 11:28:43 +00:00
|
|
|
CFLAGS += -Wall -pedantic $(fpic)
|
|
|
|
|
|
|
|
ifeq ($(platform), qnx)
|
|
|
|
CFLAGS += -Wc,-std=gnu99
|
|
|
|
else
|
|
|
|
CFLAGS += -std=gnu99
|
|
|
|
endif
|
2012-05-05 11:49:41 +00:00
|
|
|
|
|
|
|
all: $(TARGET)
|
|
|
|
|
|
|
|
$(TARGET): $(OBJECTS)
|
|
|
|
$(CC) $(fpic) $(SHARED) $(INCLUDES) -o $@ $(OBJECTS) -lm
|
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f $(OBJECTS) $(TARGET)
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
|