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?
Help ~ makefile problems
Implicit rules
http://web.mit.edu/6.033/labdoc/make_10.html
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?jimparis wrote:Implicit rules
http://web.mit.edu/6.033/labdoc/make_10.html
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:
but when i type "make" , the screen outputs:
could you check for me the reason?
. Stop.
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: Select all
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
Code: Select all
make: *** No rule to make target `D:/docs/psp/UI/obj/main.o', needed by `UI.elf'
. Stop.
Use something like
Code: Select all
OBJS=obj/asdf.o
obj/%.o: src/%.c
$(COMPILE.c) -o $@ $<