Changing makefile to keep .o files out of src folder

support for the PSP toolchain
Post Reply
ant512
Posts: 12
Joined: Sat Feb 06, 2010 11:10 am

Changing makefile to keep .o files out of src folder

Post by ant512 » Sun Feb 25, 2018 6:39 pm

I'm trying to figure out how to change my PSP makefile to put its .o files in a "build" folder instead of dumping them all in my "src" folder. Here's my folder structure:

Code: Select all

 - makefile
 - src
   - test.c
 - include
   - test.h
Here's what I'm trying to produce:

Code: Select all

 - makefile
 - src
   - test.c
 - include
   - test.h
 - build
   - test.o
Here's what I currently end up with:

Code: Select all

 - makefile
 - src
   - test.c
   - test.o
 - include
   - test.h
Makefiles really aren't my thing. Any suggestions?

Here's my current makefile:

Code: Select all

TARGET_LIB	:=	test.a
LIBDIR		:=	
INCDIR		:=	include
SRCDIR		:=	src

BUILD		:= build

CFILES		:= $(foreach dir,$(SRCDIR),$(notdir $(wildcard $(dir)/*.c)))

OBJS 		:= $(addprefix $(SRCDIR)/,$(CFILES:%.c=%.o))
#OBJS 		:= $(CFILES:%.c=%.o)

CFLAGS		= -O2 -G0 -Wall -std=gnu99 -DTARGET_PSP -Wno-unknown-pragmas -I.
CXXFLAGS	= $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS		= $(CFLAGS)

LDFLAGS		=

LIBS		= -lm

PSPSDK		=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak

crimsonwolf8439
Posts: 4
Joined: Sun Feb 25, 2018 6:36 am

Re: Changing makefile to keep .o files out of src folder

Post by crimsonwolf8439 » Mon Feb 26, 2018 12:07 am

I'm very sorry I can't help but I just want to say I'm glad there are still people out there who use the pspdev kits. :shock: :D :lol:

As a side note, maybe could try adding a path to the make?
EG OBJS = src\make.o? :cry:

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests