Browse Source

Do not store compiled objects outside the project tree.

Sam Hocevar 9 years ago
parent
commit
124d8522b1
2 changed files with 13 additions and 4 deletions
  1. 5 2
      examples/opengl2_example/Makefile
  2. 8 2
      examples/opengl3_example/Makefile

+ 5 - 2
examples/opengl2_example/Makefile

@@ -17,7 +17,7 @@
 EXE = opengl2_example
 EXE = opengl2_example
 SOURCES = main.cpp imgui_impl_glfw_gl2.cpp
 SOURCES = main.cpp imgui_impl_glfw_gl2.cpp
 SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.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)
 UNAME_S := $(shell uname -s)
 
 
@@ -52,7 +52,10 @@ ifeq ($(findstring MINGW,$(UNAME_S)),MINGW)
 endif
 endif
 
 
 
 
-.cpp.o:
+%.o:%.cpp
+	$(CXX) $(CXXFLAGS) -c -o $@ $<
+
+%.o:../../%.cpp
 	$(CXX) $(CXXFLAGS) -c -o $@ $<
 	$(CXX) $(CXXFLAGS) -c -o $@ $<
 
 
 all: $(EXE)
 all: $(EXE)

+ 8 - 2
examples/opengl3_example/Makefile

@@ -18,7 +18,7 @@ EXE = opengl3_example
 SOURCES = main.cpp imgui_impl_glfw_gl3.cpp
 SOURCES = main.cpp imgui_impl_glfw_gl3.cpp
 SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp
 SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp
 SOURCES += ../libs/gl3w/GL/gl3w.c
 SOURCES += ../libs/gl3w/GL/gl3w.c
-OBJS = $(addsuffix .o, $(basename $(SOURCES)))
+OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))
 
 
 UNAME_S := $(shell uname -s)
 UNAME_S := $(shell uname -s)
 
 
@@ -53,9 +53,15 @@ ifeq ($(findstring MINGW,$(UNAME_S)),MINGW)
 endif
 endif
 
 
 
 
-.cpp.o:
+%.o:%.cpp
 	$(CXX) $(CXXFLAGS) -c -o $@ $<
 	$(CXX) $(CXXFLAGS) -c -o $@ $<
 
 
+%.o:../../%.cpp
+	$(CXX) $(CXXFLAGS) -c -o $@ $<
+
+%.o:../libs/gl3w/GL/%.c
+	$(CC) $(CFLAGS) -c -o $@ $<
+
 all: $(EXE)
 all: $(EXE)
 	@echo Build complete for $(ECHO_MESSAGE)
 	@echo Build complete for $(ECHO_MESSAGE)