2015-10-11 19:40:55 -04:00

46 lines
955 B
Makefile

TARGET := app
OBJS := app.o GL3/gl3w.o
OBJS += glcxx/src/glcxx/Array.o
OBJS += glcxx/src/glcxx/Buffer.o
OBJS += glcxx/src/glcxx/Program.o
OBJS += glcxx/src/glcxx/Shader.o
REPOS := glcxx glm
CCFLAGS := $(shell sdl2-config --cflags)
ifeq (MINGW,$(findstring MINGW,$(shell uname)))
LIBS := -lopengl32 -lmingw32
CXX := mingw32-g++
TARGET := $(TARGET).exe
else
LIBS := -lGL `sdl2-config --libs`
endif
LIBS += -ldl
LDFLAGS := $(LIBS) $(shell sdl2-config --libs)
CCFLAGS += -I glcxx/include -I glm -I.
CXXFLAGS += -std=gnu++14
CCFLAGS += -DGLCXX_GL_INCLUDE='"GL3/gl3w.h"'
all: submodule_init $(TARGET)
$(TARGET): $(OBJS)
$(CXX) -o $(TARGET) $^ $(LDFLAGS)
%.o: %.c
$(CC) -c -o $@ $(CCFLAGS) $(CFLAGS) $<
%.o: %.cc
$(CXX) -c -o $@ $(CCFLAGS) $(CXXFLAGS) $<
%.o: %.cpp
$(CXX) -c -o $@ $(CCFLAGS) $(CXXFLAGS) $<
.PHONY: submodule_init
submodule_init:
@if [ ! -e glcxx ]; then \
git submodule update --init; \
fi
clean:
-rm -f $(TARGET) *~ $(OBJS)