(libretro) remove stupid rule in gitignore

This commit is contained in:
barbudreadmon 2019-08-27 15:36:42 +02:00
parent d951f401c4
commit 7156f5be0a
14 changed files with 1135 additions and 1 deletions

1
.gitignore vendored
View File

@ -5,7 +5,6 @@
*.pdb
*.exp
*.manifest
Makefile
.cproject
.project
.settings/

View File

@ -0,0 +1,5 @@
all:
-@echo "Please use ./configure first. Thank you."
distclean:
make -f Makefile.in distclean

View File

@ -0,0 +1,8 @@
blast: blast.c blast.h
cc -DTEST -o blast blast.c
test: blast
blast < test.pk | cmp - test.txt
clean:
rm -f blast blast.o

View File

@ -0,0 +1,25 @@
CC=cc
CFLAGS=-O -I../..
UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a
ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a
.c.o:
$(CC) -c $(CFLAGS) $*.c
all: miniunz minizip
miniunz: $(UNZ_OBJS)
$(CC) $(CFLAGS) -o $@ $(UNZ_OBJS)
minizip: $(ZIP_OBJS)
$(CC) $(CFLAGS) -o $@ $(ZIP_OBJS)
test: miniunz minizip
./minizip test readme.txt
./miniunz -l test.zip
mv readme.txt readme.old
./miniunz test.zip
clean:
/bin/rm -f *.o *~ minizip miniunz

View File

@ -0,0 +1,42 @@
CFLAGS=-O
puff: puff.o pufftest.o
puff.o: puff.h
pufftest.o: puff.h
test: puff
puff zeros.raw
puft: puff.c puff.h pufftest.o
cc -fprofile-arcs -ftest-coverage -o puft puff.c pufftest.o
# puff full coverage test (should say 100%)
cov: puft
@rm -f *.gcov *.gcda
@puft -w zeros.raw 2>&1 | cat > /dev/null
@echo '04' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2
@echo '00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2
@echo '00 00 00 00 00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 254
@echo '00 01 00 fe ff' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2
@echo '01 01 00 fe ff 0a' | xxd -r -p | puft -f 2>&1 | cat > /dev/null
@echo '02 7e ff ff' | xxd -r -p | puft 2> /dev/null || test $$? -eq 246
@echo '02' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2
@echo '04 80 49 92 24 49 92 24 0f b4 ff ff c3 04' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2
@echo '04 80 49 92 24 49 92 24 71 ff ff 93 11 00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 249
@echo '04 c0 81 08 00 00 00 00 20 7f eb 0b 00 00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 246
@echo '0b 00 00' | xxd -r -p | puft -f 2>&1 | cat > /dev/null
@echo '1a 07' | xxd -r -p | puft 2> /dev/null || test $$? -eq 246
@echo '0c c0 81 00 00 00 00 00 90 ff 6b 04' | xxd -r -p | puft 2> /dev/null || test $$? -eq 245
@puft -f zeros.raw 2>&1 | cat > /dev/null
@echo 'fc 00 00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 253
@echo '04 00 fe ff' | xxd -r -p | puft 2> /dev/null || test $$? -eq 252
@echo '04 00 24 49' | xxd -r -p | puft 2> /dev/null || test $$? -eq 251
@echo '04 80 49 92 24 49 92 24 0f b4 ff ff c3 84' | xxd -r -p | puft 2> /dev/null || test $$? -eq 248
@echo '04 00 24 e9 ff ff' | xxd -r -p | puft 2> /dev/null || test $$? -eq 250
@echo '04 00 24 e9 ff 6d' | xxd -r -p | puft 2> /dev/null || test $$? -eq 247
@gcov -n puff.c
clean:
rm -f puff puft *.o *.gc*

View File

@ -0,0 +1,14 @@
CC=cc
CFLAGS=-g
untgz: untgz.o ../../libz.a
$(CC) $(CFLAGS) -o untgz untgz.o -L../.. -lz
untgz.o: untgz.c ../../zlib.h
$(CC) $(CFLAGS) -c -I../.. untgz.c
../../libz.a:
cd ../..; ./configure; make
clean:
rm -f untgz untgz.o *~

View File

