| View previous topic :: View next topic |
| Author |
Message |
viridite
Joined: 08 Nov 2007 Posts: 16
|
Posted: Fri Nov 09, 2007 2:38 pm Post subject: Help ~ makefile problems |
|
|
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 |
|
 |
jimparis
Joined: 10 Jun 2005 Posts: 1179 Location: Boston
|
|
| Back to top |
|
 |
viridite
Joined: 08 Nov 2007 Posts: 16
|
Posted: Fri Nov 09, 2007 3:51 pm Post subject: |
|
|
i don't think so. because if so how does the make command know which flags are the wanted one? |
|
| Back to top |
|
 |
jimparis
Joined: 10 Jun 2005 Posts: 1179 Location: Boston
|
Posted: Fri Nov 09, 2007 5:28 pm Post subject: |
|
|
| Because the implicit rules invoke $CC and use $CFLAGS. |
|
| Back to top |
|
 |
viridite
Joined: 08 Nov 2007 Posts: 16
|
Posted: Fri Nov 09, 2007 6:25 pm Post subject: |
|
|
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 |
|
 |
jimparis
Joined: 10 Jun 2005 Posts: 1179 Location: Boston
|
Posted: Fri Nov 09, 2007 6:59 pm Post subject: |
|
|
Use something like | Code: | OBJS=obj/asdf.o
obj/%.o: src/%.c
$(COMPILE.c) -o $@ $< |
|
|
| Back to top |
|
 |
|