2009-05-05 19:00:22 +02:00
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
# Clear the implicit built in rules
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
.SUFFIXES:
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
ifeq ($(strip $(DEVKITPPC)),)
|
|
|
|
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
|
|
|
|
endif
|
|
|
|
|
|
|
|
include $(DEVKITPPC)/wii_rules
|
|
|
|
|
|
|
|
# Directories.
|
|
|
|
OBJ_DIR := obj
|
|
|
|
LIB_DIR := lib
|
|
|
|
BIN_DIR := .
|
|
|
|
SRC_DIR := src
|
|
|
|
INCLUDE_DIR := include
|
|
|
|
|
|
|
|
# Tools.
|
|
|
|
PIPE_TO_SED := 2>&1 | sed "s/:\([0-9]*\):/\(\1\) :/"
|
|
|
|
|
2009-05-11 17:54:24 +02:00
|
|
|
SYMLINKS=src/machdep src/osdep src/gfxdep src/joydep src/guidep src/sounddep src/threaddep
|
|
|
|
|
|
|
|
|
2009-05-05 19:00:22 +02:00
|
|
|
# Source files.
|
2009-05-11 18:08:32 +02:00
|
|
|
SRCS := $(wildcard $(SRC_DIR)/*.c $(SRC_DIR)/caps/*.c $(SRC_DIR)/dms/*.c $(SRC_DIR)/keymap/*.c) \
|
2009-05-11 17:54:24 +02:00
|
|
|
$(SRC_DIR)/machdep/support.c $(SRC_DIR)/gfxdep/rawkeys.c $(SRC_DIR)/guidep/gui-sdl.c $(SRC_DIR)/sounddep/sound.c \
|
2009-05-11 18:08:32 +02:00
|
|
|
$(SRC_DIR)/gfxdep/sdlgfx.c $(SRC_DIR)/guidep/menu.c $(SRC_DIR)/osdep/main.c $(SRC_DIR)/threaddep/thread.c \
|
2009-05-11 17:54:24 +02:00
|
|
|
$(SRC_DIR)/gfxdep/sdlkeys.c $(SRC_DIR)/joydep/joystick.c $(SRC_DIR)/osdep/memory.c
|
|
|
|
|
2009-05-05 20:25:52 +02:00
|
|
|
|
2009-05-06 20:18:22 +02:00
|
|
|
SRCS := $(filter-out src/compemu_raw_x86.c src/compemu_fpp.c src/compemu_support.c src/svgancui.c src/build68k.c src/catweasel.c \
|
|
|
|
src/cdrom.c src/blkdev-libscg.c src/blkdev.c src/blitops.c src/akiko.c src/filesys_bootrom.c \
|
2009-05-23 11:03:23 +02:00
|
|
|
src/genblitter.c src/gencomp.c src/gencpu.c \
|
|
|
|
src/genlinetoscr.c src/compemu.c src/compstbl.c \
|
2009-05-21 10:26:32 +02:00
|
|
|
src/enforcer.c src/ar.c src/debug.c \
|
2009-05-08 22:00:12 +02:00
|
|
|
src/readdisk.c src/gengenblitter.c src/scsiemul.c src/tui.c src/linetoscr.c, $(SRCS))
|
2009-05-05 19:00:22 +02:00
|
|
|
|
|
|
|
# Library object files.
|
2009-05-21 16:34:05 +02:00
|
|
|
OBJS := $(subst $(SRC_DIR),$(OBJ_DIR),$(SRCS:.c=.o)) $(OBJ_DIR)/guidep/VirtualKeyboard.o
|
2009-05-05 19:00:22 +02:00
|
|
|
|
|
|
|
# Test source files.
|
|
|
|
# It can be useful to switch this variable around to select individual tests which are problematic.
|
|
|
|
TEST_SRCS := $(TEST_SRC_DIR)/showfont.c
|
|
|
|
|
|
|
|
# What's a full build?
|
2009-05-06 20:23:35 +02:00
|
|
|
all: uae.dol
|
2009-05-05 19:00:22 +02:00
|
|
|
|
|
|
|
# How to delete the intermediate files.
|
|
|
|
clean:
|
|
|
|
@echo Cleaning $(OBJ_DIR)
|
2009-05-23 11:03:23 +02:00
|
|
|
@rm -rf $(OBJS) $(OBJ_DIR) src/machdep src/target.h src/md-fpp.h src/sysconfig.h $(SYMLINKS)
|
2009-05-05 19:00:22 +02:00
|
|
|
|
|
|
|
$(OBJ_DIR):
|
|
|
|
install -d $@
|
|
|
|
|
|
|
|
src/sysconfig.h: src/sysconfig.h.wii
|
|
|
|
cp $< $@
|
|
|
|
|
2009-05-09 10:54:52 +02:00
|
|
|
src/machdep:
|
|
|
|
rm -f $@
|
|
|
|
cd src && ln -s md-ppc-gcc machdep
|
|
|
|
|
2009-05-11 17:54:24 +02:00
|
|
|
src/osdep:
|
|
|
|
rm -f $@
|
|
|
|
cd src && ln -s od-generic osdep
|
|
|
|
|
|
|
|
src/gfxdep:
|
|
|
|
rm -f $@
|
|
|
|
cd src && ln -s gfx-sdl gfxdep
|
|
|
|
|
|
|
|
src/joydep:
|
|
|
|
rm -f $@
|
|
|
|
cd src && ln -s jd-sdl joydep
|
|
|
|
|
|
|
|
src/guidep:
|
|
|
|
rm -f $@
|
|
|
|
cd src && ln -s gui-sdl guidep
|
|
|
|
|
|
|
|
src/sounddep:
|
|
|
|
rm -f $@
|
|
|
|
cd src && ln -s sd-sdl sounddep
|
|
|
|
|
|
|
|
src/threaddep:
|
|
|
|
rm -f $@
|
|
|
|
cd src && ln -s td-sdl threaddep
|
|
|
|
|
2009-05-10 12:09:16 +02:00
|
|
|
src/target.h:
|
|
|
|
rm -f $@
|
|
|
|
cd src && ln -s targets/t-wii.h target.h
|
|
|
|
|
2009-05-12 22:18:03 +02:00
|
|
|
src/md-fpp.h:
|
|
|
|
rm -f $@
|
|
|
|
cd src && ln -s include/fpp-ieee.h md-fpp.h
|
|
|
|
|
2009-05-06 20:18:22 +02:00
|
|
|
%.h: %.h.wii
|
|
|
|
cp $< $@
|
2009-05-05 19:00:22 +02:00
|
|
|
|
2009-05-06 20:18:22 +02:00
|
|
|
%.c: %.c.wii
|
|
|
|
cp $< $@
|
2009-05-05 19:00:22 +02:00
|
|
|
|
|
|
|
# How to build a library.
|
|
|
|
$(LIB_DIR)/libSDL_ttf.a: $(OBJS)
|
|
|
|
@echo Archiving $@
|
|
|
|
@-mkdir -p $(dir $@)
|
|
|
|
@powerpc-gekko-ar crs $@ $(OBJS)
|
|
|
|
@echo ----
|
|
|
|
|
|
|
|
# How to build a DOL.
|
|
|
|
$(BIN_DIR)/%.dol: %.elf
|
|
|
|
@echo Creating DOL $@
|
|
|
|
@-mkdir -p $(dir $@)
|
|
|
|
#powerpc-gekko-objcopy -O binary $< $@
|
|
|
|
elf2dol $< $@
|
|
|
|
@echo ----
|
|
|
|
|
|
|
|
# Compilation flags.
|
2009-05-21 00:52:31 +02:00
|
|
|
COMMON_FLAGS := -g -O3 -G8 -mrvl -Wall -D__inline__=__inline__ $(MACHDEP)
|
2009-05-08 22:00:12 +02:00
|
|
|
INCLUDES := -Isrc/md-generic/ -Isrc/include -Isrc -I$(DEVKITPRO)/libogc/include -I$(DEVKITPRO)/libogc/include/SDL
|
2009-05-21 10:26:32 +02:00
|
|
|
DEFINES := -DOS_WITHOUT_MEMORY_MANAGEMENT -DSAVESTATE -DUSE_SDL -DSUPPORT_THREADS -DCPUEMU_0 -DCPUEMU_5 -DCPUEMU_6 \
|
2009-05-24 08:27:46 +02:00
|
|
|
-DFPUEMU -DAGA -DAUTOCONFIG -DFILESYS \
|
2009-05-25 00:57:22 +02:00
|
|
|
-DTD_START_HEIGHT=16
|
2009-05-05 19:00:22 +02:00
|
|
|
CFLAGS := $(COMMON_FLAGS) $(INCLUDES) $(DEFINES)
|
|
|
|
|
2009-05-21 00:52:31 +02:00
|
|
|
#unused defines; -DFDI2RAW
|
|
|
|
|
2009-05-05 19:00:22 +02:00
|
|
|
# Test link flags.
|
2009-05-13 17:46:59 +02:00
|
|
|
LDFLAGS := $(COMMON_FLAGS) -L$(LIB_DIR) -L$(DEVKITPRO)/libogc/lib/wii -lz -lSDL_ttf -lSDL -lfreetype -lfat -lwiiuse -lbte -logc -lm -lwiikeyboard
|
2009-05-05 19:00:22 +02:00
|
|
|
|
2009-05-10 22:12:31 +02:00
|
|
|
dist: uae.dol
|
|
|
|
|
|
|
|
dist: uae.dol
|
|
|
|
install -d $@/apps/uae
|
|
|
|
install -d $@/uae
|
|
|
|
install -d $@/uae/floppies
|
|
|
|
install -d $@/uae/roms
|
|
|
|
install -d $@/uae/harddisks
|
|
|
|
install -d $@/uae/saves
|
2009-05-14 19:13:21 +02:00
|
|
|
touch $@/uae/roms/put-your-kick-dot-rom-here
|
2009-05-10 22:12:31 +02:00
|
|
|
cp $< $@/apps/uae/boot.dol
|
|
|
|
cp meta.xml $@/apps/uae/
|
|
|
|
cp icon.png $@/apps/uae/
|
|
|
|
cp FreeMono.ttf $@/apps/uae/
|
|
|
|
cp Smaller.ttf $@/apps/uae/
|
2009-06-28 19:24:06 +02:00
|
|
|
cp README.Cloanto-Amiga_Forever $@/apps/uae/
|
2009-05-10 22:12:31 +02:00
|
|
|
cp uaerc.wii $@/uae/uaerc
|
|
|
|
cd $@ && tar -czf ../uae-bin.tar.gz *
|
|
|
|
|
2009-05-05 19:00:22 +02:00
|
|
|
# How to link an ELF.
|
2009-05-12 22:18:03 +02:00
|
|
|
uae.elf: $(SYMLINKS) src/target.h src/md-fpp.h src/sysconfig.h $(OBJS)
|
2009-05-05 19:00:22 +02:00
|
|
|
@echo Linking $@
|
|
|
|
@-mkdir -p $(dir $@)
|
2009-05-06 20:18:22 +02:00
|
|
|
powerpc-gekko-g++ -o $@ $(OBJS) $(LDFLAGS)
|
2009-05-05 19:00:22 +02:00
|
|
|
#keep elf for debugging
|
|
|
|
#cp $@ /tmp/elf
|
|
|
|
|
|
|
|
# How to compile C file (SDL library).
|
|
|
|
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
|
|
|
|
@echo Compiling $<
|
|
|
|
@-mkdir -p $(dir $@)
|
|
|
|
@powerpc-gekko-gcc $(CFLAGS) -c $< -o $@ $(PIPE_TO_SED)
|
2009-05-21 16:34:05 +02:00
|
|
|
|
|
|
|
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
|
|
|
|
@echo Compiling $<
|
|
|
|
@-mkdir -p $(dir $@)
|
|
|
|
@powerpc-gekko-g++ $(CFLAGS) -c $< -o $@ $(PIPE_TO_SED)
|