mirror of
https://github.com/wiiu-env/libiosuhax.git
synced 2024-11-27 03:24:16 +01:00
Adopt makefile from wut libraries. Now only compatible to WUT projects.
This commit is contained in:
parent
f4ee7165b2
commit
cf4f2ab607
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,2 +1,5 @@
|
|||||||
/*.a
|
/*.a
|
||||||
/build
|
/build
|
||||||
|
*.bz2
|
||||||
|
release/
|
||||||
|
lib/
|
||||||
|
@ -8,7 +8,6 @@ env:
|
|||||||
global:
|
global:
|
||||||
- DEVKITPRO=/opt/devkitpro
|
- DEVKITPRO=/opt/devkitpro
|
||||||
- DEVKITPPC=/opt/devkitpro/devkitPPC
|
- DEVKITPPC=/opt/devkitpro/devkitPPC
|
||||||
- PORTLIBREPOS=$HOME/portlibrepos
|
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
|
169
Makefile
169
Makefile
@ -1,58 +1,59 @@
|
|||||||
#---------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# Clear the implicit built in rules
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
#---------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
ifeq ($(strip $(DEVKITPPC)),)
|
|
||||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
|
ifeq ($(strip $(DEVKITPRO)),)
|
||||||
|
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/devkitpro")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
export PATH := $(DEVKITPPC)/bin:$(PORTLIBS)/bin:$(PATH)
|
TOPDIR ?= $(CURDIR)
|
||||||
export PORTLIBS := $(DEVKITPRO)/portlibs/ppc
|
|
||||||
|
|
||||||
PREFIX := powerpc-eabi-
|
include $(DEVKITPRO)/wut/share/wut_rules
|
||||||
|
|
||||||
export AS := $(PREFIX)as
|
export VER_MAJOR := 1
|
||||||
export CC := $(PREFIX)gcc
|
export VER_MINOR := 0
|
||||||
export CXX := $(PREFIX)g++
|
export VER_PATCH := 0
|
||||||
export AR := $(PREFIX)ar
|
|
||||||
export OBJCOPY := $(PREFIX)objcopy
|
|
||||||
|
|
||||||
include $(DEVKITPPC)/base_rules
|
VERSION := $(VER_MAJOR).$(VER_MINOR).$(VER_PATCH)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
# TARGET is the name of the output
|
||||||
# BUILD is the directory where object files & intermediate files will be placed
|
# BUILD is the directory where object files & intermediate files will be placed
|
||||||
# SOURCES is a list of directories containing source code
|
# SOURCES is a list of directories containing source code
|
||||||
# INCLUDES is a list of directories containing extra header files
|
# DATA is a list of directories containing data files
|
||||||
#---------------------------------------------------------------------------------
|
# INCLUDES is a list of directories containing header files
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
TARGET := $(notdir $(CURDIR))
|
||||||
BUILD := build
|
BUILD := build
|
||||||
SOURCES := source
|
SOURCES := source
|
||||||
INCLUDES := iosuhax.h iosuhax_devoptab.h iosuhax_disc_interface.h
|
DATA := data
|
||||||
LIBTARGET := libiosuhax.a
|
INCLUDES := source \
|
||||||
|
include \
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# installation parameters
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBINSTALL := $(PORTLIBS)/lib
|
|
||||||
HDRINSTALL := $(PORTLIBS)/include
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# options for code generation
|
# options for code generation
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
CFLAGS = -O2 $(DEF_FLAGS) -Wall -Wno-unused $(MACHDEP) $(INCLUDE)
|
CFLAGS := -Wall -Werror -save-temps \
|
||||||
CXXFLAGS = $(CFLAGS)
|
-ffunction-sections -fdata-sections \
|
||||||
ASFLAGS := -g
|
$(MACHDEP) \
|
||||||
|
$(BUILD_CFLAGS)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
CFLAGS += $(INCLUDE) -D__WIIU__ -D__WUT__
|
||||||
# any extra libraries we wish to link with the project
|
|
||||||
#---------------------------------------------------------------------------------
|
CXXFLAGS := $(CFLAGS) -std=gnu++17
|
||||||
LIBS :=
|
|
||||||
|
ASFLAGS := $(MACHDEP)
|
||||||
|
|
||||||
|
LDFLAGS = $(ARCH) -Wl,--gc-sections
|
||||||
|
|
||||||
|
|
||||||
|
LIBS :=
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# list of directories containing libraries, this must be the top level containing
|
# list of directories containing libraries, this must be the top level containing
|
||||||
# include and lib
|
# include and lib
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
LIBDIRS :=
|
LIBDIRS := $(PORTLIBS) $(WUT_ROOT)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# no real need to edit anything past this point unless you need to add additional
|
# no real need to edit anything past this point unless you need to add additional
|
||||||
@ -61,49 +62,74 @@ LIBDIRS :=
|
|||||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
export TOPDIR := $(CURDIR)
|
||||||
|
|
||||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
||||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||||
|
|
||||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||||
|
DEFFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.def)))
|
||||||
|
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||||
export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
|
||||||
|
|
||||||
export INCLUDE := $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
|
||||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
|
||||||
-I$(CURDIR)/$(BUILD) -I$(LIBOGC_INC) \
|
|
||||||
-I$(PORTLIBS)/include
|
|
||||||
|
|
||||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
|
|
||||||
-L$(LIBOGC_LIB) -L$(PORTLIBS)/lib
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
$(BUILD):
|
# 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/libiosuhax.a
|
||||||
|
|
||||||
|
dist-bin: all
|
||||||
|
@tar --exclude=*~ -cjf libiosuhax-$(VERSION).tar.bz2 include lib
|
||||||
|
|
||||||
|
dist-src:
|
||||||
|
@tar --exclude=*~ -cjf libiosuhax-src-$(VERSION).tar.bz2 include source Makefile
|
||||||
|
|
||||||
|
dist: dist-src dist-bin
|
||||||
|
|
||||||
|
install: dist-bin
|
||||||
|
mkdir -p $(DESTDIR)$(DEVKITPRO)/wut
|
||||||
|
bzip2 -cd libiosuhax-$(VERSION).tar.bz2 | tar -xf - -C $(DESTDIR)$(DEVKITPRO)/wut
|
||||||
|
|
||||||
|
lib:
|
||||||
@[ -d $@ ] || mkdir -p $@
|
@[ -d $@ ] || mkdir -p $@
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
|
||||||
|
release:
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
|
||||||
|
lib/libiosuhax.a :$(SOURCES) $(INCLUDES) | lib release
|
||||||
|
@$(MAKE) BUILD=release OUTPUT=$(CURDIR)/$@ \
|
||||||
|
BUILD_CFLAGS="-DNDEBUG=1 -O2 -s" \
|
||||||
|
DEPSDIR=$(CURDIR)/release \
|
||||||
|
--no-print-directory -C release \
|
||||||
|
-f $(CURDIR)/Makefile
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
all: $(LIBTARGET)
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo clean ...
|
@echo clean ...
|
||||||
@rm -fr $(BUILD) $(LIBTARGET)
|
@rm -rf release lib
|
||||||
|
|
||||||
install: $(LIBTARGET)
|
|
||||||
@[ -d $(LIBINSTALL) ] || mkdir -p $(LIBINSTALL)
|
|
||||||
@[ -d $(HDRINSTALL) ] || mkdir -p $(HDRINSTALL)
|
|
||||||
cp $(foreach incl,$(INCLUDES),$(SOURCES)/$(incl)) $(HDRINSTALL)
|
|
||||||
cp $(LIBTARGET) $(LIBINSTALL)
|
|
||||||
|
|
||||||
wut:
|
|
||||||
@[ -d $(BUILD) ] || mkdir -p $(BUILD)
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile DEF_FLAGS=-D__WUT__
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
else
|
else
|
||||||
@ -113,13 +139,16 @@ DEPENDS := $(OFILES:.o=.d)
|
|||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# main targets
|
# main targets
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
$(LIBTARGET): $(OFILES)
|
$(OUTPUT) : $(OFILES)
|
||||||
@rm -f "../$(LIBTARGET)"
|
|
||||||
@$(AR) rcs "../$(LIBTARGET)" $(OFILES)
|
$(OFILES_SRC) : $(HFILES)
|
||||||
@echo built $(notdir $@)
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%_bin.h %.bin.o : %.bin
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
$(LIBDIR)/$(PLATFORM):
|
|
||||||
mkdir -p ../$(LIBDIR)/$(PLATFORM)
|
|
||||||
|
|
||||||
-include $(DEPENDS)
|
-include $(DEPENDS)
|
||||||
|
|
||||||
|
11
README.md
11
README.md
@ -1 +1,10 @@
|
|||||||
[![Build Status](https://travis-ci.org/dimok789/libiosuhax.svg)](https://travis-ci.org/dimok789/libiosuhax)
|
[![Build Status](https://travis-ci.org/dimok789/libiosuhax.svg)](https://travis-ci.org/dimok789/libiosuhax)
|
||||||
|
# libiosuhax
|
||||||
|
A PPC library to access IOSUHAX from PPC and a devoptab for any device or path.
|
||||||
|
It's only compatible to RPX-Files.
|
||||||
|
|
||||||
|
## Building
|
||||||
|
Make you to have [wut](https://github.com/devkitPro/wut/) installed and use the following command for build:
|
||||||
|
```
|
||||||
|
make install
|
||||||
|
```
|
||||||
|
@ -7,21 +7,6 @@ extern "C" {
|
|||||||
|
|
||||||
#define OS_MUTEX_SIZE 44
|
#define OS_MUTEX_SIZE 44
|
||||||
|
|
||||||
#ifndef __WUT__
|
|
||||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
||||||
//! Mutex functions
|
|
||||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
||||||
extern void (* OSInitMutex)(void* mutex);
|
|
||||||
extern void (* OSLockMutex)(void* mutex);
|
|
||||||
extern void (* OSUnlockMutex)(void* mutex);
|
|
||||||
|
|
||||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
||||||
//! IOS function
|
|
||||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
||||||
extern int (*IOS_Ioctl)(int fd, unsigned int request, void *input_buffer,unsigned int input_buffer_len, void *output_buffer, unsigned int output_buffer_len);
|
|
||||||
extern int (*IOS_Open)(char *path, unsigned int mode);
|
|
||||||
extern int (*IOS_Close)(int fd);
|
|
||||||
#else
|
|
||||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
//! Mutex functions
|
//! Mutex functions
|
||||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -35,7 +20,6 @@ extern void OSUnlockMutex(void* mutex);
|
|||||||
extern int IOS_Ioctl(int fd, unsigned int request, void *input_buffer,unsigned int input_buffer_len, void *output_buffer, unsigned int output_buffer_len);
|
extern int IOS_Ioctl(int fd, unsigned int request, void *input_buffer,unsigned int input_buffer_len, void *output_buffer, unsigned int output_buffer_len);
|
||||||
extern int IOS_Open(char *path, unsigned int mode);
|
extern int IOS_Open(char *path, unsigned int mode);
|
||||||
extern int IOS_Close(int fd);
|
extern int IOS_Close(int fd);
|
||||||
#endif // __WUT__
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user