From 124d8522b1693f4e5e6aeb86581588f2aa94bc22 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Sat, 22 Oct 2016 13:36:49 +0200 Subject: [PATCH] Do not store compiled objects outside the project tree. --- examples/opengl2_example/Makefile | 7 +++++-- examples/opengl3_example/Makefile | 10 ++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/examples/opengl2_example/Makefile b/examples/opengl2_example/Makefile index 621227b1..aa7dbf47 100644 --- a/examples/opengl2_example/Makefile +++ b/examples/opengl2_example/Makefile @@ -17,7 +17,7 @@ EXE = opengl2_example SOURCES = main.cpp imgui_impl_glfw_gl2.cpp SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp -OBJS = $(addsuffix .o, $(basename $(SOURCES))) +OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) UNAME_S := $(shell uname -s) @@ -52,7 +52,10 @@ ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) endif -.cpp.o: +%.o:%.cpp + $(CXX) $(CXXFLAGS) -c -o $@ $< + +%.o:../../%.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< all: $(EXE) diff --git a/examples/opengl3_example/Makefile b/examples/opengl3_example/Makefile index e2dd9761..008f2ca7 100644 --- a/examples/opengl3_example/Makefile +++ b/examples/opengl3_example/Makefile @@ -18,7 +18,7 @@ EXE = opengl3_example SOURCES = main.cpp imgui_impl_glfw_gl3.cpp SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp SOURCES += ../libs/gl3w/GL/gl3w.c -OBJS = $(addsuffix .o, $(basename $(SOURCES))) +OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) UNAME_S := $(shell uname -s) @@ -53,9 +53,15 @@ ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) endif -.cpp.o: +%.o:%.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< +%.o:../../%.cpp + $(CXX) $(CXXFLAGS) -c -o $@ $< + +%.o:../libs/gl3w/GL/%.c + $(CC) $(CFLAGS) -c -o $@ $< + all: $(EXE) @echo Build complete for $(ECHO_MESSAGE)