There is such a makefile:
CXX := mingw32-g++ LINK := mingw32-g++ INCLUDE := -I"../usr/include" CXX_FLAGS := -std=c++1y -DDEBUG -g -O0 -Wall -c -fmessage-length=0 $(INCLUDE) RM := rm -rf LIBS_DIR := -L"../usr/lib/" LIBS := -lDekaLib -lmingw32 -lSDL2main -lSDL2 -lSDL2_image -lSDL2_ttf CPP_SRCS := $(wildcard ../src/*.cpp) $(wildcard ../src/**/*.cpp) OBJS := $(CPP_SRCS:.cpp=.o) all: ADG.exe %.o : %.cpp @echo 'Building $<' $(CXX) $(CXX_FLAGS) -o "$@" "$<" @echo 'Finished building $<' ADG.exe: ../Debug ../Debug/resources $(OBJS) @echo 'Building target: $@' $(LINK) $(LIBS_DIR) -o "../Debug/ADG.exe" $(OBJS) $(LIBS) cp -r ../resources/* "../Debug/resources" cp -r ../usr/bin/* "../Debug" @echo 'Finished building target: $@' @echo ' ' clean: $(RM) $(OBJS) "../Debug" ../Debug: mkdir ../Debug ../Debug/resources: mkdir ../Debug/resources It is working, but it creates object files in the source folder. How do I make the object files in the same folder as the makefile?