diff --git a/examples/sdl_opengl3_example/Makefile b/examples/sdl_opengl3_example/Makefile index 45f6a663..67f0f03b 100644 --- a/examples/sdl_opengl3_example/Makefile +++ b/examples/sdl_opengl3_example/Makefile @@ -15,9 +15,10 @@ #CXX = clang++ EXE = sdl_opengl3_example -OBJS = main.o imgui_impl_sdl_gl3.o -OBJS += ../../imgui.o ../../imgui_demo.o ../../imgui_draw.o -OBJS += ../libs/gl3w/GL/gl3w.o +SOURCES = main.cpp imgui_impl_sdl_gl3.cpp +SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp +SOURCES += ../libs/gl3w/GL/gl3w.c +OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) UNAME_S := $(shell uname -s) @@ -50,14 +51,20 @@ 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) $(EXE): $(OBJS) - $(CXX) -o $(EXE) $(OBJS) $(CXXFLAGS) $(LIBS) + $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS) clean: - rm $(EXE) $(OBJS) + rm -f $(EXE) $(OBJS)