You are not logged in.
Hello,
Few days before I started playing with GCC and C++. I'm using VIM as my IDE, so I have to write my own makefiles - and I have a little problem with this one.
You see, I wanted so my usual project structure would look like this one:
Project/:
/bin - directory with binary and object files for my project.
/src - directory with source files for my project
I am calling gcc from within src directory - is there any way, so I can force outputting all object files and binary files into /bin directory?
As for now, my sample makefile looks like this:
CXX=g++
CXXFLAGS=-s -O3
OBJS=ArrayArguments.o
ArrayArguments : $(OBJS)
$(CXX) $^ -o $@
%.o : %.c
$(CXX) -c $(CXXFLAGS) $< -o $@
clean:
rm -f *.o
In VIM, I have following command attached to F8 key:
map <F8> : call CompileGcc()<CR>
func! CompileGcc()
exec "w!"
exec "make"
endfunc
If anyone could post some guidelines or maybe some links to resources about basic usages of GCC so I could find the solution on my own - I would be grateful.
cheers,
praavDa.
gvim -c "exec \"normal itYNQ#v'Z#ABG#GUR#BAYL#BAR\"|%s/#/ /g|normal ggVGg?ggVG~"
Offline
Sure, it's all about how you write your Makefile targets - a slight modification to your current Makefile should work.
CXX=g++
CXXFLAGS=-s -O3
OBJS=ArrayArguments.o
OUT_DIR=/bin
OUT_OBJS=$(addprefix $(OUT_DIR)/,$(OBJS))
ArrayArguments : $(OUT_OBJS)
$(CXX) $^ -o $@
%(OUT_DIR)/%.o : %.c
$(CXX) -c $(CXXFLAGS) $< -o $@
clean:
rm -f $(OUT_DIR)/*.o
Offline