nuclear@0: src = $(wildcard src/*.c) nuclear@0: obj = $(src:.c=.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@0: lib_so_unix = $(soname).$(minor) 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@0: ifeq ($(shell uname -a), 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@1: CFLAGS = -pedantic -Wall -g -fPIC -Iinclude -Isrc 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@0: $(CC) $(sharedopt_$(sys)) -o $@ $(obj) nuclear@0: 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