sgl
annotate Makefile.in @ 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 | 3d6ee9fb9ac1 |
children |
rev | line source |
---|---|
nuclear@0 | 1 src = $(wildcard src/*.c) |
nuclear@13 | 2 msrc = $(wildcard src/*.m) |
nuclear@19 | 3 obj = $(src:.c=.o) $(msrc:.m=.o) |
nuclear@0 | 4 dep = $(src:.c=.d) |
nuclear@0 | 5 lib_a = libsgl.a |
nuclear@0 | 6 soname = libsgl.so.$(somajor) |
nuclear@0 | 7 lib_so = $(lib_so_$(sys)) |
nuclear@0 | 8 |
nuclear@0 | 9 somajor = 0 |
nuclear@0 | 10 sominor = 0 |
nuclear@0 | 11 |
nuclear@5 | 12 lib_so_unix = $(soname).$(sominor) |
nuclear@0 | 13 lib_so_mac = libsgl.dylib |
nuclear@0 | 14 |
nuclear@0 | 15 sharedopt_unix = -shared -Wl,-soname,$(soname) |
nuclear@0 | 16 sharedopt_mac = -dynamiclib |
nuclear@0 | 17 |
nuclear@12 | 18 ifeq ($(shell uname -s), Darwin) |
nuclear@0 | 19 sys = mac |
nuclear@0 | 20 else |
nuclear@0 | 21 sys = unix |
nuclear@0 | 22 endif |
nuclear@0 | 23 |
nuclear@0 | 24 AR = ar |
nuclear@0 | 25 CC = gcc |
nuclear@35 | 26 CFLAGS = -pedantic -Wall -g -fPIC -Iinclude -Isrc $(wsys_cflags) $(CFLAGS_extra) |
nuclear@7 | 27 LDFLAGS = $(wsys_libs) |
nuclear@0 | 28 |
nuclear@41 | 29 ifeq ($(shell uname -s), Darwin) |
nuclear@41 | 30 CFLAGS += -DGL_SILENCE_DEPRECATION |
nuclear@41 | 31 endif |
nuclear@41 | 32 |
nuclear@0 | 33 .PHONY: all |
nuclear@0 | 34 all: $(lib_so) $(lib_a) |
nuclear@0 | 35 |
nuclear@0 | 36 $(lib_a): $(obj) |
nuclear@0 | 37 $(AR) rcs $@ $(obj) |
nuclear@0 | 38 |
nuclear@0 | 39 $(lib_so): $(obj) |
nuclear@5 | 40 $(CC) $(sharedopt_$(sys)) -o $@ $(obj) $(LDFLAGS) |
nuclear@0 | 41 |
nuclear@20 | 42 %.o: %.m |
nuclear@20 | 43 $(CC) $(CFLAGS) -c -o $@ $< |
nuclear@20 | 44 |
nuclear@0 | 45 -include $(dep) |
nuclear@0 | 46 |
nuclear@0 | 47 %.d: %.c |
nuclear@0 | 48 @$(CPP) $(CFLAGS) -MM -MT $(@:.d=.o) $< >$@ |
nuclear@0 | 49 |
nuclear@0 | 50 .PHONY: clean |
nuclear@0 | 51 clean: |
nuclear@0 | 52 rm -f $(obj) $(dep) $(lib_so) $(lib_a) |
nuclear@0 | 53 |
nuclear@0 | 54 .PHONY: install |
nuclear@0 | 55 install: |
nuclear@0 | 56 mkdir -p $(PREFIX)/include $(PREFIX)/lib |
nuclear@0 | 57 cp $(lib_a) $(PREFIX)/lib/$(lib_a) |
nuclear@0 | 58 cp $(lib_so) $(PREFIX)/lib/$(lib_so) |
nuclear@0 | 59 cp include/sgl.h $(PREFIX)/include/sgl.h |
nuclear@0 | 60 |
nuclear@0 | 61 .PHONY: uninstall |
nuclear@0 | 62 uninstall: |
nuclear@0 | 63 rm -f $(PREFIX)/lib/$(lib_a) |
nuclear@0 | 64 rm -f $(PREFIX)/lib/$(lib_so) |
nuclear@0 | 65 rm -f $(PREFIX)/include/sgl.h |