Last active
September 10, 2016 13:35
-
-
Save hleonps/cb6a57c577cb9a79a5b9c5697d97c44d to your computer and use it in GitHub Desktop.
Makefile C (OpenGL / Mesa) - Linux and macOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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