sgl

view tests/tests-makefile @ 41:f4ea3a88b05a

macos build fixes. Patch by Andrew Woods
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 25 Jan 2025 22:26:40 +0200
parents 505915b0f3da
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 ifeq ($(shell uname -s), Darwin)
22 CFLAGS += -DGL_SILENCE_DEPRECATION
23 endif
25 $(bin): $(obj) $(libsgl)
26 $(CC) -o $@ $(obj) $(LDFLAGS)
28 libsgl.dylib: $(sgldir)/libsgl.dylib
29 ln -s $< $@
31 libsgl.so: $(sgldir)/libsgl.so.0.0
32 ln -s $< $@.0
33 ln -s $< $@
35 .PHONY: clean
36 clean:
37 rm -f $(obj) $(bin)
39 .PHONY: app
40 app: $(bin)
41 mkdir -p Test.app/Contents/MacOS Test.app/Contents/Frameworks
42 cd Test.app/Contents; rm -f Info.plist; ln -s ../../../tests-macinfo.plist Info.plist
43 cp $(bin) Test.app/Contents/MacOS/test
44 cd Test.app/Contents/Frameworks; rm -f libsgl.dylib; ln -s ../../../../../libsgl.dylib .
45 install_name_tool -change libsgl.dylib @executable_path/../Frameworks/libsgl.dylib Test.app/Contents/MacOS/test