forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Help ~ makefile problems

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
viridite



Joined: 08 Nov 2007
Posts: 16

PostPosted: Fri Nov 09, 2007 2:38 pm    Post subject: Help ~ makefile problems Reply with quote

i want to make some folders for my project and i want the compiler to compile *.c under /src and output objs to /obj folder.

i checked the build.mak but never found where CC and CFLAGS are used. so i'm confused that where is the rule which makes *.c to *.o?
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Fri Nov 09, 2007 2:50 pm    Post subject: Reply with quote

Implicit rules
http://web.mit.edu/6.033/labdoc/make_10.html
Back to top
View user's profile Send private message
viridite



Joined: 08 Nov 2007
Posts: 16

PostPosted: Fri Nov 09, 2007 3:51 pm    Post subject: Reply with quote

jimparis wrote:
Implicit rules
http://web.mit.edu/6.033/labdoc/make_10.html


i don't think so. because if so how does the make command know which flags are the wanted one?
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Fri Nov 09, 2007 5:28 pm    Post subject: Reply with quote

Because the implicit rules invoke $CC and use $CFLAGS.
Back to top
View user's profile Send private message
viridite



Joined: 08 Nov 2007
Posts: 16

PostPosted: Fri Nov 09, 2007 6:25 pm    Post subject: Reply with quote

ok... thanks
that means i just need to write down the rules directly then i can get what i want?

ok.. could you please check this condition?

there are two folders under the root:
src
obj

then my makefile will be like this:
Code:


ROOT := $(shell pwd)
MODULE_OBJS   =
ZOUT      = $(ROOT)/zout
INCDIR +=$(ROOT)/include
OUTDIR = $(ROOT)/out
OBJDIR =$(ROOT)/obj
SRCDIR =$(ROOT)/src
VPATH =$(OBJDIR)

OBJS = $(OBJDIR)/main.o $(OBJDIR)/kernel.o $(OBJDIR)/graphics.o $(OBJDIR)/menulogic.o
LIBS += -lSDLmain -lSDL -lSDL_ttf -lfreetype -lSDL_image -ljpeg -lpng -lz -lg -lstdc++ -lm -lpsppower -lpspgum_vfpu -lpspgu
TARGET = UI



CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = UI

PSPSDK=$(shell psp-config --pspsdk-path)
PSPBIN = $(PSPSDK)/../bin
CFLAGS += $(shell $(PSPBIN)/sdl-config --cflags)
LIBS += $(shell $(PSPBIN)/sdl-config --libs)


%.o : $(SRCDIR)/%.c
   $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $(OBJDIR)/$@
include $(PSPSDK)/lib/build.mak


but when i type "make" , the screen outputs:
Code:

make: *** No rule to make target `D:/docs/psp/UI/obj/main.o', needed by `UI.elf'


could you check for me the reason?

. Stop.
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Fri Nov 09, 2007 6:59 pm    Post subject: Reply with quote

Use something like
Code:
OBJS=obj/asdf.o

obj/%.o: src/%.c
        $(COMPILE.c) -o $@ $<
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group