nuclear@5: name = $(shell pwd | sed 's/.*\///') nuclear@5: bin = $(name) nuclear@5: src = $(wildcard *.c) nuclear@5: obj = $(src:.c=.o) nuclear@5: nuclear@12: ifeq ($(shell uname -s), Darwin) nuclear@12: libsgl = libsgl.dylib nuclear@12: libgl = -framework OpenGL nuclear@12: else nuclear@12: libsgl = libsgl.so nuclear@12: libgl = -lGL -lGLU nuclear@12: rpath = -Wl,-rpath=. nuclear@12: endif nuclear@12: nuclear@5: sgldir = ../.. nuclear@5: nuclear@5: CC = gcc nuclear@5: CFLAGS = -pedantic -Wall -g -I$(sgldir)/include nuclear@12: LDFLAGS = -L. $(rpath) -lsgl $(libgl) -lm nuclear@5: nuclear@12: $(bin): $(obj) $(libsgl) nuclear@5: $(CC) -o $@ $(obj) $(LDFLAGS) nuclear@5: nuclear@12: libsgl.dylib: $(sgldir)/libsgl.dylib nuclear@12: ln -s $< $@ nuclear@12: nuclear@5: libsgl.so: $(sgldir)/libsgl.so.0.0 nuclear@5: ln -s $< $@.0 nuclear@5: ln -s $< $@ nuclear@5: nuclear@5: .PHONY: clean nuclear@5: clean: nuclear@5: rm -f $(obj) $(bin) nuclear@17: nuclear@23: .PHONY: app nuclear@23: app: $(bin) nuclear@22: mkdir -p Test.app/Contents/MacOS Test.app/Contents/Frameworks nuclear@23: cd Test.app/Contents; rm -f Info.plist; ln -s ../../../tests-macinfo.plist Info.plist nuclear@22: cp $(bin) Test.app/Contents/MacOS/test nuclear@23: cd Test.app/Contents/Frameworks; rm -f libsgl.dylib; ln -s ../../../../../libsgl.dylib . nuclear@22: install_name_tool -change libsgl.dylib @executable_path/../Frameworks/libsgl.dylib Test.app/Contents/MacOS/test