Skip to content

Instantly share code, notes, and snippets.

@hleonps
Last active September 10, 2016 13:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hleonps/cb6a57c577cb9a79a5b9c5697d97c44d to your computer and use it in GitHub Desktop.
Save hleonps/cb6a57c577cb9a79a5b9c5697d97c44d to your computer and use it in GitHub Desktop.
Makefile C (OpenGL / Mesa) - Linux and macOS
OS := $(shell uname)
CC = gcc
CFLAGS = -std=gnu99 -Wall -I./headers
ifeq ($(OS),Darwin)
LDLIBS = -framework GLUT -framework OpenGL -framework Cocoa
else
LDLIBS = -lX11 -lglut -lGLU -lGL
endif
C_SOURCES = $(wildcard ./src/*.c)
C_OBJECTS = ./*.o
EXECUTABLE = ./dist/appname
all: compile
compile: $(C_SOURCES)
$(CC) $(CFLAGS) $(C_SOURCES) $(LDLIBS) -o $(EXECUTABLE)
clean:
rm -rf $(EXECUTABLE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment