# PSP Software Development Kit - http://www.pspdev.org # ----------------------------------------------------------------------- # Licensed under the BSD license, see LICENSE in PSPSDK root for details. # # build.mak - Base makefile for projects using PSPSDK. # # Copyright (c) 2005 Marcus R. Brown # Copyright (c) 2005 James Forshaw # Copyright (c) 2005 John Kelley # # $Id: build.mak 771 2005-07-24 10:43:54Z tyranid $ # Note: The PSPSDK make variable must be defined before this file is included. ifeq ($(PSPSDK),) $(error $$(PSPSDK) is undefined. Use "PSPSDK := $$(shell psp-config --pspsdk-path)" in your Makefile) endif CC = psp-gcc CXX = psp-g++ AS = psp-gcc LD = psp-gcc FIXUP = psp-fixup-imports # Add in PSPSDK includes and libraries. INCDIR := $(INCDIR) . $(PSPSDK)/include LIBDIR := $(LIBDIR) . $(PSPSDK)/lib CFLAGS := $(addprefix -I,$(INCDIR)) $(CFLAGS) CXXFLAGS := $(CFLAGS) $(CXXFLAGS) ASFLAGS := $(CFLAGS) $(ASFLAGS) LDFLAGS := $(addprefix -L,$(LIBDIR)) -Wl,-q,-T$(PSPSDK)/lib/linkfile.prx -mno-crt0 -nostartfiles $(LDFLAGS) ifeq ($(PSP_FW_VERSION),) PSP_FW_VERSION=150 endif CFLAGS += -D_PSP_FW_VERSION=$(PSP_FW_VERSION) # Library selection. By default we link with Newlib's libc. Allow the # user to link with PSPSDK's libc if USE_PSPSDK_LIBC is set to 1. ifeq ($(USE_KERNEL_LIBC),1) # Use the PSP's kernel libc PSPSDK_LIBC_LIB = CFLAGS := -I$(PSPSDK)/include/libc $(CFLAGS) else ifeq ($(USE_PSPSDK_LIBC),1) # Use the pspsdk libc PSPSDK_LIBC_LIB = -lpsplibc CFLAGS := -I$(PSPSDK)/include/libc $(CFLAGS) else # Use newlib (urgh) PSPSDK_LIBC_LIB = -lc endif endif # Link with following default libraries. Other libraries should be specified in the $(LIBS) variable. # TODO: This library list needs to be generated at configure time. ifeq ($(USE_KERNEL_LIBS),1) PSPSDK_LIBS = -lpspdebug -lpspdisplay_driver -lpspctrl_driver -lpspsdk LIBS := $(LIBS) $(PSPSDK_LIBS) $(PSPSDK_LIBC_LIB) -lpspkernel else PSPSDK_LIBS = -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk LIBS := $(LIBS) $(PSPSDK_LIBS) $(PSPSDK_LIBC_LIB) -lpsputility -lpspuser -lpspkernel endif FINAL_TARGET = $(TARGET).prx all: $(FINAL_TARGET) $(TARGET).elf: $(OBJS) $(LINK.c) $^ $(LIBS) -o $@ $(FIXUP) $@ %.prx: %.elf psp-prxgen $< $@ %.c: %.exp psp-build-exports -b $< > $@ clean: $(EXTRA_CLEAN) -rm -f $(FINAL_TARGET) $(TARGET).elf $(OBJS) rebuild: clean all