sgl
annotate 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 |
rev | line source |
---|---|
nuclear@5 | 1 name = $(shell pwd | sed 's/.*\///') |
nuclear@5 | 2 bin = $(name) |
nuclear@5 | 3 src = $(wildcard *.c) |
nuclear@5 | 4 obj = $(src:.c=.o) |
nuclear@5 | 5 |
nuclear@12 | 6 ifeq ($(shell uname -s), Darwin) |
nuclear@12 | 7 libsgl = libsgl.dylib |
nuclear@12 | 8 libgl = -framework OpenGL |
nuclear@12 | 9 else |
nuclear@12 | 10 libsgl = libsgl.so |
nuclear@12 | 11 libgl = -lGL -lGLU |
nuclear@12 | 12 rpath = -Wl,-rpath=. |
nuclear@12 | 13 endif |
nuclear@12 | 14 |
nuclear@5 | 15 sgldir = ../.. |
nuclear@5 | 16 |
nuclear@5 | 17 CC = gcc |
nuclear@5 | 18 CFLAGS = -pedantic -Wall -g -I$(sgldir)/include |
nuclear@12 | 19 LDFLAGS = -L. $(rpath) -lsgl $(libgl) -lm |
nuclear@5 | 20 |
nuclear@41 | 21 ifeq ($(shell uname -s), Darwin) |
nuclear@41 | 22 CFLAGS += -DGL_SILENCE_DEPRECATION |
nuclear@41 | 23 endif |
nuclear@41 | 24 |
nuclear@12 | 25 $(bin): $(obj) $(libsgl) |
nuclear@5 | 26 $(CC) -o $@ $(obj) $(LDFLAGS) |
nuclear@5 | 27 |
nuclear@12 | 28 libsgl.dylib: $(sgldir)/libsgl.dylib |
nuclear@12 | 29 ln -s $< $@ |
nuclear@12 | 30 |
nuclear@5 | 31 libsgl.so: $(sgldir)/libsgl.so.0.0 |
nuclear@5 | 32 ln -s $< $@.0 |
nuclear@5 | 33 ln -s $< $@ |
nuclear@5 | 34 |
nuclear@5 | 35 .PHONY: clean |
nuclear@5 | 36 clean: |
nuclear@5 | 37 rm -f $(obj) $(bin) |
nuclear@17 | 38 |
nuclear@23 | 39 .PHONY: app |
nuclear@23 | 40 app: $(bin) |
nuclear@22 | 41 mkdir -p Test.app/Contents/MacOS Test.app/Contents/Frameworks |
nuclear@23 | 42 cd Test.app/Contents; rm -f Info.plist; ln -s ../../../tests-macinfo.plist Info.plist |
nuclear@22 | 43 cp $(bin) Test.app/Contents/MacOS/test |
nuclear@23 | 44 cd Test.app/Contents/Frameworks; rm -f libsgl.dylib; ln -s ../../../../../libsgl.dylib . |
nuclear@22 | 45 install_name_tool -change libsgl.dylib @executable_path/../Frameworks/libsgl.dylib Test.app/Contents/MacOS/test |