Makefile for compiling C sources that use GLUT, multi-OS version (Darwin, Linux)
Just found out how to properly compile C sources (with GLUT) on OS X. I modified a Makefile that was meant for Linux.
Check out the Gist: https://gist.github.com/3799013
Or take a peek at the code:
# Makefile for Phigs examples
OS = $(shell uname -s)
APPS = application_name
OBJ = $(APPS).o
SRC = $(APPS).c
CFLAGS = $(C_OPTS) -I/usr/include
ifeq ($(OS), Darwin)
LIBS = -framework GLUT -framework OpenGL -framework Cocoa
else
LIBS = -L/usr/X11R6/lib -lX11 -lXi -lglut -lGL -lGLU -lm -lpthread
endif
application:$(APPS)
clean:
rm -f $(APPS) *.raw *.o core a.out
realclean: clean
rm -f *~ *.bak *.BAK
.SUFFIXES: c o
.c.o:
$(CC) -c $(CFLAGS) $<
$(APPS): $(OBJ)
$(CC) -o $(APPS) $(CFLAGS) $(OBJ) $(LIBS)
depend:
makedepend -- $(CFLAGS) $(SRC)
The following page was the key: http://yallara.cs.rmit.edu.au/~aholkner/i3d/blog/mac.xhtml
Written by Gergely Tamás Kurucz
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Osx
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#