I can get the PSP version to compile correctly, but the PS2 compiler will not accept -DPS2 while -DPSP works for the PSP. Any help would be appreciated.
Makefile
Code: Select all
#BUILD_DC    = 1
#BUILD_PSP   = 1
#
BUILD_PS2   = 1
#BUILD_WIN   = 1
#BUILD_GP2X  = 1
#BUILD_LINUX = 1
#=========================  ========================= #
ifdef BUILD_PSP
TARGET   = Template
OBJS     = obj/main.o
#BUILD_PRX = 1
#PRX_EXPORTS = src/exports.exp
#PSP_FW_VERSION = 371
INCDIR   = 
CFLAGS   = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS  = $(CFLAGS) -c
LDFLAGS  = -DPSP
LIBDIR   = lib
LIBS     = -lc -lm
#USE_PSPSDK_LIBC = 1
#USE_PSPSDK_LIBS = 1
#USE_KERNEL_LIBC = 1
#USE_KERNEL_LIBS = 1
EXTRA_TARGETS    = EBOOT.PBP
PSP_EBOOT_TITLE  = Template
#PSP_EBOOT_ICON   = res/ICON0.PNG
#PSP_EBOOT_ICON1  = res/ICON1.PMF
#PSP_EBOOT_PIC1   = res/PIC1.PNG
#PSP_EBOOT_UNKPNG = res/PIC0.PNG
#PSP_EBOOT_SND0   = res/SND0.AT3
PSPSDK = ../../Compiler/System/psp/psp/sdk
include $(PSPSDK)/lib/build.mak
all: EBOOT.PBP
	-rm -f $(TARGET).elf PARAM.SFO
	-mv -f EBOOT.PBP bin/psp/
obj/%.o: src/%.c
	$(CC) $(CFLAGS) -c -o $@ $<
obj/%.o: src/%.S
	$(CC) $(CFLAGS) -c -o $@ $<
endif
#=========================  ========================= #
ifdef BUILD_PS2
# _____     ___ ____     ___ ____
#  ____|   |    ____|   |        | |____|
# |     ___|   |____ ___|    ____| |    \    PS2DEV Open Source Project.
#-----------------------------------------------------------------------
# Copyright 2001-2004, ps2dev - http://www.ps2dev.org
# Licenced under Academic Free License version 2.0
# Review ps2sdk README & LICENSE files for further details.
PS2DEV = ../../Compiler/System/ps2
PS2SDK = ../../Compiler/System/ps2/ps2sdk
EE_BIN = main.elf
EE_OBJS = obj/main.o
EE_INCS = -I$(PS2DEV)/ee/ee/include
EE_LDFLAGS = -DPS2
EE_LIBS = -ldebug
all: $(EE_BIN)
	mv -f $(EE_BIN) bin/ps2/
obj/%.o : src/%.c
	$(EE_CC) $(EE_CFLAGS) $(EE_INCS) -c $< -o $@
obj/%.o : src/%.cc
	$(EE_CXX) $(EE_CXXFLAGS) $(EE_INCS) -c $< -o $@
obj/%.o : src/%.cpp
	$(EE_CXX) $(EE_CXXFLAGS) $(EE_INCS) -c $< -o $@
obj/%.o : src/%.S
	$(EE_CC) $(EE_CFLAGS) $(EE_INCS) -c $< -o $@
obj/%.o : src/%.s
	$(EE_AS) $(EE_ASFLAGS) $< -o $@
clean:
	rm -f *.elf src/*.o *.a
include $(PS2SDK)/samples/Makefile.pref
include $(PS2SDK)/samples/Makefile.eeglobal
endif
Code: Select all
#ifdef PSP
	#include <pspkernel.h>
	#include <pspdebug.h>
#endif
#ifdef PS2 // works if changed to #ifndef PSP
	#include <tamtypes.h>
	#include <debug.h>
#endif
#ifdef PSP
PSP_MODULE_INFO("Hello World", 0, 1, 1);
#define printf pspDebugScreenPrintf 
/* Exit callback */
int exit_callback(int arg1, int arg2, void *common)
{
	sceKernelExitGame();
	return 0;
}
/* Callback thread */
int CallbackThread(SceSize args, void *argp)
{
	int cbid;
	cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
	sceKernelRegisterExitCallback(cbid);
	sceKernelSleepThreadCB();
	return 0;
}
/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void)
{
	int thid = 0;
	thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
	if(thid >= 0)
	{
		sceKernelStartThread(thid, 0, 0);
	}
	return thid;
}
#endif
int main(int argc, char **argv)
{
#ifdef PSP
	pspDebugScreenInit();
	SetupCallbacks();
	printf("Hello World"); 
#endif
#ifdef PS2 // works if changed to #ifndef PSP
	init_scr();
	scr_printf("Hello World!");
#endif
#ifdef PSP
	sceKernelSleepThread();
#endif
	return(0);
}
