Skip to content

Instantly share code, notes, and snippets.

@alifarazz
Last active April 24, 2018 18:04
Show Gist options
  • Save alifarazz/48646e35c72ff626b040c19012b74158 to your computer and use it in GitHub Desktop.
Save alifarazz/48646e35c72ff626b040c19012b74158 to your computer and use it in GitHub Desktop.
Makefile for personal OpenGL develpment.
# compiler
CC=clang++
# linker
LD=$(CC)
# optimisation
OPT=-ggdb
# warnings
WARN=-Wall -Wextra
# standards
STD=c++14
# pthread
# PTHREAD=-pthread
PTHREAD=
TARGET = sibil
CCFLAGS = $(WARN) $(PTHREAD) -std="$(STD)" -stdlib=libstdc++ $(OPT) -pipe `pkg-config --cflags glfw3 glew glm` -I/usr/include/FreeImage
LDFLAGS = $(PTHREAD) `pkg-config --libs glfw3 glew glm` -lfreeimage # -export-dynamic
SRCS = $(wildcard *.cpp)
OBJECTS = $(patsubst %.cpp, %.o, $(SRCS))
.PHONY: default all clean
default: $(TARGET)
all: default
%.o: %.cpp
$(CC) $(CCFLAGS) -c $< -o $@
.PRECIOUS: $(TARGET) $(OBJECTS)
$(TARGET): $(OBJECTS)
$(LD) $(OBJECTS) $(LDFLAGS) -o $@
clean:
$(RM) *.o
$(RM) $(TARGET)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment