mirror of
https://github.com/wiiu-env/wut.git
synced 2024-12-05 03:24:17 +01:00
First pass at adopting a devkitPro-style build system, see details:
- Added wut_rules and wut/rpx/rpl.specs to share/ - Replaced wut's CMake-based buildsystem with a standard Makefile - Conflated all wut libraries into a single libwut.a library - wut's old buildsystems (CMake & plain make) are broken as a result, this will be fixed in the future - Docs, tests and samples are not buildable either at the moment - wutcrt/wutnewlib: - RPX start function is __rpx_start, while RPL is __rpl_start - __init/fini_wut_* functions are no longer weak - __init_wut/__fini_wut are instead weak - Removed _exit implementation - exit syscall now points to _Exit instead of pointing to itself - wutstdc++: - Renamed .cc files to .cpp - Temporarily disabled, due to an issue that will be addressed shortly - wutdevoptab: - Fixed uninitialized variable warnings in __wut_fs_read/write
This commit is contained in:
parent
c86282fd7a
commit
ee3bb10df4
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,9 +1,12 @@
|
||||
build/
|
||||
release/
|
||||
debug/
|
||||
lib/
|
||||
*.a
|
||||
*.o
|
||||
*.d
|
||||
*.elf
|
||||
*.bz2
|
||||
docs/html/
|
||||
.vs/
|
||||
CMakeSettings.json
|
||||
|
0
.gitmodules
vendored
0
.gitmodules
vendored
@ -1,38 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
set(WUT_ROOT "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set(ENV{WUT_ROOT} "${WUT_ROOT}")
|
||||
set(CMAKE_TOOLCHAIN_FILE "${WUT_ROOT}/share/wut.toolchain.cmake")
|
||||
|
||||
project(wut)
|
||||
option(WUT_BUILD_DOCS "Build documentation" OFF)
|
||||
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/lib")
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/lib")
|
||||
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/lib")
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/lib")
|
||||
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/bin")
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/bin")
|
||||
|
||||
if(WUT_BUILD_DOCS)
|
||||
add_subdirectory(docs)
|
||||
endif()
|
||||
|
||||
find_program(WUT_RPLIMPORTGEN NAMES rplimportgen PATHS "${DEVKITPRO}/tools/bin")
|
||||
if(NOT WUT_RPLIMPORTGEN)
|
||||
message(FATAL_ERROR "Could not find rplimportgen.")
|
||||
endif()
|
||||
|
||||
add_subdirectory(cafe)
|
||||
add_subdirectory(libraries)
|
||||
|
||||
install(DIRECTORY "${CMAKE_SOURCE_DIR}/include/"
|
||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/include"
|
||||
FILES_MATCHING PATTERN "*.h*")
|
||||
|
||||
install(DIRECTORY "${CMAKE_SOURCE_DIR}/share/"
|
||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/share")
|
164
Makefile
Normal file
164
Makefile
Normal file
@ -0,0 +1,164 @@
|
||||
|
||||
TOPDIR ?= $(CURDIR)
|
||||
include $(TOPDIR)/share/wut_rules
|
||||
|
||||
export WUT_MAJOR := 1
|
||||
export WUT_MINOR := 0
|
||||
export WUT_PATCH := 0
|
||||
|
||||
VERSION := $(WUT_MAJOR).$(WUT_MINOR).$(WUT_PATCH)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# 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 := wut
|
||||
#BUILD := build
|
||||
SOURCES := cafe \
|
||||
libraries/wutcrt \
|
||||
libraries/wutnewlib \
|
||||
libraries/wutstdc++ \
|
||||
libraries/wutmalloc \
|
||||
libraries/wutdevoptab \
|
||||
libraries/libwhb/src \
|
||||
libraries/libgfd/src \
|
||||
libraries/nn_swkbd
|
||||
DATA := data
|
||||
INCLUDES := include \
|
||||
libraries/libwhb/include \
|
||||
libraries/libgfd/include \
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
CFLAGS := -g -Wall -Werror -save-temps \
|
||||
-ffunction-sections -fdata-sections \
|
||||
$(MACHDEP) \
|
||||
$(BUILD_CFLAGS)
|
||||
|
||||
CFLAGS += $(INCLUDE) -D__WIIU__ -D__WUT__
|
||||
|
||||
CXXFLAGS := $(CFLAGS) -std=gnu++17
|
||||
|
||||
ASFLAGS := -g $(MACHDEP)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS :=
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# 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 TOPDIR := $(CURDIR)
|
||||
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
DEFFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.def)))
|
||||
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_BIN := $(addsuffix .o,$(BINFILES))
|
||||
export OFILES_SRC := $(DEFFILES:.def=.o) $(SFILES:.s=.o) $(CFILES:.c=.o) $(CPPFILES:.cpp=.o)
|
||||
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
||||
export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I.
|
||||
|
||||
.PHONY: all dist-bin dist-src dist install clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
all: lib/libwut.a lib/libwutd.a
|
||||
|
||||
dist-bin: all
|
||||
@tar --exclude=*~ -cjf wut-$(VERSION).tar.bz2 include lib share -C libraries/libwhb include -C ../libgfd include
|
||||
|
||||
dist-src:
|
||||
@tar --exclude=*~ -cjf wut-src-$(VERSION).tar.bz2 cafe include libraries share Makefile
|
||||
|
||||
dist: dist-src dist-bin
|
||||
|
||||
install: dist-bin
|
||||
mkdir -p $(DESTDIR)$(DEVKITPRO)/wut
|
||||
bzip2 -cd wut-$(VERSION).tar.bz2 | tar -xf - -C $(DESTDIR)$(DEVKITPRO)/wut
|
||||
|
||||
lib:
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
|
||||
release:
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
|
||||
debug:
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
|
||||
lib/libwut.a : lib release $(SOURCES) $(INCLUDES)
|
||||
@$(MAKE) BUILD=release OUTPUT=$(CURDIR)/$@ \
|
||||
BUILD_CFLAGS="-DNDEBUG=1 -O2" \
|
||||
DEPSDIR=$(CURDIR)/release \
|
||||
--no-print-directory -C release \
|
||||
-f $(CURDIR)/Makefile
|
||||
|
||||
lib/libwutd.a : lib debug $(SOURCES) $(INCLUDES)
|
||||
@$(MAKE) BUILD=debug OUTPUT=$(CURDIR)/$@ \
|
||||
BUILD_CFLAGS="-DDEBUG=1 -Og" \
|
||||
DEPSDIR=$(CURDIR)/debug \
|
||||
--no-print-directory -C debug \
|
||||
-f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -rf release debug lib
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT) : $(OFILES)
|
||||
|
||||
$(OFILES_SRC) : $(HFILES)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%_bin.h %.bin.o : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
|
@ -1,87 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
|
||||
# Load up the in-tree toolchain
|
||||
set(WUT_ROOT "{CMAKE_CURRENT_SOURCE_DIR}/.." CACHE STRING "")
|
||||
set(WUT_RPLIMPORTGEN "" CACHE STRING "")
|
||||
set(ENV{WUT_ROOT} ${WUT_ROOT})
|
||||
set(CMAKE_TOOLCHAIN_FILE $ENV{WUT_ROOT}/share/wut.toolchain.cmake)
|
||||
|
||||
project(cafe C CXX)
|
||||
enable_language(ASM)
|
||||
|
||||
macro(add_cafe_library target)
|
||||
add_custom_command(
|
||||
OUTPUT ${target}.s
|
||||
COMMAND ${WUT_RPLIMPORTGEN} ${CMAKE_CURRENT_SOURCE_DIR}/${target}.def ${target}.s
|
||||
DEPENDS ${target}.def)
|
||||
|
||||
add_library(${target} STATIC ${target}.s)
|
||||
install(TARGETS ${target} ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
endmacro()
|
||||
|
||||
add_cafe_library(avm)
|
||||
add_cafe_library(camera)
|
||||
add_cafe_library(coreinit)
|
||||
add_cafe_library(dc)
|
||||
add_cafe_library(dmae)
|
||||
add_cafe_library(drmapp)
|
||||
add_cafe_library(erreula)
|
||||
add_cafe_library(gx2)
|
||||
add_cafe_library(h264)
|
||||
add_cafe_library(lzma920)
|
||||
add_cafe_library(mic)
|
||||
add_cafe_library(nfc)
|
||||
add_cafe_library(nio_prof)
|
||||
add_cafe_library(nlibcurl)
|
||||
add_cafe_library(nlibnss)
|
||||
add_cafe_library(nlibnss2)
|
||||
add_cafe_library(nn_ac)
|
||||
add_cafe_library(nn_acp)
|
||||
add_cafe_library(nn_act)
|
||||
add_cafe_library(nn_aoc)
|
||||
add_cafe_library(nn_boss)
|
||||
add_cafe_library(nn_ccr)
|
||||
add_cafe_library(nn_cmpt)
|
||||
add_cafe_library(nn_dlp)
|
||||
add_cafe_library(nn_ec)
|
||||
add_cafe_library(nn_fp)
|
||||
add_cafe_library(nn_hai)
|
||||
add_cafe_library(nn_hpad)
|
||||
add_cafe_library(nn_idbe)
|
||||
add_cafe_library(nn_ndm)
|
||||
add_cafe_library(nn_nets2)
|
||||
add_cafe_library(nn_nfp)
|
||||
add_cafe_library(nn_nim)
|
||||
add_cafe_library(nn_olv)
|
||||
add_cafe_library(nn_pdm)
|
||||
add_cafe_library(nn_save)
|
||||
add_cafe_library(nn_sl)
|
||||
add_cafe_library(nn_spm)
|
||||
add_cafe_library(nn_temp)
|
||||
add_cafe_library(nn_uds)
|
||||
add_cafe_library(nn_vctl)
|
||||
add_cafe_library(nsysccr)
|
||||
add_cafe_library(nsyshid)
|
||||
add_cafe_library(nsyskbd)
|
||||
add_cafe_library(nsysnet)
|
||||
add_cafe_library(nsysuhs)
|
||||
add_cafe_library(nsysuvd)
|
||||
add_cafe_library(ntag)
|
||||
add_cafe_library(padscore)
|
||||
add_cafe_library(proc_ui)
|
||||
add_cafe_library(snd_core)
|
||||
add_cafe_library(snd_user)
|
||||
add_cafe_library(sndcore2)
|
||||
add_cafe_library(snduser2)
|
||||
add_cafe_library(swkbd)
|
||||
add_cafe_library(sysapp)
|
||||
add_cafe_library(tcl)
|
||||
add_cafe_library(tve)
|
||||
add_cafe_library(uac)
|
||||
add_cafe_library(uac_rpl)
|
||||
add_cafe_library(usb_mic)
|
||||
add_cafe_library(uvc)
|
||||
add_cafe_library(uvd)
|
||||
add_cafe_library(vpad)
|
||||
add_cafe_library(vpadbase)
|
||||
add_cafe_library(zlib125)
|
@ -1,18 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
|
||||
# Load up the in-tree toolchain
|
||||
set(WUT_ROOT "{CMAKE_CURRENT_SOURCE_DIR}/.." CACHE STRING "")
|
||||
set(ENV{WUT_ROOT} ${WUT_ROOT})
|
||||
set(CMAKE_TOOLCHAIN_FILE $ENV{WUT_ROOT}/share/wut.toolchain.cmake)
|
||||
|
||||
project(libraries C)
|
||||
|
||||
add_definitions(-Wall -Werror)
|
||||
add_subdirectory(libgfd)
|
||||
add_subdirectory(libwhb)
|
||||
add_subdirectory(nn_swkbd)
|
||||
add_subdirectory(wutcrt)
|
||||
add_subdirectory(wutdevoptab)
|
||||
add_subdirectory(wutmalloc)
|
||||
add_subdirectory(wutnewlib)
|
||||
add_subdirectory(wutstdc++)
|
@ -1,15 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
project(libgfd)
|
||||
|
||||
add_library(gfd STATIC
|
||||
src/gfd.c
|
||||
include/gfd.h)
|
||||
|
||||
target_include_directories(gfd PRIVATE "../../include")
|
||||
target_include_directories(gfd PUBLIC "include")
|
||||
|
||||
install(TARGETS gfd
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/
|
||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/include"
|
||||
FILES_MATCHING PATTERN "*.h*")
|
@ -1,42 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
project(libwhb)
|
||||
|
||||
add_library(whb STATIC
|
||||
src/commandserver.c
|
||||
src/console.c
|
||||
src/crash.c
|
||||
src/file.c
|
||||
src/gfx.c
|
||||
src/gfx_heap.c
|
||||
src/gfx_heap.h
|
||||
src/gfx_shader.c
|
||||
src/gfx_texture.c
|
||||
src/libmanager.c
|
||||
src/log.c
|
||||
src/log_cafe.c
|
||||
src/log_udp.c
|
||||
src/proc.c
|
||||
src/sdcard.c
|
||||
include/whb/align.h
|
||||
include/whb/commandserver.h
|
||||
include/whb/crash.h
|
||||
include/whb/file.h
|
||||
include/whb/gfx.h
|
||||
include/whb/libmanager.h
|
||||
include/whb/log_cafe.h
|
||||
include/whb/log_console.h
|
||||
include/whb/log.h
|
||||
include/whb/log_udp.h
|
||||
include/whb/proc.h
|
||||
include/whb/sdcard.h)
|
||||
|
||||
target_include_directories(whb PRIVATE "../../include")
|
||||
target_include_directories(whb PRIVATE "../libgfd/include")
|
||||
target_include_directories(whb PUBLIC "include")
|
||||
|
||||
install(TARGETS whb
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/
|
||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/include"
|
||||
FILES_MATCHING PATTERN "*.h*")
|
||||
|
@ -1,14 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
project(nn_swkbd CXX)
|
||||
|
||||
add_library(nn_swkbd
|
||||
nn_swkbd.cpp)
|
||||
|
||||
target_include_directories(nn_swkbd
|
||||
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include" "${WUT_ROOT}/include")
|
||||
|
||||
install(TARGETS nn_swkbd
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/"
|
||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/include"
|
||||
FILES_MATCHING PATTERN "*.h*")
|
@ -1,16 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
project(wutcrt C ASM)
|
||||
|
||||
add_library(wutcrt
|
||||
crt0_rpx.s
|
||||
wut_crt.c)
|
||||
|
||||
add_library(wutcrtrpl
|
||||
crt0_rpl.s
|
||||
wut_crt.c)
|
||||
|
||||
target_include_directories(wutcrt PRIVATE "${WUT_ROOT}/include")
|
||||
target_include_directories(wutcrtrpl PRIVATE "${WUT_ROOT}/include")
|
||||
|
||||
install(TARGETS wutcrt wutcrtrpl
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
|
@ -3,8 +3,8 @@
|
||||
.extern __init_wut
|
||||
.extern __fini_wut
|
||||
|
||||
.global _start
|
||||
_start:
|
||||
.global __rpl_start
|
||||
__rpl_start:
|
||||
stwu 1, -0x14(1)
|
||||
mflr 0
|
||||
stw 0, 0x18(1)
|
||||
|
@ -3,8 +3,8 @@
|
||||
.extern __init_wut
|
||||
.extern __fini_wut
|
||||
|
||||
.global _start
|
||||
_start:
|
||||
.global __rpx_start
|
||||
__rpx_start:
|
||||
stwu 1, -0x14(1)
|
||||
mflr 0
|
||||
stw 0, 0x18(1)
|
||||
|
@ -1,48 +1,23 @@
|
||||
extern void __init_wut_newlib() __attribute__((weak));
|
||||
extern void __init_wut_devoptab() __attribute__((weak));
|
||||
extern void __init_wut_stdcpp() __attribute__((weak));
|
||||
void __init_wut_newlib();
|
||||
void __init_wut_stdcpp();
|
||||
void __init_wut_devoptab();
|
||||
|
||||
extern void __fini_wut_devoptab() __attribute__((weak));
|
||||
extern void __fini_wut_newlib() __attribute__((weak));
|
||||
extern void __fini_wut_stdcpp() __attribute__((weak));
|
||||
void __fini_wut_newlib();
|
||||
void __fini_wut_stdcpp();
|
||||
void __fini_wut_devoptab();
|
||||
|
||||
void
|
||||
void __attribute__((weak))
|
||||
__init_wut()
|
||||
{
|
||||
if (__init_wut_newlib) {
|
||||
__init_wut_newlib();
|
||||
}
|
||||
|
||||
if (__init_wut_devoptab) {
|
||||
__init_wut_devoptab();
|
||||
}
|
||||
|
||||
if (__init_wut_stdcpp) {
|
||||
__init_wut_stdcpp();
|
||||
}
|
||||
__init_wut_newlib();
|
||||
//__init_wut_stdcpp();
|
||||
__init_wut_devoptab();
|
||||
}
|
||||
|
||||
void
|
||||
void __attribute__((weak))
|
||||
__fini_wut()
|
||||
{
|
||||
if (__fini_wut_stdcpp) {
|
||||
__fini_wut_stdcpp();
|
||||
}
|
||||
|
||||
if (__fini_wut_devoptab) {
|
||||
__fini_wut_devoptab();
|
||||
}
|
||||
|
||||
if (__fini_wut_newlib) {
|
||||
__fini_wut_newlib();
|
||||
}
|
||||
}
|
||||
|
||||
// Forward newlib _exit to the coreinit.rpl _Exit
|
||||
extern void _Exit(int status);
|
||||
|
||||
void
|
||||
_exit(int status)
|
||||
{
|
||||
_Exit(status);
|
||||
__fini_wut_devoptab();
|
||||
//__fini_wut_stdcpp();
|
||||
__fini_wut_newlib();
|
||||
}
|
||||
|
@ -1,34 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
project(wutdevoptab C)
|
||||
|
||||
add_library(wutdevoptab
|
||||
devoptab_fs.c
|
||||
devoptab_fs_chdir.c
|
||||
devoptab_fs_chmod.c
|
||||
devoptab_fs_close.c
|
||||
devoptab_fs_dirclose.c
|
||||
devoptab_fs_dirnext.c
|
||||
devoptab_fs_diropen.c
|
||||
devoptab_fs_dirreset.c
|
||||
devoptab_fs_fchmod.c
|
||||
devoptab_fs_fstat.c
|
||||
devoptab_fs_fsync.c
|
||||
devoptab_fs_getmtime.c
|
||||
devoptab_fs_link.c
|
||||
devoptab_fs_mkdir.c
|
||||
devoptab_fs_open.c
|
||||
devoptab_fs_read.c
|
||||
devoptab_fs_rename.c
|
||||
devoptab_fs_rmdir.c
|
||||
devoptab_fs_seek.c
|
||||
devoptab_fs_stat.c
|
||||
devoptab_fs_statvfs.c
|
||||
devoptab_fs_truncate.c
|
||||
devoptab_fs_unlink.c
|
||||
devoptab_fs_utils.c
|
||||
devoptab_fs_write.c)
|
||||
|
||||
target_include_directories(wutdevoptab PRIVATE "${WUT_ROOT}/include")
|
||||
|
||||
install(TARGETS wutdevoptab
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
|
@ -6,7 +6,7 @@ __wut_fs_read(struct _reent *r,
|
||||
char *ptr,
|
||||
size_t len)
|
||||
{
|
||||
FSStatus status;
|
||||
FSStatus status = 0;
|
||||
FSCmdBlock cmd;
|
||||
uint8_t *alignedReadBuffer;
|
||||
uint32_t bytes, bytesRead;
|
||||
|
@ -6,7 +6,7 @@ __wut_fs_write(struct _reent *r,
|
||||
const char *ptr,
|
||||
size_t len)
|
||||
{
|
||||
FSStatus status;
|
||||
FSStatus status = 0;
|
||||
FSCmdBlock cmd;
|
||||
uint8_t *alignedWriteBuffer;
|
||||
uint32_t bytes, bytesWritten;
|
||||
|
@ -1,9 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
project(wutmalloc C)
|
||||
|
||||
add_library(wutmalloc
|
||||
wut_malloc.c)
|
||||
target_include_directories(wutmalloc PRIVATE "${WUT_ROOT}/include")
|
||||
|
||||
install(TARGETS wutmalloc
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
|
@ -5,7 +5,7 @@
|
||||
#include <string.h>
|
||||
|
||||
// Limit sbrk heap to 128kb
|
||||
uint32_t __attribute__((weak)) __wut_heap_max_size = 128 * 1024;
|
||||
uint32_t __wut_heap_max_size = 128 * 1024;
|
||||
|
||||
void *
|
||||
_malloc_r(struct _reent *r, size_t size)
|
||||
|
@ -1,15 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
project(wutnewlib C)
|
||||
|
||||
add_library(wutnewlib
|
||||
wut_clock.c
|
||||
wut_gettod_r.c
|
||||
wut_lock.c
|
||||
wut_malloc_lock.c
|
||||
wut_nanosleep.c
|
||||
wut_newlib.c
|
||||
wut_sbrk.c)
|
||||
target_include_directories(wutnewlib PRIVATE "${WUT_ROOT}/include")
|
||||
|
||||
install(TARGETS wutnewlib
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
|
@ -1,6 +1,9 @@
|
||||
#include "wut_newlib.h"
|
||||
#include <coreinit/exit.h>
|
||||
|
||||
// Forward newlib _exit to the coreinit.rpl _Exit
|
||||
extern void _Exit(int status);
|
||||
|
||||
static void
|
||||
__init_wut_syscall_array()
|
||||
{
|
||||
@ -11,7 +14,7 @@ __init_wut_syscall_array()
|
||||
__syscalls.lock_release = __wut_lock_release;
|
||||
__syscalls.malloc_lock = __wut_malloc_lock;
|
||||
__syscalls.malloc_unlock = __wut_malloc_unlock;
|
||||
__syscalls.exit = exit;
|
||||
__syscalls.exit = _Exit;
|
||||
__syscalls.gettod_r = __wut_gettod_r;
|
||||
__syscalls.clock_gettime = __wut_clock_gettime;
|
||||
__syscalls.clock_settime = __wut_clock_settime;
|
||||
|
@ -1,24 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
project(wutstdc++ CXX)
|
||||
|
||||
add_library(wutstdc++
|
||||
wut_gthread.cc
|
||||
wut_gthread_cond.cc
|
||||
wut_gthread_keys.cc
|
||||
wut_gthread_mutex.cc
|
||||
wut_gthread_once.cc
|
||||
wut_gthread_recursive_mutex.cc
|
||||
wut_gthread_thread.cc
|
||||
wut_stdcpp.cc)
|
||||
|
||||
target_compile_definitions(wutstdc++
|
||||
PRIVATE _GLIBCXX_HAS_GTHREADS)
|
||||
|
||||
target_include_directories(wutstdc++
|
||||
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include" "${WUT_ROOT}/include")
|
||||
|
||||
install(TARGETS wutstdc++
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/"
|
||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/include"
|
||||
FILES_MATCHING PATTERN "*.h*")
|
2
share/rpl.specs
Normal file
2
share/rpl.specs
Normal file
@ -0,0 +1,2 @@
|
||||
*wut_entry:
|
||||
--entry=__rpl_start
|
2
share/rpx.specs
Normal file
2
share/rpx.specs
Normal file
@ -0,0 +1,2 @@
|
||||
*wut_entry:
|
||||
--entry=__rpx_start
|
4
share/wut.specs
Normal file
4
share/wut.specs
Normal file
@ -0,0 +1,4 @@
|
||||
%rename link old_link
|
||||
|
||||
*link:
|
||||
%(old_link) -T %:getenv(DEVKITPRO /wut/share/wut.ld) --gc-sections --emit-relocs -z nocopyreloc %(wut_entry)
|
52
share/wut_rules
Normal file
52
share/wut_rules
Normal file
@ -0,0 +1,52 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
ifeq ($(strip $(DEVKITPRO)),)
|
||||
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/devkitPro")
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>/devkitPro/devkitPPC")
|
||||
endif
|
||||
|
||||
include $(DEVKITPPC)/base_rules
|
||||
|
||||
PORTLIBS := $(PORTLIBS_PATH)/wiiu $(PORTLIBS_PATH)/ppc
|
||||
|
||||
export PATH := $(PORTLIBS_PATH)/wiiu/bin:$(PORTLIBS_PATH)/ppc/bin:$(PATH)
|
||||
|
||||
WUT_ROOT ?= $(DEVKITPRO)/wut
|
||||
|
||||
RPXSPECS := -specs=$(WUT_ROOT)/share/wut.specs -specs=$(WUT_ROOT)/share/rpx.specs
|
||||
RPLSPECS := -specs=$(WUT_ROOT)/share/wut.specs -specs=$(WUT_ROOT)/share/rpl.specs
|
||||
|
||||
MACHDEP = -DESPRESSO -mcpu=750 -meabi -mhard-float
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.rpx: %.elf
|
||||
@cp $< $*.strip.elf
|
||||
@$(STRIP) -g $*.strip.elf
|
||||
@elf2rpl $*.strip.elf $@
|
||||
@rm $*.strip.elf
|
||||
@echo built ... $(notdir $@)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.rpl: %.elf
|
||||
@cp $< $*.strip.elf
|
||||
@$(STRIP) -g $*.strip.elf
|
||||
@elf2rpl --rpl $*.strip.elf $@
|
||||
@rm $*.strip.elf
|
||||
@echo built ... $(notdir $@)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.elf:
|
||||
@echo linking ... $(notdir $@)
|
||||
@$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
||||
@$(NM) -CSn $@ > $(notdir $*.lst)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o: %.def
|
||||
@echo $(notdir $<)
|
||||
@rplimportgen $< $*.s
|
||||
$(CC) -x assembler-with-cpp $(ASFLAGS) -c $*.s -o $@ $(ERROR_FILTER)
|
Loading…
Reference in New Issue
Block a user