sgl

view tests/tests-makefile @ 22:b5c852d7661e

foo
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 26 Jun 2011 23:57:53 +0300
parents ee7b3a898b6b
children 505915b0f3da
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: install
36 install:
37 mkdir -p Test.app/Contents/MacOS Test.app/Contents/Frameworks
38 cd Test.app/Contents; ln -s ../../../tests-macinfo.plist Info.plist
39 cp $(bin) Test.app/Contents/MacOS/test
40 cd Test.app/Contents/Frameworks; ln -s ../../../../../libsgl.dylib .
41 install_name_tool -change libsgl.dylib @executable_path/../Frameworks/libsgl.dylib Test.app/Contents/MacOS/test