@ -0,0 +1,126 @@
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
include $(DEVKITARM)/ds_rules
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# DATA is a list of directories containing data files
# INCLUDES is a list of directories containing header files
#---------------------------------------------------------------------------------
TARGET := $(shell basename $(CURDIR))
BUILD := build
SOURCES := ../../
DATA := data
INCLUDES := include
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -mthumb -mthumb-interwork
CFLAGS := -Wall -O2\
-march=armv5te -mtune=arm946e-s \
-fomit-frame-pointer -ffast-math \
$(ARCH)
CFLAGS += $(INCLUDE) -DARM9
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
ASFLAGS := $(ARCH) -march=armv5te -mtune=arm946e-s
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(LIBNDS)
#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/lib/libz.a
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
export OFILES := $(addsuffix .o,$(BINFILES)) \
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD)
.PHONY: $(BUILD) clean all
#---------------------------------------------------------------------------------
all: $(BUILD)
@[ -d $@ ] || mkdir -p include
@cp ../../*.h include
lib:
@[ -d $@ ] || mkdir -p $@
$(BUILD): lib
@[ -d $@ ] || mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) lib
#---------------------------------------------------------------------------------
else
DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT) : $(OFILES)
#---------------------------------------------------------------------------------
%.bin.o : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
-include $(DEPENDS)
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------

View File

@ -0,0 +1,535 @@
DEBUG = 0
DEBUG_ASAN = 0
DEBUG_UBSAN = 0
DEBUG_TSAN = 0
HAVE_SSE = 1
FASTMATH = 1
DYNAREC = 0
HAVE_GRIFFIN = 0
HAVE_THREADS = 1
HAVE_MUSASHI = 1
HAVE_UWP = 0
HAVE_SYS_PARAM_H = 1
HAVE_FSEEKO = 0
ARCH_IS_LINUX = 0
ARCH_IS_MACOSX = 0
ARCH_IS_WINDOWS = 0
# The following is broken upstream ?
USE_PLAY_JIT = 0
USE_SCSP2 = 0
SPACE :=
SPACE := $(SPACE) $(SPACE)
BACKSLASH :=
BACKSLASH := \$(BACKSLASH)
filter_out1 = $(filter-out $(firstword $1),$1)
filter_out2 = $(call filter_out1,$(call filter_out1,$1))
ifeq ($(platform),)
platform = unix
ifeq ($(shell uname -a),)
platform = win
else ifneq ($(findstring Darwin,$(shell uname -a)),)
platform = osx
else ifneq ($(findstring MINGW,$(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
CORE_DIR := .
TARGET_NAME = yabause
CC_AS ?= $(CC)
GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)"
ifneq ($(GIT_VERSION)," unknown")
FLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
endif
# Unix
ifneq (,$(findstring unix,$(platform)))
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T
#DYNAREC = 2
FLAGS += -pthread
LDFLAGS += -pthread
else ifneq (,$(findstring linux-portable,$(platform)))
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC -nostdlib
SHARED := -shared -Wl,--version-script=link.T
#DYNAREC = 2
FLAGS += -pthread
LDFLAGS += -pthread
# OS X
else ifneq (,$(findstring osx,$(platform)))
TARGET := $(TARGET_NAME)_libretro.dylib
fpic := -fPIC
OSXVER = $(shell sw_vers -productVersion | cut -d. -f 2)
OSX_GT_MOJAVE = $(shell (( $(OSXVER) >= 14)) && echo "YES")
ifneq ($(OSX_GT_MOJAVE),YES)
#this breaks compiling on Mac OS Mojave
fpic += -mmacosx-version-min=10.1
endif
SHARED := -dynamiclib
ifeq ($(arch),ppc)
ENDIANNESS_DEFINES := -DWORDS_BIGENDIAN -DMSB_FIRST -D__ppc__
endif
#DYNAREC = 2
FLAGS += -pthread
LDFLAGS += -pthread
LIBRARY_NAME = $(TARGET_NAME)_libretro_ios
else ifneq (,$(findstring ios,$(platform)))
# iOS
TARGET := $(TARGET_NAME)_libretro_ios.dylib
fpic := -fPIC
SHARED := -dynamiclib
CC = clang -arch armv7 -isysroot $(IOSSDK)
CC_AS = perl ./libretro/gas-preprocessor.pl $(CC)
CXX = clang++ -arch armv7 -isysroot $(IOSSDK)
HAVE_SSE = 0
# QNX
else ifneq (,$(findstring qnx,$(platform)))
TARGET := $(TARGET_NAME)_libretro_$(platform).so
fpic := -fPIC
SHARED := -shared -Wl,--version-script=link.T
CC = qcc -Vgcc_ntoarmv7le
CC_AS = $(CC)
CXX = QCC -Vgcc_ntoarmv7le
AR = qcc -Vgcc_ntoarmv7le
ENDIANNESS_DEFINES += -D__BLACKBERRY_QNX__ -marm -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=softfp -fms-extensions
HAVE_SSE = 0
# PS3
else ifneq (,$(findstring ps3,$(platform)))
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
CXX = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-g++.exe
AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe
ENDIANNESS_DEFINES = -DWORDS_BIGENDIAN -DMSB_FIRST -D__ppc__
STATIC_LINKING = 1
HAVE_SSE = 0
# sncps3
else ifneq (,$(findstring sncps3,$(platform)))
TARGET := $(TARGET_NAME)_libretro_ps3.a
CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
CXX = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe $(SOURCE_DIR)/musashi/$(M68KMAKE_EXE) $(SOURCE_DIR)/c68k/$(GEN68K_EXE)
AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe
ENDIANNESS_DEFINES = -DWORDS_BIGENDIAN -DMSB_FIRST -D__ppc__
STATIC_LINKING = 1
HAVE_SSE = 0
# Lightweight PS3 Homebrew SDK
else ifneq (,$(findstring psl1ght,$(platform)))
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT)
CC = $(PS3DEV)/ppu/bin/ppu-g++$(EXE_EXT)
AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT)
ENDIANNESS_DEFINES = -DWORDS_BIGENDIAN -DMSB_FIRST -D__ppc__
STATIC_LINKING = 1
HAVE_SSE = 0
# PSP
else ifneq (,$(findstring psp1,$(platform)))
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = psp-gcc$(EXE_EXT)
CC_AS = $(CC)
CXX = psp-g++$(EXE_EXT)
AR = psp-ar$(EXE_EXT)
ENDIANNESS_DEFINES += -DPSP -G0
STATIC_LINKING = 1
HAVE_SSE = 0
# Vita
else ifneq (,$(findstring vita,$(platform)))
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = arm-vita-eabi-gcc$(EXE_EXT)
CCX = arm-vita-eabi-g++$(EXE_EXT)
CC_AS = arm-vita-eabi-gcc$(EXE_EXT)
AR = arm-vita-eabi-ar$(EXE_EXT)
ENDIANNESS_DEFINES += -DVITA
#DYNAREC = 2
STATIC_LINKING = 1
HAVE_SSE = 0
# Nintendo Game Cube
else ifneq (,$(findstring ngc,$(platform)))
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
CXX = $(DEVKITPPC)/bin/powerpc-eabi-g++$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
ENDIANNESS_DEFINES = -DWORDS_BIGENDIAN -DMSB_FIRST -DGEKKO -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float -D__ppc__
STATIC_LINKING = 1
HAVE_SSE = 0
# Nintendo Wii
else ifneq (,$(findstring wii,$(platform)))
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
CXX = $(DEVKITPPC)/bin/powerpc-eabi-g++$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
ENDIANNESS_DEFINES = -DWORDS_BIGENDIAN -DMSB_FIRST -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float -D__ppc__
STATIC_LINKING = 1
HAVE_SSE = 0
else ifeq ($(platform), switch)
TARGET := $(TARGET_NAME)_libretro_$(platform).a
include $(LIBTRANSISTOR_HOME)/libtransistor.mk
STATIC_LINKING=1
HAVE_SSE = 0
# Nintendo Switch (libnx)
else ifeq ($(platform), libnx)
include $(DEVKITPRO)/libnx/switch_rules
EXT=a
TARGET := $(TARGET_NAME)_libretro_$(platform).$(EXT)
DEFINES := -DSWITCH=1 -U__linux__ -U__linux -DRARCH_INTERNAL
CFLAGS := $(DEFINES) -g \
-O2 \
-fPIE -I$(LIBNX)/include/ -ffunction-sections -fdata-sections -ftls-model=local-exec -Wl,--allow-multiple-definition -specs=$(LIBNX)/switch.specs
CFLAGS += $(INCDIRS)
CFLAGS += $(INCLUDE) -D__SWITCH__ -DHAVE_LIBNX
CXXFLAGS := $(ASFLAGS) $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
CFLAGS += -std=gnu11
STATIC_LINKING = 1
HAVE_SSE = 0
# ARM
else ifneq (,$(findstring armv,$(platform)))
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T
FLAGS += -pthread
LDFLAGS += -pthread
ifneq (,$(findstring cortexa8,$(platform)))
FLAGS += -marm -mcpu=cortex-a8
else ifneq (,$(findstring cortexa9,$(platform)))
FLAGS += -marm -mcpu=cortex-a9
endif
FLAGS += -marm
ifneq (,$(findstring neon,$(platform)))
FLAGS += -mfpu=neon
HAVE_NEON = 1
endif
ifneq (,$(findstring softfloat,$(platform)))
FLAGS += -mfloat-abi=softfp
else ifneq (,$(findstring hardfloat,$(platform)))
FLAGS += -mfloat-abi=hard
endif
FLAGS += -DARM
HAVE_SSE = 0
# Emscripten
else ifeq ($(platform), emscripten)
TARGET := $(TARGET_NAME)_libretro_$(platform).bc
STATIC_LINKING = 1
# GCW0
else ifeq ($(platform), gcw0)
TARGET := $(TARGET_NAME)_libretro.so
CC = /opt/gcw0-toolchain/usr/bin/mipsel-linux-gcc
CXX = /opt/gcw0-toolchain/usr/bin/mipsel-linux-g++
AR = /opt/gcw0-toolchain/usr/bin/mipsel-linux-ar
SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T
LDFLAGS += $(PTHREAD_FLAGS) -lrt
FLAGS += $(PTHREAD_FLAGS) -DHAVE_MKDIR
FLAGS += -ffast-math -march=mips32 -mtune=mips32r2 -mhard-float
fpic := -fPIC
CFLAGS += -DFAMEC_NO_GOTOS
HAVE_SSE = 0
# Windows MSVC 2017 all architectures
else ifneq (,$(findstring windows_msvc2017,$(platform)))
NO_GCC := 1
PlatformSuffix = $(subst windows_msvc2017_,,$(platform))
ifneq (,$(findstring desktop,$(PlatformSuffix)))
WinPartition = desktop
MSVC2017CompileFlags = -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -FS
LDFLAGS += -MANIFEST -LTCG:incremental -NXCOMPAT -DYNAMICBASE -DEBUG -OPT:REF -INCREMENTAL:NO -SUBSYSTEM:WINDOWS -MANIFESTUAC:"level='asInvoker' uiAccess='false'" -OPT:ICF -ERRORREPORT:PROMPT -NOLOGO -TLBID:1
LIBS += kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
else ifneq (,$(findstring uwp,$(PlatformSuffix)))
WinPartition = uwp
MSVC2017CompileFlags = -DWINAPI_FAMILY=WINAPI_FAMILY_APP -D_WINDLL -D_UNICODE -DUNICODE -D__WRL_NO_DEFAULT_LIB__ -EHsc -FS
LDFLAGS += -APPCONTAINER -NXCOMPAT -DYNAMICBASE -MANIFEST:NO -LTCG -OPT:REF -SUBSYSTEM:CONSOLE -MANIFESTUAC:NO -OPT:ICF -ERRORREPORT:PROMPT -NOLOGO -TLBID:1 -DEBUG:FULL -WINMD:NO
LIBS += WindowsApp.lib
HAVE_UWP = 1
endif
MSVC2017CompileFlags += -DC68K_NO_JUMP_TABLE -DHAVE_C99_VARIADIC_MACROS -DWIN32
FLAGS += $(MSVC2017CompileFlags)
TargetArchMoniker = $(subst $(WinPartition)_,,$(PlatformSuffix))
CC = cl.exe
CXX = cl.exe
LD = link.exe
reg_query = $(call filter_out2,$(subst $2,,$(shell reg query "$2" -v "$1" 2>nul)))
fix_path = $(subst $(SPACE),\ ,$(subst \,/,$1))
ProgramFiles86w := $(shell cmd /c "echo %PROGRAMFILES(x86)%")
ProgramFiles86 := $(shell cygpath "$(ProgramFiles86w)")
WindowsSdkDir ?= $(call reg_query,InstallationFolder,HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0)
WindowsSdkDir ?= $(call reg_query,InstallationFolder,HKEY_CURRENT_USER\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0)
WindowsSdkDir ?= $(call reg_query,InstallationFolder,HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0)
WindowsSdkDir ?= $(call reg_query,InstallationFolder,HKEY_CURRENT_USER\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0)
WindowsSdkDir := $(WindowsSdkDir)
WindowsSDKVersion ?= $(firstword $(foreach folder,$(subst $(subst \,/,$(WindowsSdkDir)Include/),,$(wildcard $(call fix_path,$(WindowsSdkDir)Include\*))),$(if $(wildcard $(call fix_path,$(WindowsSdkDir)Include/$(folder)/um/Windows.h)),$(folder),)))$(BACKSLASH)
WindowsSDKVersion := $(WindowsSDKVersion)
VsInstallBuildTools = $(ProgramFiles86)/Microsoft Visual Studio/2017/BuildTools
VsInstallEnterprise = $(ProgramFiles86)/Microsoft Visual Studio/2017/Enterprise
VsInstallProfessional = $(ProgramFiles86)/Microsoft Visual Studio/2017/Professional
VsInstallCommunity = $(ProgramFiles86)/Microsoft Visual Studio/2017/Community
VsInstallRoot ?= $(shell if [ -d "$(VsInstallBuildTools)" ]; then echo "$(VsInstallBuildTools)"; fi)
ifeq ($(VsInstallRoot), )
VsInstallRoot = $(shell if [ -d "$(VsInstallEnterprise)" ]; then echo "$(VsInstallEnterprise)"; fi)
endif
ifeq ($(VsInstallRoot), )
VsInstallRoot = $(shell if [ -d "$(VsInstallProfessional)" ]; then echo "$(VsInstallProfessional)"; fi)
endif
ifeq ($(VsInstallRoot), )
VsInstallRoot = $(shell if [ -d "$(VsInstallCommunity)" ]; then echo "$(VsInstallCommunity)"; fi)
endif
VsInstallRoot := $(VsInstallRoot)
VcCompilerToolsVer := $(shell cat "$(VsInstallRoot)/VC/Auxiliary/Build/Microsoft.VCToolsVersion.default.txt" | grep -o '[0-9\.]*')
VcCompilerToolsDir := $(VsInstallRoot)/VC/Tools/MSVC/$(VcCompilerToolsVer)
WindowsSDKSharedIncludeDir := $(shell cygpath -w "$(WindowsSdkDir)\Include\$(WindowsSDKVersion)\shared")
WindowsSDKUCRTIncludeDir := $(shell cygpath -w "$(WindowsSdkDir)\Include\$(WindowsSDKVersion)\ucrt")
WindowsSDKUMIncludeDir := $(shell cygpath -w "$(WindowsSdkDir)\Include\$(WindowsSDKVersion)\um")
WindowsSDKUCRTLibDir := $(shell cygpath -w "$(WindowsSdkDir)\Lib\$(WindowsSDKVersion)\ucrt\$(TargetArchMoniker)")
WindowsSDKUMLibDir := $(shell cygpath -w "$(WindowsSdkDir)\Lib\$(WindowsSDKVersion)\um\$(TargetArchMoniker)")
# For some reason the HostX86 compiler doesn't like compiling for x64
# ("no such file" opening a shared library), and vice-versa.
# Work around it for now by using the strictly x86 compiler for x86, and x64 for x64.
# NOTE: What about ARM?
ifneq (,$(findstring x64,$(TargetArchMoniker)))
VCCompilerToolsBinDir := $(VcCompilerToolsDir)\bin\HostX64
else
VCCompilerToolsBinDir := $(VcCompilerToolsDir)\bin\HostX86
endif
PATH := $(shell IFS=$$'\n'; cygpath "$(VCCompilerToolsBinDir)/$(TargetArchMoniker)"):$(PATH)
PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VsInstallRoot)/Common7/IDE")
INCLUDE := $(shell IFS=$$'\n'; cygpath -w "$(VcCompilerToolsDir)/include")
LIB := $(shell IFS=$$'\n'; cygpath -w "$(VcCompilerToolsDir)/lib/$(TargetArchMoniker)")
ifneq (,$(findstring uwp,$(PlatformSuffix)))
LIB := $(shell IFS=$$'\n'; cygpath -w "$(LIB)/store")
endif
export INCLUDE := $(INCLUDE);$(WindowsSDKSharedIncludeDir);$(WindowsSDKUCRTIncludeDir);$(WindowsSDKUMIncludeDir)
export LIB := $(LIB);$(WindowsSDKUCRTLibDir);$(WindowsSDKUMLibDir)
TARGET := $(TARGET_NAME)_libretro.dll
PSS_STYLE :=2
LDFLAGS += -DLL
HAVE_SYS_PARAM_H = 0
ARCH_IS_WINDOWS = 1
HAVE_SSE = 0
# Windows
else
TARGET := $(TARGET_NAME)_libretro.dll
CC ?= gcc
CXX ?= g++
SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T
LDFLAGS += -static-libgcc -static-libstdc++ -lwinmm
HAVE_FSEEKO = 1
ARCH_IS_WINDOWS = 1
#DYNAREC = 2
endif
include Makefile.common
ifeq ($(HAVE_SYS_PARAM_H), 1)
FLAGS += -DHAVE_SYS_PARAM_H
endif
ifeq ($(HAVE_FSEEKO), 1)
FLAGS += -DHAVE_FSEEKO
endif
ifeq ($(HAVE_MUSASHI), 1)
FLAGS += -DHAVE_MUSASHI=1
else
OBJECTS += $(C68KEXEC_OBJECT)
endif
OBJECTS += $(OBJECTS_C) $(OBJECTS_CXX)
LDFLAGS += $(fpic) $(SHARED)
FLAGS += $(fpic)
INCFLAGS := $(foreach dir,$(INCLUDE_DIRS),-I$(dir))
WARNINGS :=
FLAGS += $(INCFLAGS) -D__LIBRETRO__ $(ENDIANNESS_DEFINES) -DSIZEOF_DOUBLE=8 $(WARNINGS) -DUSE_16BPP=1 -DUSE_RGB_565=1 \
-DNO_CLI -DHAVE_SYS_TIME_H -DHAVE_GETTIMEOFDAY -DHAVE_STDINT_H=1 -DVERSION=\"0.9.15\" -DHAVE_STRCASECMP \
-DHAVE_LROUND -D_7ZIP_ST -DFLAC__HAS_OGG=0 -DFLAC__NO_DLL -DHAVE_C99_VARIADIC_MACROS=1
CXXFLAGS += $(FLAGS)
CFLAGS += $(FLAGS)
C68KFLAGS += $(FLAGS)
ifeq (,$(findstring msvc,$(platform)))
ifeq ($(platform),qnx)
CFLAGS += -Wc,-std=c99
else
CFLAGS += -std=gnu99
endif
endif
ifeq ($(USE_PLAY_JIT),1)
CXXFLAGS += -std=c++11 -fexceptions -frtti
else
CXXFLAGS += -std=gnu++99
endif
OBJOUT = -o
LINKOUT = -o
ifneq (,$(findstring msvc,$(platform)))
OBJOUT = -Fo
LINKOUT = -out:
LD = link.exe
else
LD = $(CXX)
endif
ifeq ($(DEBUG_ASAN), 1)
DEBUG = 1
DEBUG_UBSAN = 0
FLAGS += -lasan -fsanitize=address
LDFLAGS += -lasan -fsanitize=address
endif
ifeq ($(DEBUG_UBSAN), 1)
DEBUG = 1
FLAGS += -lubsan -fsanitize=undefined
LDFLAGS += -lubsan -fsanitize=undefined
endif
ifeq ($(DEBUG_TSAN), 1)
DEBUG = 1
FLAGS += -ltsan -fsanitize=thread
LDFLAGS += -ltsan -fsanitize=thread
endif
ifeq ($(FASTMATH), 1)
ifeq (,$(findstring msvc,$(platform)))
FLAGS += -ffast-math
endif
endif
ifeq ($(HAVE_SSE),1)
FLAGS += -mfpmath=sse
endif
ifeq ($(DEBUG), 1)
ifneq (,$(findstring msvc,$(platform)))
ifeq ($(STATIC_LINKING),1)
CFLAGS += -MTd
CXXFLAGS += -MTd
C68KFLAGS += -MTd
else
CFLAGS += -MDd
CXXFLAGS += -MDd
C68KFLAGS += -MDd
endif
CFLAGS += -Od -Zi -DDEBUG -D_DEBUG
CXXFLAGS += -Od -Zi -DDEBUG -D_DEBUG
C68KFLAGS += -Od -Zi -DDEBUG -D_DEBUG
else
CFLAGS += -O0 -g -DDEBUG
CXXFLAGS += -O0 -g -DDEBUG
C68KFLAGS += -O0 -g -DDEBUG
endif
else
ifneq (,$(findstring msvc,$(platform)))
ifeq ($(STATIC_LINKING),1)
CFLAGS += -MT
CXXFLAGS += -MT
C68KFLAGS += -MT
else
CFLAGS += -MD
CXXFLAGS += -MD
C68KFLAGS += -MD
endif
CFLAGS += -O2 -DNDEBUG
CXXFLAGS += -O2 -DNDEBUG
C68KFLAGS += -O0 -DNDEBUG
else
CFLAGS += -O3 -DNDEBUG
CXXFLAGS += -O3 -DNDEBUG
C68KFLAGS += -O0 -DNDEBUG
endif
endif
all: $(TARGET)
generate-files:
ifeq ($(HAVE_MUSASHI), 1)
$(CC) -o $(SOURCE_DIR)/musashi/$(M68KMAKE_EXE) $(SOURCE_DIR)/musashi/m68kmake.c;\
$(SOURCE_DIR)/musashi/$(M68KMAKE_EXE) $(SOURCE_DIR)/musashi/ $(SOURCE_DIR)/musashi/m68k_in.c
else
$(CC) -DC68K_GEN -o $(SOURCE_DIR)/c68k/$(GEN68K_EXE) $(SOURCE_DIR)/c68k/c68kexec.c $(SOURCE_DIR)/c68k/c68k.c $(SOURCE_DIR)/c68k/gen68k.c;\
cd $(SOURCE_DIR)/c68k/; ./$(GEN68K_EXE)
endif
generate-files-clean:
rm -f $(M68KMAKE_INC_SOURCES) $(SOURCE_DIR)/musashi/$(M68KMAKE_EXE) $(GEN68K_INC_SOURCES) $(SOURCE_DIR)/c68k/$(GEN68K_EXE)
$(TARGET): $(OBJECTS)
ifeq ($(STATIC_LINKING), 1)
$(AR) rcs $@ $(OBJECTS)
else
$(LD) $(LDFLAGS) $(LINKOUT)$@ $(OBJECTS) $(LIBS)
endif
%.S.o: %.S
$(CC_AS) $(CFLAGS) -c $^ -o $@
%.s.o: %.s
$(CC_AS) $(CFLAGS) -c $^ -o $@
%.cpp.o: %.cpp
$(CXX) -c $(OBJOUT)$@ $< $(CXXFLAGS)
%.c.o: %.c
$(CC) -c $(OBJOUT)$@ $< $(CFLAGS)
$(C68KEXEC_OBJECT): $(C68KEXEC_SOURCE)
$(CC) -c $(OBJOUT)$@ $< $(C68KFLAGS)
clean:
rm -f $(TARGET) $(OBJECTS) $(SOURCE_DIR)/musashi/$(M68KMAKE_EXE) $(SOURCE_DIR)/c68k/$(GEN68K_EXE)
.PHONY: clean

View File

@ -0,0 +1,100 @@
compiler := gcc
extra_flags :=
use_neon := 0
build = release
DYLIB := so
PREFIX := /usr
INSTALLDIR := $(PREFIX)/lib/retroarch/filters/audio
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
arch = intel
ifeq ($(shell uname -p),powerpc)
arch = ppc
endif
else ifneq ($(findstring win,$(shell uname -a)),)
platform = win
endif
endif
ifeq ($(platform),gcc)
extra_rules_gcc := $(shell $(compiler) -dumpmachine)
endif
ifneq (,$(findstring armv7,$(extra_rules_gcc)))
extra_flags += -mcpu=cortex-a9 -mtune=cortex-a9 -mfpu=neon
use_neon := 1
endif
ifneq (,$(findstring hardfloat,$(extra_rules_gcc)))
extra_flags += -mfloat-abi=hard
endif
ifeq (release,$(build))
extra_flags += -O2
endif
ifeq (debug,$(build))
extra_flags += -O0 -g
endif
ldflags := $(LDFLAGS) -shared -lm -Wl,--version-script=link.T
ifeq ($(platform), unix)
DYLIB = so
else ifeq ($(platform), osx)
compiler := $(CC)
DYLIB = dylib
ldflags := -dynamiclib
else
extra_flags += -static-libgcc -static-libstdc++
DYLIB = dll
endif
CC := $(compiler) -Wall
CXX := $(subst CC,++,$(compiler)) -std=gnu++0x -Wall
flags := $(CPPFLAGS) $(CFLAGS) -fPIC $(extra_flags) -I../../include
asflags := $(ASFLAGS) -fPIC $(extra_flags)
objects :=
ifeq (1,$(use_neon))
ASMFLAGS := -INEON/asm
asflags += -mfpu=neon
endif
plugs := $(wildcard *.c)
objects := $(plugs:.c=.o)
targets := $(objects:.o=.$(DYLIB))
all: build;
%.o: %.S
$(CC) -c -o $@ $(asflags) $(ASMFLAGS) $<
%.o: %.c
$(CC) -c -o $@ $(flags) $<
%.$(DYLIB): %.o
$(CC) -o $@ $(ldflags) $(flags) $^
build: $(targets)
clean:
rm -f *.o
rm -f *.$(DYLIB)
strip:
strip -s *.$(DYLIB)
install:
mkdir -p $(DESTDIR)$(INSTALLDIR)
cp -t $(DESTDIR)$(INSTALLDIR) $(targets) *.dsp
test-install:
DESTDIR=/tmp/build $(MAKE) install

View File

@ -0,0 +1,26 @@
TARGET := rxml
LIBRETRO_XML_DIR := ..
LIBRETRO_COMM_DIR := ../../..
SOURCES := \
rxml_test.c \
$(LIBRETRO_XML_DIR)/rxml.c \
$(LIBRETRO_COMM_DIR)/streams/file_stream.c
OBJS := $(SOURCES:.c=.o)
CFLAGS += -DRXML_TEST -Wall -pedantic -std=gnu99 -g -I$(LIBRETRO_COMM_DIR)/include
all: $(TARGET)
%.o: %.c
$(CC) -c -o $@ $< $(CFLAGS)
$(TARGET): $(OBJS)
$(CC) -o $@ $^ $(LDFLAGS)
clean:
rm -f $(TARGET) $(OBJS)
.PHONY: clean

View File

@ -0,0 +1,31 @@
TARGET := nbio_test
LIBRETRO_COMM_DIR := ../../..
SOURCES := \
nbio_test.c \
$(LIBRETRO_COMM_DIR)/compat/fopen_utf8.c \
$(LIBRETRO_COMM_DIR)/compat/compat_strl.c \
$(LIBRETRO_COMM_DIR)/encodings/encoding_utf.c \
$(LIBRETRO_COMM_DIR)/file/nbio/nbio_intf.c \
$(LIBRETRO_COMM_DIR)/file/nbio/nbio_linux.c \
$(LIBRETRO_COMM_DIR)/file/nbio/nbio_unixmmap.c \
$(LIBRETRO_COMM_DIR)/file/nbio/nbio_windowsmmap.c \
$(LIBRETRO_COMM_DIR)/file/nbio/nbio_stdio.c
OBJS := $(SOURCES:.c=.o)
CFLAGS += -Wall -pedantic -std=gnu99 -g -I$(LIBRETRO_COMM_DIR)/include
all: $(TARGET)
%.o: %.c
$(CC) -c -o $@ $< $(CFLAGS)
$(TARGET): $(OBJS)
$(CC) -o $@ $^ $(LDFLAGS)
clean:
rm -f $(TARGET) $(OBJS)
.PHONY: clean

View File

@ -0,0 +1,57 @@
TARGET := rpng
CORE_DIR := .
LIBRETRO_PNG_DIR := ../../../formats/png
LIBRETRO_COMM_DIR := ../../..
HAVE_IMLIB2=0
LDFLAGS += -lz
ifeq ($(HAVE_IMLIB2),1)
CFLAGS += -DHAVE_IMLIB2
LDFLAGS += -lImlib2
endif
SOURCES_C := \
$(CORE_DIR)/rpng_test.c \
$(LIBRETRO_PNG_DIR)/rpng.c \
$(LIBRETRO_PNG_DIR)/rpng_encode.c \
$(LIBRETRO_COMM_DIR)/encodings/encoding_crc32.c \
$(LIBRETRO_COMM_DIR)/encodings/encoding_utf.c \
$(LIBRETRO_COMM_DIR)/string/stdstring.c \
$(LIBRETRO_COMM_DIR)/compat/fopen_utf8.c \
$(LIBRETRO_COMM_DIR)/compat/compat_strl.c \
$(LIBRETRO_COMM_DIR)/compat/compat_posix_string.c \
$(LIBRETRO_COMM_DIR)/compat/compat_strcasestr.c \
$(LIBRETRO_COMM_DIR)/file/nbio/nbio_intf.c \
$(LIBRETRO_COMM_DIR)/file/nbio/nbio_stdio.c \
$(LIBRETRO_COMM_DIR)/file/nbio/nbio_linux.c \
$(LIBRETRO_COMM_DIR)/file/nbio/nbio_unixmmap.c \
$(LIBRETRO_COMM_DIR)/file/nbio/nbio_windowsmmap.c \
$(LIBRETRO_COMM_DIR)/file/archive_file.c \
$(LIBRETRO_COMM_DIR)/file/archive_file_zlib.c \
$(LIBRETRO_COMM_DIR)/file/file_path.c \
$(LIBRETRO_COMM_DIR)/streams/file_stream.c \
$(LIBRETRO_COMM_DIR)/vfs/vfs_implementation.c \
$(LIBRETRO_COMM_DIR)/streams/trans_stream.c \
$(LIBRETRO_COMM_DIR)/streams/trans_stream_zlib.c \
$(LIBRETRO_COMM_DIR)/streams/trans_stream_pipe.c \
$(LIBRETRO_COMM_DIR)/lists/string_list.c
OBJS := $(SOURCES_C:.c=.o)
CFLAGS += -Wall -pedantic -std=gnu99 -O0 -g -DHAVE_ZLIB -DRPNG_TEST -I$(LIBRETRO_COMM_DIR)/include
all: $(TARGET)
%.o: %.c
$(CC) -c -o $@ $< $(CFLAGS)
$(TARGET): $(OBJS)
$(CC) -o $@ $^ $(LDFLAGS)
clean:
rm -f $(TARGET) $(OBJS)
.PHONY: clean

View File

@ -0,0 +1,64 @@
TARGETS = http_test net_ifinfo
LIBRETRO_COMM_DIR := ../..
INCFLAGS = -I$(LIBRETRO_COMM_DIR)/include
ifeq ($(platform),)
platform = unix
ifeq ($(shell uname -a),)
platform = win
else ifneq ($(findstring Darwin,$(shell uname -a)),)
platform = osx
arch = intel
ifeq ($(shell uname -p),powerpc)
arch = ppc
endif
else ifneq ($(findstring MINGW,$(shell uname -a)),)
platform = win
endif
endif
ifeq ($(DEBUG),1)
CFLAGS += -O0 -g
else
CFLAGS += -O2
endif
CFLAGS += -Wall -pedantic -std=gnu99
HTTP_TEST_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)/compat/compat_strl.c \
$(LIBRETRO_COMM_DIR)/encodings/encoding_utf.c \
$(LIBRETRO_COMM_DIR)/string/stdstring.c \
net_http_test.c
HTTP_TEST_OBJS := $(HTTP_TEST_C:.c=.o)
NET_IFINFO_C = \
$(LIBRETRO_COMM_DIR)/net/net_ifinfo.c \
net_ifinfo_test.c
ifeq ($(platform), win)
CFLAGS += -liphlpapi -lws2_32
endif
NET_IFINFO_OBJS := $(NET_IFINFO_C:.c=.o)
.PHONY: all clean
all: $(TARGETS)
%.o: %.c
$(CC) $(INCFLAGS) $< -c $(CFLAGS) -o $@
http_test: $(HTTP_TEST_OBJS)
$(CC) $(INCFLAGS) $(HTTP_TEST_OBJS) $(CFLAGS) -o $@
net_ifinfo: $(NET_IFINFO_OBJS)
$(CC) $(INCFLAGS) $(NET_IFINFO_OBJS) $(CFLAGS) -o $@
clean:
rm -rf $(TARGETS) $(HTTP_TEST_OBJS) $(NET_IFINFO_OBJS)

View File

@ -0,0 +1,102 @@
compiler := gcc
extra_flags :=
use_neon := 0
release := release
EXE_EXT :=
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
arch = intel
ifeq ($(shell uname -p),powerpc)
arch = ppc
endif
else ifneq ($(findstring win,$(shell uname -a)),)
platform = win
endif
endif
ifeq ($(compiler),gcc)
extra_rules_gcc := $(shell $(compiler) -dumpmachine)
endif
ifneq (,$(findstring armv7,$(extra_rules_gcc)))
extra_flags += -mcpu=cortex-a9 -mtune=cortex-a9 -mfpu=neon
use_neon := 1
endif
ifneq (,$(findstring hardfloat,$(extra_rules_gcc)))
extra_flags += -mfloat-abi=hard
endif
ifeq (release,$(build))
extra_flags += -O2
endif
ifeq (debug,$(build))
extra_flags += -O0 -g
endif
ldflags :=
EXE_EXT :=
ifeq ($(platform), unix)
else ifeq ($(platform), osx)
compiler := $(CC)
else
EXE_EXT = .exe
endif
LIBRETRO_COMM_DIR := ../..
CORE_DIR := $(LIBRETRO_COMM_DIR)/utils
CC := $(compiler)
CXX := $(subst CC,++,$(compiler))
flags := -I$(LIBRETRO_COMM_DIR)/include
asflags := $(extra_flags)
LDFLAGS :=
flags += -std=c99 -DMD5_BUILD_UTILITY -DSHA1_BUILD_UTILITY
ifeq (1,$(use_neon))
ASMFLAGS := -INEON/asm
asflags += -mfpu=neon
endif
OBJS += $(CORE_DIR)/djb2.o \
$(CORE_DIR)/md5.o \
$(CORE_DIR)/sha1.o \
$(CORE_DIR)/sha1_main.o \
$(CORE_DIR)/crc32.o
UTILS := djb2$(EXE_EXT) md5$(EXE_EXT) sha1$(EXE_EXT) crc32$(EXE_EXT)
all: $(UTILS)
djb2$(EXE_EXT): $(CORE_DIR)/djb2.o
md5$(EXE_EXT): $(CORE_DIR)/md5.o
sha1$(EXE_EXT): $(CORE_DIR)/sha1.o $(CORE_DIR)/sha1_main.o
crc32$(EXE_EXT): $(CORE_DIR)/crc32.o $(CORE_DIR)/../encodings/encoding_crc32.o
%.o: %.S
$(CC) -c -o $@ $(asflags) $(LDFLAGS) $(ASMFLAGS) $<
%.o: %.c
$(CC) -c -o $@ $(flags) $<
$(UTILS):
$(CC) -o $@ $(ldflags) $(flags) $^
clean:
rm -f $(CORE_DIR)/*.o
rm -f $(UTILS)
strip:
strip -s $(UTILS)