nuclear@0: src = $(wildcard src/*.c) nuclear@13: msrc = $(wildcard src/*.m) nuclear@19: obj = $(src:.c=.o) $(msrc:.m=.o) nuclear@0: dep = $(src:.c=.d) nuclear@0: lib_a = libsgl.a nuclear@0: soname = libsgl.so.$(somajor) nuclear@0: lib_so = $(lib_so_$(sys)) nuclear@0: nuclear@0: somajor = 0 nuclear@0: sominor = 0 nuclear@0: nuclear@5: lib_so_unix = $(soname).$(sominor) nuclear@0: lib_so_mac = libsgl.dylib nuclear@0: nuclear@0: sharedopt_unix = -shared -Wl,-soname,$(soname) nuclear@0: sharedopt_mac = -dynamiclib nuclear@0: nuclear@12: ifeq ($(shell uname -s), Darwin) nuclear@0: sys = mac nuclear@0: else nuclear@0: sys = unix nuclear@0: endif nuclear@0: nuclear@0: AR = ar nuclear@0: CC = gcc nuclear@35: CFLAGS = -pedantic -Wall -g -fPIC -Iinclude -Isrc $(wsys_cflags) $(CFLAGS_extra) nuclear@7: LDFLAGS = $(wsys_libs) nuclear@0: nuclear@0: .PHONY: all nuclear@0: all: $(lib_so) $(lib_a) nuclear@0: nuclear@0: $(lib_a): $(obj) nuclear@0: $(AR) rcs $@ $(obj) nuclear@0: nuclear@0: $(lib_so): $(obj) nuclear@5: $(CC) $(sharedopt_$(sys)) -o $@ $(obj) $(LDFLAGS) nuclear@0: nuclear@20: %.o: %.m nuclear@20: $(CC) $(CFLAGS) -c -o $@ $< nuclear@20: nuclear@0: -include $(dep) nuclear@0: nuclear@0: %.d: %.c nuclear@0: @$(CPP) $(CFLAGS) -MM -MT $(@:.d=.o) $< >$@ nuclear@0: nuclear@0: .PHONY: clean nuclear@0: clean: nuclear@0: rm -f $(obj) $(dep) $(lib_so) $(lib_a) nuclear@0: nuclear@0: .PHONY: install nuclear@0: install: nuclear@0: mkdir -p $(PREFIX)/include $(PREFIX)/lib nuclear@0: cp $(lib_a) $(PREFIX)/lib/$(lib_a) nuclear@0: cp $(lib_so) $(PREFIX)/lib/$(lib_so) nuclear@0: cp include/sgl.h $(PREFIX)/include/sgl.h nuclear@0: nuclear@0: .PHONY: uninstall nuclear@0: uninstall: nuclear@0: rm -f $(PREFIX)/lib/$(lib_a) nuclear@0: rm -f $(PREFIX)/lib/$(lib_so) nuclear@0: rm -f $(PREFIX)/include/sgl.h