sgl

view tests/tests-makefile @ 30:6242b03e7191

merged with win32 branch
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 28 Jun 2011 13:52:02 +0300
parents b5c852d7661e
children
line source
1 name = $(shell pwd | sed 's/.*\///')
2 bin = $(name)
3 src = $(wildcard *.c)
4 obj = $(src:.c=.o)
6 ifeq ($(shell uname -s), Darwin)
7 libsgl = libsgl.dylib
8 libgl = -framework OpenGL
9 else
10 libsgl = libsgl.so
11 libgl = -lGL -lGLU
12 rpath = -Wl,-rpath=.
13 endif
15 sgldir = ../..
17 CC = gcc
18 CFLAGS = -pedantic -Wall -g -I$(sgldir)/include
19 LDFLAGS = -L. $(rpath) -lsgl $(libgl) -lm
21 $(bin): $(obj) $(libsgl)
22 $(CC) -o $@ $(obj) $(LDFLAGS)
24 libsgl.dylib: $(sgldir)/libsgl.dylib
25 ln -s $< $@
27 libsgl.so: $(sgldir)/libsgl.so.0.0
28 ln -s $< $@.0
29 ln -s $< $@
31 .PHONY: clean
32 clean:
33 rm -f $(obj) $(bin)
35 .PHONY: app
36 app: $(bin)
37 mkdir -p Test.app/Contents/MacOS Test.app/Contents/Frameworks
38 cd Test.app/Contents; rm -f Info.plist; ln -s ../../../tests-macinfo.plist Info.plist
39 cp $(bin) Test.app/Contents/MacOS/test
40 cd Test.app/Contents/Frameworks; rm -f libsgl.dylib; ln -s ../../../../../libsgl.dylib .
41 install_name_tool -change libsgl.dylib @executable_path/../Frameworks/libsgl.dylib Test.app/Contents/MacOS/test