Skip to content

Instantly share code, notes, and snippets.

@othonalberto
Created May 8, 2018 13:30
Show Gist options
  • Save othonalberto/40826e9aee90e124e3ca4d40c7a0db00 to your computer and use it in GitHub Desktop.
Save othonalberto/40826e9aee90e124e3ca4d40c7a0db00 to your computer and use it in GitHub Desktop.
# Quais objetos têm que ser compilados
OBJS = main.c
# Qual compilador usar
CC = gcc
# Flags para o compilador
COMPILER_FLAGS = -w
# aqui eu recebo o uname para depois usar sabendo de é mac ou linux. Windows não trabalho no momento
os = $(shell uname -s)
ifeq ($(os), Darwin)
# Flags de linkagem de biblioteca
LINKER_FLAGS = -framework GLUT -framework OpenGL
# Caminhos de include que precisam
INCLUDE_PATHS = -I/usr/local/include -I/opt/X11/include
# Caminhos de bibliotecas que precisam
LIBRARY_PATHS = -L/usr/local/lib -I/opt/X11/lib
else
# Flags de linkagem de biblioteca
LINKER_FLAGS = -lglut -lGLU -lGL -L/usr/X11R6/lib/ -lXmu -lXi -lXext -lX11 -lXt
endif
# Nome da saída
OUTPUT_NAME = a.out
all : $(OBJS)
$(CC) $(OBJS) $(INCLUDE_PATHS) $(LIBRARY_PATHS) $(COMPILER_FLAGS) $(LINKER_FLAGS) -o $(OUTPUT_NAME)
@echo Pronto.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment