mirror of
https://github.com/libretro/libretro-video-processor.git
synced 2026-10-17 14:55:07 +00:00
The core is Linux-only (V4L2 capture, ALSA playback, udev enumeration), so build linux-x64, linux-i686 and linux-aarch64 only. libv4l2, ALSA and udev are now detected at build time instead of being assumed present: the buildbot images do not all ship the headers, and without libv4l2 the raw kernel V4L2 interface is used instead.
162 lines
3.8 KiB
Makefile
162 lines
3.8 KiB
Makefile
STATIC_LINKING := 0
|
|
AR := ar
|
|
|
|
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
|
|
|
|
# system platform
|
|
system_platform = unix
|
|
ifeq ($(shell uname -a),)
|
|
EXE_EXT = .exe
|
|
system_platform = win
|
|
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
|
system_platform = osx
|
|
arch = intel
|
|
ifeq ($(shell uname -p),powerpc)
|
|
arch = ppc
|
|
endif
|
|
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
|
system_platform = win
|
|
endif
|
|
|
|
TARGET_NAME := video_processor
|
|
|
|
# Returns 1 if the given header can be found by the compiler, empty otherwise.
|
|
check_header = $(shell $(CC) -E -include $(1) -x c /dev/null >/dev/null 2>&1 && echo 1)
|
|
|
|
ifeq ($(ARCHFLAGS),)
|
|
ifeq ($(archs),ppc)
|
|
ARCHFLAGS = -arch ppc -arch ppc64
|
|
else
|
|
ARCHFLAGS = -arch i386 -arch x86_64
|
|
endif
|
|
endif
|
|
|
|
ifeq ($(platform), osx)
|
|
ifndef ($(NOUNIVERSAL))
|
|
CFLAGS += $(ARCHFLAGS)
|
|
LFLAGS += $(ARCHFLAGS)
|
|
endif
|
|
endif
|
|
|
|
ifeq ($(STATIC_LINKING), 1)
|
|
EXT := a
|
|
endif
|
|
|
|
ifeq ($(platform), unix)
|
|
EXT ?= so
|
|
TARGET := $(TARGET_NAME)_libretro.$(EXT)
|
|
fpic := -fPIC
|
|
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
|
|
else ifeq ($(platform), linux-portable)
|
|
TARGET := $(TARGET_NAME)_libretro.$(EXT)
|
|
fpic := -fPIC -nostdlib
|
|
SHARED := -shared -Wl,--version-script=link.T
|
|
else ifneq (,$(findstring osx,$(platform)))
|
|
TARGET := $(TARGET_NAME)_libretro.dylib
|
|
fpic := -fPIC
|
|
SHARED := -dynamiclib
|
|
else ifneq (,$(findstring ios,$(platform)))
|
|
TARGET := $(TARGET_NAME)_libretro_ios.dylib
|
|
fpic := -fPIC
|
|
SHARED := -dynamiclib
|
|
|
|
ifeq ($(IOSSDK),)
|
|
IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
|
|
endif
|
|
|
|
DEFINES := -DIOS
|
|
CC = cc -arch armv7 -isysroot $(IOSSDK)
|
|
ifeq ($(platform),ios9)
|
|
CC += -miphoneos-version-min=8.0
|
|
CFLAGS += -miphoneos-version-min=8.0
|
|
else
|
|
CC += -miphoneos-version-min=5.0
|
|
CFLAGS += -miphoneos-version-min=5.0
|
|
endif
|
|
else ifneq (,$(findstring qnx,$(platform)))
|
|
TARGET := $(TARGET_NAME)_libretro_qnx.so
|
|
fpic := -fPIC
|
|
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
|
|
else ifeq ($(platform), emscripten)
|
|
TARGET := $(TARGET_NAME)_libretro_emscripten.bc
|
|
fpic := -fPIC
|
|
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
|
|
else ifeq ($(platform), vita)
|
|
TARGET := $(TARGET_NAME)_vita.a
|
|
CC = arm-vita-eabi-gcc
|
|
AR = arm-vita-eabi-ar
|
|
CFLAGS += -Wl,-q -Wall -O3
|
|
STATIC_LINKING = 1
|
|
else
|
|
CC = gcc
|
|
TARGET := $(TARGET_NAME)_libretro.dll
|
|
SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=link.T -Wl,--no-undefined
|
|
endif
|
|
|
|
# Optional Linux dependencies. Each one is autodetected so that the core still
|
|
# builds (with the matching feature disabled) when its headers are missing.
|
|
ifneq (,$(filter unix linux-portable,$(platform)))
|
|
ifneq (,$(findstring Linux,$(shell uname -s)))
|
|
ifneq (,$(call check_header,libv4l2.h))
|
|
CFLAGS += -DHAVE_LIBV4L2
|
|
LIBV4L2 := -lv4l2
|
|
endif
|
|
ifneq (,$(call check_header,alsa/asoundlib.h))
|
|
CFLAGS += -DHAVE_ALSA
|
|
LIBASOUND := -lasound
|
|
endif
|
|
ifneq (,$(call check_header,libudev.h))
|
|
CFLAGS += -DHAVE_UDEV
|
|
LIBUDEV := -ludev
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
LDFLAGS += $(LIBV4L2) $(LIBASOUND) $(LIBUDEV)
|
|
|
|
ifeq ($(DEBUG), 1)
|
|
CFLAGS += -O0 -g
|
|
else
|
|
CFLAGS += -O3
|
|
endif
|
|
|
|
OBJECTS := video_processor_v4l2.o
|
|
CFLAGS += -Wall -pedantic $(fpic)
|
|
|
|
ifneq (,$(findstring qnx,$(platform)))
|
|
CFLAGS += -Wc,-std=c99
|
|
else
|
|
CFLAGS += -std=gnu99
|
|
endif
|
|
|
|
CFLAGS += -I../../libretro-common/include
|
|
|
|
all: $(TARGET)
|
|
|
|
$(TARGET): $(OBJECTS)
|
|
ifeq ($(STATIC_LINKING), 1)
|
|
$(AR) rcs $@ $(OBJECTS)
|
|
else
|
|
$(CC) $(fpic) $(SHARED) $(INCLUDES) -o $@ $(OBJECTS) $(LDFLAGS)
|
|
endif
|
|
|
|
%.o: %.c
|
|
$(CC) $(CFLAGS) $(fpic) -c -o $@ $<
|
|
|
|
clean:
|
|
rm -f $(OBJECTS) $(TARGET)
|
|
|
|
.PHONY: clean
|
|
|