mirror of
https://github.com/wiiu-env/libfat.git
synced 2024-11-22 01:49:17 +01:00
Add GP2X support to libfat (#18)
This commit is contained in:
parent
1087f6ed6d
commit
69543f058c
3
.gitignore
vendored
3
.gitignore
vendored
@ -6,7 +6,10 @@ libogc/lib
|
||||
libogc/wii_release
|
||||
nds/lib
|
||||
nds/release
|
||||
gp2x/lib
|
||||
gp2x/gp2x_release
|
||||
distribute
|
||||
gba/include
|
||||
libogc/include
|
||||
nds/include
|
||||
gp2x/include
|
29
Makefile
29
Makefile
@ -16,7 +16,7 @@ default: release
|
||||
|
||||
all: release dist
|
||||
|
||||
release: nds-release gba-release cube-release wii-release
|
||||
release: nds-release gba-release cube-release wii-release gp2x-release
|
||||
|
||||
ogc-release: include/libfatversion.h cube-release wii-release
|
||||
|
||||
@ -32,7 +32,10 @@ cube-release: include/libfatversion.h
|
||||
wii-release: include/libfatversion.h
|
||||
$(MAKE) -C libogc PLATFORM=wii BUILD=wii_release
|
||||
|
||||
debug: nds-debug gba-debug cube-debug wii-debug
|
||||
gp2x-release: include/libfatversion.h
|
||||
$(MAKE) -C gp2x PLATFORM=gp2x BUILD=gp2x_release
|
||||
|
||||
debug: nds-debug gba-debug cube-debug wii-debug gp2x-debug
|
||||
|
||||
ogc-debug: cube-debug wii-debug
|
||||
|
||||
@ -42,14 +45,16 @@ nds-debug: include/libfatversion.h
|
||||
gba-debug: include/libfatversion.h
|
||||
$(MAKE) -C gba BUILD=debug
|
||||
|
||||
|
||||
cube-debug: include/libfatversion.h
|
||||
$(MAKE) -C libogc PLATFORM=cube BUILD=wii_debug
|
||||
|
||||
wii-debug: include/libfatversion.h
|
||||
$(MAKE) -C libogc PLATFORM=wii BUILD=cube_debug
|
||||
|
||||
clean: nds-clean gba-clean ogc-clean
|
||||
gp2x-debug: include/libfatversion.h
|
||||
$(MAKE) -C gp2x BUILD=debug
|
||||
|
||||
clean: nds-clean gba-clean ogc-clean gp2x-clean
|
||||
|
||||
nds-clean:
|
||||
$(MAKE) -C nds clean
|
||||
@ -60,7 +65,10 @@ gba-clean:
|
||||
ogc-clean:
|
||||
$(MAKE) -C libogc clean
|
||||
|
||||
dist-bin: nds-dist-bin gba-dist-bin ogc-dist-bin
|
||||
gp2x-clean:
|
||||
$(MAKE) -C gp2x clean
|
||||
|
||||
dist-bin: nds-dist-bin gba-dist-bin ogc-dist-bin gp2x-dist-bin
|
||||
|
||||
nds-dist-bin: include/libfatversion.h nds-release distribute/$(VERSTRING)
|
||||
$(MAKE) -C nds dist-bin
|
||||
@ -71,12 +79,16 @@ gba-dist-bin: include/libfatversion.h gba-release distribute/$(VERSTRING)
|
||||
ogc-dist-bin: include/libfatversion.h ogc-release distribute/$(VERSTRING)
|
||||
$(MAKE) -C libogc dist-bin
|
||||
|
||||
gp2x-dist-bin: include/libfatversion.h gp2x-release distribute/$(VERSTRING)
|
||||
$(MAKE) -C gp2x dist-bin
|
||||
|
||||
dist-src: distribute/$(VERSTRING)
|
||||
@tar --exclude=.svn --exclude=*CVS* -cvjf distribute/$(VERSTRING)/libfat-src-$(VERSTRING).tar.bz2 \
|
||||
source include Makefile \
|
||||
nds/Makefile \
|
||||
gba/Makefile \
|
||||
libogc/Makefile
|
||||
libogc/Makefile \
|
||||
gp2x/Makefile
|
||||
|
||||
dist: dist-bin dist-src
|
||||
|
||||
@ -95,7 +107,7 @@ include/libfatversion.h : Makefile
|
||||
@echo >> $@
|
||||
@echo "#endif // __LIBFATVERSION_H__" >> $@
|
||||
|
||||
install: nds-install gba-install ogc-install
|
||||
install: nds-install gba-install ogc-install gp2x-install
|
||||
|
||||
nds-install: nds-release
|
||||
$(MAKE) -C nds install
|
||||
@ -105,3 +117,6 @@ gba-install: gba-release
|
||||
|
||||
ogc-install: cube-release wii-release
|
||||
$(MAKE) -C libogc install
|
||||
|
||||
gp2x-install: gp2x-release
|
||||
$(MAKE) -C gp2x install
|
||||
|
164
gp2x/Makefile
Normal file
164
gp2x/Makefile
Normal file
@ -0,0 +1,164 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM)
|
||||
endif
|
||||
|
||||
include $(DEVKITARM)/gp2x_rules
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# 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 binary files
|
||||
# LIB is where the built library will be placed
|
||||
# all directories are relative to this makefile
|
||||
#---------------------------------------------------------------------------------
|
||||
BUILD ?= release
|
||||
SOURCES := ../source
|
||||
INCLUDES := ../include
|
||||
DATA :=
|
||||
LIB := $(TOPDIR)/gp2x/lib
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -mthumb -mthumb-interwork
|
||||
|
||||
CFLAGS := -g -Wall -O2\
|
||||
-mcpu=arm9tdmi -mtune=arm9tdmi\
|
||||
-fomit-frame-pointer\
|
||||
-ffast-math \
|
||||
$(ARCH)
|
||||
|
||||
CFLAGS += $(INCLUDE) -DGP2X
|
||||
CXXFLAGS := $(CFLAGS)
|
||||
|
||||
ASFLAGS := -g $(ARCH)
|
||||
|
||||
ifneq ($(BUILD),debug)
|
||||
export GP2XBIN := $(LIB)/libfat.a
|
||||
else
|
||||
export GP2XBIN := $(LIB)/libfatd.a
|
||||
CFLAGS += -DFAT_DEBUG
|
||||
endif
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS :=
|
||||
#-lnds9
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(LIBORCUS)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# 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 DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||
|
||||
export CC := $(PREFIX)gcc
|
||||
export CXX := $(PREFIX)g++
|
||||
export AR := $(PREFIX)ar
|
||||
export OBJCOPY := $(PREFIX)objcopy
|
||||
|
||||
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) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr debug gp2x_release $(LIB) include
|
||||
|
||||
all: $(GP2XBIN)
|
||||
|
||||
dist-bin:
|
||||
@mkdir -p include
|
||||
@cp $(TOPDIR)/include/fat.h $(TOPDIR)/include/libfatversion.h include
|
||||
@tar --exclude=.svn --exclude=*CVS* -cvjf $(TOPDIR)/distribute/$(VERSTRING)/libfat-gp2x-$(VERSTRING).tar.bz2 include lib
|
||||
|
||||
install:
|
||||
@mkdir -p $(DESTDIR)$(DEVKITPRO)/liborcus/lib
|
||||
@mkdir -p $(DESTDIR)$(DEVKITPRO)/liborcus/include
|
||||
@cp lib/libfat.a $(DESTDIR)$(DEVKITPRO)/liborcus/lib
|
||||
@cp $(TOPDIR)/include/fat.h $(TOPDIR)/include/libfatversion.h $(DESTDIR)$(DEVKITPRO)/liborcus/include
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(GP2XBIN) : $(OFILES) $(LIB)
|
||||
@rm -f "$(GP2XBIN)"
|
||||
@$(AR) rcs "$(GP2XBIN)" $(OFILES)
|
||||
@echo built ... $(notdir $@)
|
||||
|
||||
$(LIB):
|
||||
mkdir $(LIB)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# you need a rule like this for each extension you use as binary data
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bin.o : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
|
@ -52,6 +52,9 @@
|
||||
#elif defined(GBA)
|
||||
#include <gba_types.h>
|
||||
#include <disc_io.h>
|
||||
#elif defined(GP2X)
|
||||
#include <gp2xtypes.h>
|
||||
#include <disc_io.h>
|
||||
#endif
|
||||
|
||||
// Platform specific options
|
||||
@ -73,6 +76,9 @@
|
||||
#define DEFAULT_CACHE_PAGES 2
|
||||
#define DEFAULT_SECTORS_PAGE 8
|
||||
#define LIMIT_SECTORS 128
|
||||
#elif defined (GP2X)
|
||||
#define DEFAULT_CACHE_PAGES 16
|
||||
#define DEFAULT_SECTORS_PAGE 8
|
||||
#endif
|
||||
|
||||
#endif // _COMMON_H
|
||||
|
@ -111,5 +111,15 @@ const INTERFACE_ID _FAT_disc_interfaces[] = {
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
/* ====================== GP2X ====================== */
|
||||
#elif defined (GP2X)
|
||||
#include <disc_io.h>
|
||||
|
||||
const INTERFACE_ID _FAT_disc_interfaces[] = {
|
||||
{"sd", get_io_gp2xsd},
|
||||
{NULL, NULL}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user